Erase color outside of region of interest in image

2 次查看(过去 30 天)
I have a template image that has the outline of a human body, front and back. An individual colors in areas of interest on this template sheet, but a lot of the times they color outside of the body border, I only am interested in analyzing the data that is colored inside of the body border. Does anyone know a way I can erase or ignore the parts colored in outside the body on the template sheet?

回答(1 个)

Walter Roberson
Walter Roberson 2018-6-1
Presuming that mask is a 2D logical array the same number of rows and columns as your original color image, then:
masked_image = RGBImage .* repmat(mask, [1 1 3]);
The masked image would have 0 in the places to be ignored.
  2 个评论
Samantha Wallace
Samantha Wallace 2018-6-1
The image that is colored on using an iPad just a paper with two body outlines(front and back) with a white background and some words. Then a new image is made once they color on the original image. I haven't been able to get the method you mentioned above work for my application.
Walter Roberson
Walter Roberson 2018-6-1
As you have control over the template, it sounds to me as if it would be easy for you to create an additional array which was true for each location in the body outlines and false elsewhere including the white background and the words. If you call that array "mask", and if the image to be processed is the same size then my code applies.
More difficult would be a case where you are taking a picture of what they draw and processing the picture. In such a situation it is likely that the picture would not be exactly aligned with the template and the focal distance is unlikely to be exactly fixed so the resolution would probably not exactly match the template. If we also assume that the outline might be covered over by the colouring, then extracting the inside of the outline might require some kind of image registration or cross-correlation or something like that. If the person colored completely over the edges of the template then the problem could get more difficult.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Feature Detection and Extraction 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by