Is there a way to automatically extract a region in an image
1 view (last 30 days)
Show older comments
Eric Raza
on 27 Jul 2014
Commented: Image Analyst
on 18 Aug 2014
I asked before regarding color detection (and got an answer that helped me out very much), but what I want to know now is if there's a way for matlab for the following scenario:
I have a webcam getting live feed. Upon seeing an object of a certain color -for instance blue-, the camera captures an image (or several) then focuses on a region of interest (around the blue object).
0 Comments
Accepted Answer
Image Analyst
on 27 Jul 2014
Yes, in a loop, just call getsnapshot() to grab a color image frame, then use your color segmentation routine on each frame.
To have the camera focus on the region of interest like you requested, you'll need to have a camera where you can control the focus. I know that not all cameras can do this. You might need a computer controlled lens. There are such lenses that work with c-mount lens adapters but they're probably expensive.
If the blue region moves around and you want to follow it , then you'll also have to get some hardware to aim your camera via computer control. You'll have to find the center of your blue region and then send the correct signal to the camera aim controller to aim the camera so that the blue region is at the center (or wherever you want it to be).
4 Comments
Image Analyst
on 18 Aug 2014
It's good if all the components are in the same range. For example if you had data on weight and number of legs and wanted to distinguish between ants and elephants, the weights go from milligrams to thousands of kilograms while the number of legs is in the 4-6 range. So you'd want to scale each measurement so that they are in roughly the same range, for example a 0-1 range, before asking PCA to do its thing. The usual formula for normalization is
normalizedData = (data-minOfData)/(maxOfData - minOfData);
For a grayscale image you can do that with the mat2gray() function.
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!