Automation and Drives SIMATIC HMI The Human Machine Interface for internal use only Scope of Presentation Dept. of Industrial Electronics and Control Eng. Faculty of Electronic Engineering Use Morphological Opening to Estimate the Background Read The Image Introduction Threshold the Image Subtract Background Image from Original Image Questions and Discussion Minoufiya University Increase the Image Contrast Eng./ Essam Nabil Part : one Image Processing Using MATLAB
Automation and Drives SIMATIC HMI The Human Machine Interface for internal use only Scope of Presentation Dept. of Industrial Electronics and Control Eng. Faculty of Electronic Engineering Use Morphological Opening to Estimate the Background Read The Image Introduction Threshold the Image Subtract Background Image from Original Image Questions and Discussion Minoufiya University Increase the Image Contrast Eng./ Essam Nabil Introduction Using an image of rice grains, this example illustrates how you can enhance an image to correct for nonuniform illumination, then use the enhanced image to identify individual grains. Step 1: Read and Display the Image Step 2: Use Morphological Opening to Estimate the Background Step 3: Subtract Background Image from Original Image Step 4: Increase the Image Contrast Step 5: Threshold the Image
Automation and Drives SIMATIC HMI The Human Machine Interface for internal use only Scope of Presentation Dept. of Industrial Electronics and Control Eng. Faculty of Electronic Engineering Use Morphological Opening to Estimate the Background Read The Image Introduction Threshold the Image Subtract Background Image from Original Image Questions and Discussion Minoufiya University Increase the Image Contrast Eng./ Essam Nabil Read The Image I = imread('filename.fmt') : reads a grayscale or color image specified by filename and format fmt and stores it into array variable I. If the file is not in the current folder, or in a folder on the MATLAB path, specify the full pathname as: I = imread(‘D:\pictures\asd.jpg’) figure :creates a new figure object using default property values, and automatically becomes the current figure until a new figure is either created or called. imshow(I) :displays the stored image of the variable array I. title('string') :adds the title specified by ‘string’ at the top and in the center of the current axes or figure.
Automation and Drives SIMATIC HMI The Human Machine Interface for internal use only Scope of Presentation Dept. of Industrial Electronics and Control Eng. Faculty of Electronic Engineering Use Morphological Opening to Estimate the Background Read The Image Introduction Threshold the Image Subtract Background Image from Original Image Questions and Discussion Minoufiya University Increase the Image Contrast Eng./ Essam Nabil I = imread('rice.png'); figure, imshow(I) I = imread('rice.png'); figure, imshow(I) Read in the ‘rice.png' image and bring its data to workspace. Read The Image
Automation and Drives SIMATIC HMI The Human Machine Interface for internal use only Scope of Presentation Dept. of Industrial Electronics and Control Eng. Faculty of Electronic Engineering Use Morphological Opening to Estimate the Background Read The Image Introduction Threshold the Image Subtract Background Image from Original Image Questions and Discussion Minoufiya University Increase the Image Contrast Eng./ Essam Nabil Notice that the background illumination is brighter in the center of the image than at the bottom. Use imopen to estimate the background illumination. Use Morphological Opening to Estimate the Background IM2 = imopen(IM,SE) performs morphological opening on the grayscale or binary image IM with the structuring element SE. background =imopen(I,strel('disk',15));
Automation and Drives SIMATIC HMI The Human Machine Interface for internal use only Scope of Presentation Dept. of Industrial Electronics and Control Eng. Faculty of Electronic Engineering Use Morphological Opening to Estimate the Background Read The Image Introduction Threshold the Image Subtract Background Image from Original Image Questions and Discussion Minoufiya University Increase the Image Contrast Eng./ Essam Nabil Use Morphological Opening to Estimate the Background
Automation and Drives SIMATIC HMI The Human Machine Interface for internal use only Scope of Presentation Dept. of Industrial Electronics and Control Eng. Faculty of Electronic Engineering Use Morphological Opening to Estimate the Background Read The Image Introduction Threshold the Image Subtract Background Image from Original Image Questions and Discussion Minoufiya University Increase the Image Contrast Eng./ Essam Nabil Subtract Background Image from Original Image Notice that the background illumination is brighter in the center of the image than at the bottom. Use imopen to estimate the background illumination. I2 = I – background; figure, imshow(I2); I2 = I – background; figure, imshow(I2); I2 = imsubtract(I,background); figure, imshow(I2); I2 = imsubtract(I,background); figure, imshow(I2); OR
Automation and Drives SIMATIC HMI The Human Machine Interface for internal use only Scope of Presentation Dept. of Industrial Electronics and Control Eng. Faculty of Electronic Engineering Use Morphological Opening to Estimate the Background Read The Image Introduction Threshold the Image Subtract Background Image from Original Image Questions and Discussion Minoufiya University Increase the Image Contrast Eng./ Essam Nabil Increase the Image Contrast I3 = imadjust(I2); figure, imshow(I3); I3 = imadjust(I2); figure, imshow(I3);
Automation and Drives SIMATIC HMI The Human Machine Interface for internal use only Scope of Presentation Dept. of Industrial Electronics and Control Eng. Faculty of Electronic Engineering Use Morphological Opening to Estimate the Background Read The Image Introduction Threshold the Image Subtract Background Image from Original Image Questions and Discussion Minoufiya University Increase the Image Contrast Eng./ Essam Nabil Threshold the Image Create a new binary image by thresholding the adjusted image. level = graythresh(I3); bw = im2bw(I3,level); figure, imshow(bw); level = graythresh(I3); bw = im2bw(I3,level); figure, imshow(bw);
Automation and Drives SIMATIC HMI The Human Machine Interface for internal use only Scope of Presentation Dept. of Industrial Electronics and Control Eng. Faculty of Electronic Engineering Use Morphological Opening to Estimate the Background Read The Image Introduction Threshold the Image Subtract Background Image from Original Image Questions and Discussion Minoufiya University Increase the Image Contrast Eng./ Essam Nabil Questions and Discussion