© Vladimir Kovalevsky 2019
Vladimir KovalevskyModern Algorithms for Image Processinghttps://doi.org/10.1007/978-1-4842-4237-7_5

5. Project WFshadBinImpulse

Vladimir Kovalevsky1 
(1)
Berlin, Germany
 
We have also developed the project WFshadBinImpulse where the procedures of shading correction, thresholding, and suppression of impulse noise are combined. This combination is especially useful for processing images of photographs of old drawings (refer to Figure 2-8). The form of this project is shown in Figure 5-1.
../images/474294_1_En_5_Chapter/474294_1_En_5_Fig1_HTML.jpg
Figure 5-1

The form of the project WFshadBinImpulse

Clicking Open image starts the usual part of the project with the dialog OpenFileDialog. Also seven images of the class CImageOrigIm, SigmaIm, GrayIm, MeanIm, ShadIm, BinIm, and ImpulseIm—are defined in this part of the project.

The user should specify the kind of the image by choosing one of four options: Drawing with dark lines, or Drawing with light lines, No drawing Div, or No drawing Sub. Starting values of the parameters Window in per mille of Width, Lightness, Threshold, and the parameter of suppressing impulse noise will be set automatically according to the choice of these options. The user can correct these values by means of the corresponding numericUpDown tools . Window will be specified as a part of the width of the original image in per mille as previously explained. The specification in per mille of the width of the image rather than directly in pixels is necessary because the optimal width of the window depends on the size of the image, but users usually do not know how big the image is.

After the user has specified the type of image, he or she should click Shading. For the shading correction, the local mean lightness of the image is calculated by the method FastAverageM described previously. Then the images SubIm and DivIm are calculated by the CorrectShading method described in Chapter 4. The shading-corrected image is shown in the picture box at the right. The user can correct the proposed values of the parameters to obtain the best possible corrected image.

The CorrectShading method also draws the histograms of the shading-corrected image. The user can specify the threshold by clicking the histogram. The thresholded image is shown immediately.

Suggested values of the parameters of the methods used for suppressing impulse noise are also set automatically. The user should nevertheless test some values for these parameters.

If the image is a drawing, the user should draw in pictureBox1 (the original image) small rectangles around the parts of the image where small spots (e.g., the eyes of people) should not be eliminated. The user should click with the mouse the upper left und lower right corners of the rectangles. The rectangles appear in a blue color. It is possible to define these rectangles anew after the suppression of impulse noise has been run. It is possible to draw up to six rectangles. The doubled maximum number of the rectangles called maxNumber is defined at the beginning of Form1.

If the user is satisfied with the results of shading correction and of thresholding then he or she can start the suppression of impulse noise seen as small black and white spots in the thresholded image by clicking Impulse noise. If the user is not satisfied with the obtained results, he or she can try to change the values of Delete dark and Delete light by means of the corresponding numericUpDown tools. These values specify the maximum number of pixels in the spots that should be deleted.

If the user is satisfied with the final results, then he or she can save the result. It is necessary to click Save result, choose the correct directory, and specify the name of the file for the resulting image with the extension .bmp or .jpg.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.193.158