How cool is that if we use a very cheap camera as a sensor...instead of using IR sensor or Ultrasonic to detect the objects. Because our camera can detect the object as well as can recognize the objects.
Example: write this code in MATLAB and put the red color object in front of camera. the camera will detect the red color only and change in into white. This code is very efficient. In this code i am using image processing for detecting the red color from the live frames using a simple external camera.
Explanation:
To learn image processing , first we have to understand everything related to an image. so in technical words"Image is a collection of pixels and each pixel is having some numeric value. so together combining all the pixels ...we'll get a image " .
In short image is a 2 dimensional array of pixels . To process an image or i say to operate an image....we need some software tool...so here comes the part of MATLAB.
To read an image ..we use command 'imread'
There are usually three types of images:
First i am converting ycbcr format of my camera to rgb
and as we know color image is a mixture of 3 layers R,G,B
so i am subtracting only the red layer of original image from the grayscale of d same
a(:,:,1) is a red component and its a grayscale image
and when we subtract the grayscale a(:,:,1) from the gray scale we get the output image in gray scale...in which red pixels are highlighted.... so change dat image in black and white with proper threshold .... so we will get the final image as the black and white in which red pixels turned in white and rest background in black.
- color image
- grayscale image or intensity image
- black n white or logical image
First i am converting ycbcr format of my camera to rgb
and as we know color image is a mixture of 3 layers R,G,B
so i am subtracting only the red layer of original image from the grayscale of d same
a(:,:,1) is a red component and its a grayscale image
and when we subtract the grayscale a(:,:,1) from the gray scale we get the output image in gray scale...in which red pixels are highlighted.... so change dat image in black and white with proper threshold .... so we will get the final image as the black and white in which red pixels turned in white and rest background in black.
Click here to get the script file for MATLAB program.
If you found this tutorial helpful, feel free to share it. It really means a lot to me!
If you found this tutorial helpful, feel free to share it. It really means a lot to me!
No comments:
Post a Comment