450 likes | 1.01k Views
EEEB0765 Digital Signal Processing for Embedded Systems 8 Video and Image Processing in Embedded Systems (I). Assoc. Prof. Dr. Peerapol Yuvapoositanon Dept. of Electronic Engineering. Outline. Fundamental of Video and Image Processing Morphological Operations Video Play in Simulink
E N D
EEEB0765 Digital Signal Processing for Embedded Systems 8Video and Image Processing in Embedded Systems (I) Assoc. Prof. Dr. PeerapolYuvapoositanon Dept. of Electronic Engineering EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Outline • Fundamental of Video and Image Processing • Morphological Operations • Video Play in Simulink • Hands on Simulation with Matlab and Simulink EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Mathematical Morphology • Morphology is the study of the shape and form of objects. • Object extraction • Image filtering operations, such as removal of small objects or noise from an image • Image segmentation operations, such as separating connected objects • Measurement operations, such as texture analysis and shape description EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Kernel 3x3 EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Strel= Structuring Element SE = strel('arbitrary', NHOOD) creates a flat structuring element where NHOOD specifies the neighborhood. EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
StrelExamples (I) SE = strel('disk', R, N) creates a flat, disk-shaped structuring element, where R specifies the radius. EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Strel Examples (II) SE = strel('diamond', R) creates a flat, diamond-shaped structuring element R specifies the distance from the structuring element origin to the points of the diamond EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Dilation and Erosion Erosion Dilation http://homepages.inf.ed.ac.uk/rbf/HIPR2/matmorph.htm EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Opening and Closing Closing Opening EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Dilating http://homepages.inf.ed.ac.uk/rbf/HIPR2/dilate.htm Ifat least one pixel in the structuring element coincides with a foreground (i.e., “1”) pixel in the image underneath, then the input pixel is set to the foreground (1) value EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Corner is rounded off EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Grey Scale Dilation EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Erosion From http://homepages.inf.ed.ac.uk/rbf/HIPR2/erode.htm If for everypixel in the structuring element, the corresponding pixel in the image underneath is a foreground pixel, then the input pixel is left as it is. If any of the corresponding pixels in the image are background, however, the input pixel is also set to background value. EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
hole in the middle of the image increases in size EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Grey Scale Erosion EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Erosion: Separate coins before counting EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Opening From http://homepages.inf.ed.ac.uk/rbf/HIPR2/open.htm An erosion followed by a dilationusing the same structuring element for both operations. EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Opening vs. Erosion The basic effect of an opening is somewhat like erosion in that it tends to remove some of the foreground (bright) pixels from the edges of regions of foreground pixels. However it is less destructive than erosion in general. EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Opening: Separate out the circles from the lines EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Opening EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Opening: Salt Noise EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Opening: Dark Noise EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Opening: Count the Spokes using Opening EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Run the Matlab commands >> I= imread('testpat1.png'); >> imshow(I) EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Closing From http://homepages.inf.ed.ac.uk/rbf/HIPR2/close.htm Closing is opening performed in reverse. Simply as a dilation followed by an erosion EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Closing vs. Dilation Closing is similar in some ways to dilation in that it tends to enlarge the boundaries of foreground (bright) regions in an image (and shrink background color holes in such regions). But it is less destructive than dilation of the original boundary shape. EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Closing: Removing Small Holes EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Closing EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Try to erase all those lines! EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Closing: Finding Skeleton EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Closing EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Dark Noise EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Salt Noise EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Mplay and implay >>implay('rhinos.avi'); % Use implay >>mplay('rhinos.avi'); % mplay will be removed in future release EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Read and Play Video File >> videoFReader= vision.VideoFileReader('viplanedeparture.avi'); >> videoPlayer= vision.VideoPlayer; >> while ~isDone(videoFReader) videoFrame= step(videoFReader); step(videoPlayer, videoFrame); end >> release(videoPlayer); >>release(videoFReader); EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
>> I = imread('circuit.tif'); >> corners = detectFASTFeatures(I,'MinContrast',0.1); >> J = insertMarker(I,corners,'circle'); >> imshow(J); EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Edge Detection and Image Overlay EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Edge Detection and Image Overlay EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Edge Detection and Image Overlay + Pixel Stream HDL Model EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Tracking Cars Using Foreground Detection EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon
Tracking Cars Using Foreground Detection (result) EEEB0765 DSP fort Embedded Systems http://embedsigproc.wordpress.com/eeeb0765 Assoc. Prof. Dr. P.Yuvapoositanon