how to get region of interest and calculate the hit rate and precision rate?

2 views (last 30 days)
How to draw out the total object pixel of interest region in an image?
I want calculate the hit rate= correct pixel deteced/total object pixel
precision= correct pixel detect/total detected pixel
elephant is my original image and result is my segmentation which is very bad. I now want to calculate the hit rate and precision rate. How to do it?
How to superimpose(transparent) the result to elephant ?

Accepted Answer

Image Analyst
Image Analyst on 9 Dec 2015
Calculate the area of the elephant from the outline you traced around it using poly2mask, then sum.
elephantMask = poly2mask(x, y, rows, columns);
elephantArea = sum(elephantMask(:));
Then calculate the area of overlap between your segmentation and the true area
numSegmentationPixels = sum(segmentationMask(:))
overlapPixels = elephantMask & segmentationMask;
numOverlapPixels = sum(overlapPixels(:))
Then use your formula for precison:
precision = numOverlapPixels / numSegmentationPixels;
  4 Comments
Tan Wen Kun
Tan Wen Kun on 9 Dec 2015
Edited: Tan Wen Kun on 9 Dec 2015
what is different between drawing and masking? I got the original image and result image. How I going to do?
Draw on original then mask on result?
Can you show me by the image I given?
Image Analyst
Image Analyst on 9 Dec 2015
Drawing is just tracing the curve by hand over the image. It will give you the coordinates that you drew. Masking takes that one step further. It uses those coordinates and then creates a binary image that's true inside the curve and false outside. You can then use that binary image to set the inside or outside of the mask in the original image to any intensity or color you want, such as black or white or unchanged. The demos already demonstrate what you are asking for I believe.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!