How to extract feature from multiple image?
4 views (last 30 days)
Show older comments
Farhan Abdul Wahab
on 23 Dec 2016
Commented: Image Analyst
on 24 Dec 2016
The aim of the outcome; which to display the result is similar to this:
but instead I would like to fetch the feature from other images, where only one object inside each image.
1. Read image from file - successful
2. Convert RGB to gray - successful
3. Convert Gray to Binary - successful
4. Extract the feature for each image - failed. - It supposed to return Area for each 10 images, somehow it only return 1 value.
2 Comments
KSSV
on 23 Dec 2016
Post your code, so that we can check and find out why you are getting only one return value.
Accepted Answer
Image Analyst
on 23 Dec 2016
Edited: Image Analyst
on 24 Dec 2016
It looks like there are two problem. You are using the loop index "i" inside another, outer loop, which also has the same loop index. Not a wise choice. And it looks like the outer i, which should be renamed to something like imageNumber is the image number but your areas are just for the current image. So put all the areas into a cell. It needs to be a cell because different areas can have different numbers of regions.
theArea{imageNumber} = [Measurements.Area]
By the way, in the MATLAB editor, type control-a control-i to fix up your indenting before you paste it here. It will make your code easier to follow.
2 Comments
Image Analyst
on 24 Dec 2016
Because the number of areas might vary from image to image, use a cell array and braces:
theArea{imageNumber} = [Measurements.Area]
If you're going to have one blob always, like if you use bwareafilt(binaryImage, 1), then you can use a simple numerical array with parentheses:
theArea(imageNumber) = Measurements.Area;
More Answers (0)
See Also
Categories
Find more on Convert Image Type in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!