eLynx SDK v3.3.0
C++ image processing API reference

Remove the high compression jpeg artefact

Here is a sample to show you how to remove some artifact of the 8x8 bloc DCT jpeg compression.

We use the bilateral filter that blur conserving the edges of the image.

scantext_x3.png

scantext_x3.png
  const char * filenameIn = "../../datas/scantext.jpg";
  cout << ".Loading RGBub image file: " << filenameIn << endl;
  ImageVariant image(filenameIn);
  bool bSuccess = image.IsValid();

  cout << ".Get a sub part of image" << endl;
  const uint32 x = 332;
  const uint32 y = 332;
  const uint32 w = 144;
  const uint32 h = 82;
  bSuccess = image.Crop(x,y, w,h);

  cout << ".Zoom image to see artifact details" << endl;
  ImageVariant image2 = image;
  const uint32 z = 3;
  bSuccess = image2.Zoom(z);

  char * filenameOut = "../../datas/output/scantext_x3.png";
  cout << ".Save the original zoomed image: " << filenameOut << " ";
  bSuccess = image2.Save(filenameOut);
  cout << (bSuccess? "successfull" : "failed") << endl;

  cout << ".Apply bilateral filter" << endl;
  const double radius = 6.;
  const double spatialVariance = 2.;
  const double rangeVariance = 50.;
  bSuccess = image.ApplyBilateral(radius, spatialVariance, rangeVariance);

  cout << ".Zoom image to see correction details" << endl;
  bSuccess = image.Zoom(z);

  filenameOut = "../../datas/output/scantext_cleaned_x3.png";
  cout << ".Save image as " << filenameOut << " ";
  bSuccess = image.Save(filenameOut);
  cout << (bSuccess? "successfull" : "failed") << endl;

Output:

.Loading RGBub image file: ../../datas/scantext.jpg
.Get a sub part of image
.Zoom image to see artifact details
.Save the original zoomed image: ../../datas/output/scantext_x3.png successfull
.Apply bilateral filter
.Zoom image to see correction details
.Save image as ../../datas/output/scantext_cleaned_x3.png successfull
scantext_x3.png

scantext_x3.png
scantext_cleaned_x3.png

scantext_cleaned_x3.png

Generated on Thu Dec 9 2010 by doxygen 1.7.2