image analysis of specified area in the image

5 views (last 30 days)
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

Accepted Answer

Image Analyst
Image Analyst on 22 Jun 2022
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 Comment
JM
JM on 22 Jun 2022
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.

Sign in to comment.

More Answers (0)

Categories

Find more on Images in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!