Experiment No.4
Experiment No.4
Experiment No.4
Title: Apply different thresholds &filter using MATLAB and DIPLAB- 1.0
Software Used:
Programming Language – MATLAB® (Version 7 or higher), VisualDSP++
Operating System – Microsoft Windows (XP 32-bit or higher)(Preferable)
Theory:
Thresholding
If in original contrast stretching function r1=r2=th, s1=00 and s2=L-1, the
transformation function becomes a thresholding function, that creates a binary
image. This function is shown as below.
Median Filter
Procedure:
Using MATLAB
1. Open an image using ‘imread’ and ‘imshow’ functions. Convert it to
grayscale if required.
2. For Global Single thresholding (Manual), choose a threshold value‘t’.
Obtain the image segmentation result by using "im2bw function using 't’.
Display the result.
3. For Global Dual thresholding (Manual), choose two threshold values "t1"
and "t2".Obtain the image segmentation result by designing an algorithm
using conditional statements. Display the result.
4. For Global Single thresholding (Automated), use function 'graythresh' to
obtain the threshold value‘t’ automatically by Otsu's method. Obtain the
image segmentation result by using ‘im2bw’ function using‘t’. Display
the result.
Using DIPLAB
1. Load the image in processor memory
2. Note down the height and width of image which is loaded.
3. Replace the value of variable iImgWdt and iImgHgt with image width
and height
4. Compile the program
5. Run the program with multi-processor Run Mode
6. Read the output image from the processor memory defined in the
program
Conclusion: