Is there a way to automatically extract a region in an image
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Image Analyst
2014-7-27
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 个评论
Image Analyst
2014-8-18
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.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!