image analysis of specified area in the image

1 次查看(过去 30 天)
Hallo everyone,
I have a question about image analysis. I have this following picture.
I only would like to know the specified part(the part surrounded by the green line) which i want to investigate.
Picture size is 64*48.
How i could know that part position and take all that matrix value from that area out?
Thanks so much in advance
JL

采纳的回答

Image Analyst
Image Analyst 2022-6-22
That picture has more resolution than 64x48.
To get a mask for the green encircled regions in your starting image, you can do
[rows, columns, numberOfColorChannels] = size(rgbImage)
[r, g, b] = imsplit(rgbImage);
greenMask = r == 0 & g == 255 & b == 0;
% Fill to make solid
greenMask = imfill(greenMask, 'holes');
% Get mean values inside mask
meanR = mean(r(greenMask))
meanG = mean(g(greenMask))
meanB = mean(b(greenMask))
% Get mean values outside mask
meanRout = mean(r(~greenMask))
meanGout = mean(g(~greenMask))
meanBout = mean(b(~greenMask))
We don't know what to do next because what you said you want to do is so vague. Like exactly what does " take all that matrix value from that area out" mean? Do you want to crop the bounding box out to a new image? Do you want the mean R, G, and B in the regions? Do you want to mask the original image, blackening inside the green outlines? Do you want to measure areas or perimeters? Something else? I have no idea.
Please read
and clarify your request.
  1 个评论
Jialin Men
Jialin Men 2022-6-22
Thanks so much for your reply.
Matrix value that i use is not RGB value. I did EDX analysis, get values from it, and the values form is also 64*48.
As you see, similar like this picture. i just want to get all the values which inside of the red lines. therefore i need to know its positions(x,y) and then i could take values from it.

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by