assigning value to image
4 views (last 30 days)
Show older comments
how can i assign value to image ? for example i have image ('apple') and image ('banana') I want to give ('apple') value = 5 and I want to give ('banana') value = 8 then compare between these two image and choose the max value so how can i do it in matlab
0 Comments
Answers (2)
Stephen23
on 1 Mar 2015
Edited: Stephen23
on 1 Mar 2015
Presumably you have more than two images, in which case using a structure might be the best solution:
A.apple = 5
A.banana = 8
A.coconut = 3
You can then refer get the maximum value of any elements that you want to:
max([A.apple, A.banana])
A.('banana')
is the same thing as
A.banana
0 Comments
Image Analyst
on 1 Mar 2015
You need to develop an image classification algorithm to determine what's in the image. For example, just look at the dominant color and decide if it's an image of an apple or a banana. Then return the classification. Make a function for that, in pseudocode:
function theClass = ClassifyImage(rgbImage)
if main color = red
theClass = 5
else if main color = yellow
theClass = 8
end
and so on. Then you can do the comparison you want with the values. I have several color classification tutorials in my File Exchange: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
0 Comments
See Also
Categories
Find more on Image Data Workflows 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!