In this application we test the effectiveness of the image processing algorithms, manipulate the pixel intensities, and construct an edge detector using a convolution mask using the image shown.
To test the effectiveness of the image processing algorithms, we use the following image. To view the image, click the View Image button. To use a different image, click the Load Image button.
With the enhancements to the ImageTools package, we can easily manipulate the pixel intensities of the images. Starting with the already loaded image, we can plot the histogram of the pixels.
By applying the function to all the pixels in the image, we adjust the histogram of the image. Note that by applying this operator, the pixel intensities no longer fit between 0 and 1. We must therefore also use the FitIntensity command to rescale the pixel intensities to fit between 0 and 1.
img1 ≔ FitIntensitymapevalhfsqrt, img:
Click the button above to see the effect of the transformation. The original, as well as the transformed image is shown.
We can plot the histogram of the original image and the modified image.
plotsdisplayPlotHistogramimg, 80, color=red, legend=Original Image, PlotHistogramimg1, 80, color=blue, legend=Sqrt operator
Similarly, we can apply the exponential operator. To intensify the effect of the exponential operators, we multiply the pixel intensity by 5 before applying the operator.
img2 ≔ FitIntensitymapevalhfx→exp2 ⋅x, img:
Click the button above to see the effect of both transformations. The original as well as the two transformed images are shown.
plotsdisplayPlotHistogramimg, 80, color=red, legend=Original Image, PlotHistogramimg1, 80, color=blue, legend=Sqrt operator, PlotHistogramimg2, 80, color=green,legend=Exp operator
We would like to take the image modified by the exponential operator and adjust the histogram so that the occurrence of all intensity levels are equally likely. First, we create a cumulative histogram of the image.
v, c ≔ Histogramimg, 100, normalized, centers, cumulative,autorange: v1 ≔ convertv, list: c1 ≔ convertc,list: lst≔zipx,y→x,y, c1, v1: plotlst
Now we want to use this cumulative histogram as a function that maps the intensity levels. We use the Spline version of the CurveFitting command to build a function from the histogram points.
spl≔unapplyCurveFittingSplinelst, x, x:
Then we apply the function to the image and plot the histogram for both the distorted image and the equalized image.
plotsdisplayPlotHistogramimg, color=green, legend=Distorted Image, PlotHistogramimg3, color=brown, legend=Equalized Image
Execute the command below to view the altered image.
Click the button above to see the effect of the histogram equalization.
Using a convolution mask, we construct an edge detector. First, we construct a Gaussian mask that will be used to smooth the image and reduce the effect of noise on the edges. Then, using one of several edge masks, we extract the horizontal and vertical edges. These edges are combined and a threshold operation is applied to extract the edges from the image.
The convolution mask parameters can be set with the following controls.
Surface Plot of the Convolution Mask
Select the operator
Download Help Document
What kind of issue would you like to report? (Optional)