Recognition of colored percentage of a white paper using Image Processing

Hello,
I want to estimate the percentage of the following image (see attachment), where there are different colors and intensity. There is also an annoing shadow in the upper part of the image.
I already tryed to compute the gray scale and set simply a threshold (-->binary image), but this method is not enougth robust and leads wrong results and a partial recognition of the painted stain (eg only the black and green spot).
How can I get a better estimation of such colored % of the image surface (without differentiate between colors)?
At a glance, I think that the answer could be about 25%, but I want to find the exact answer using MATLAB.
Thank you and best regards, A
Edit:
  1. I just added a version without shadows (see right image) for start with a simplier case.
  2. Does it can help to have a picture of a white paper as "reference image" without colors in order to compare it with the colored image?
With shadow Without shadow

6 Kommentare

How do you define COLOR? I expect mathmatical answer? Also, the rest of the image is not True white (perception).
Alberto Mora
Alberto Mora am 18 Nov. 2020
Bearbeitet: Alberto Mora am 18 Nov. 2020
Hard to say, otherwise I would have already answered...
Thats the reason why I am asking help to more expert users.
Anyhow, I want to recognize the "green", "yellow", "black" lines (most mathematical answer that I can provide you, I'm sorry). I think that you catch the point.
I know that the white is not perfect white. If this is really a big problem, I can perform a better image (my idea was to have a reliable code able to deal with some shadows, but I can accept some limitations). Please tell me if I need to remove the shadows from the white paper in order to get a TRUE white.
This is certainly possible in this specific case, but generalization may not be easy. Once I get free time I will try to provide code on specific image (image attached)
Thank you. I just added a version without shadows for start with a simplier case.
Alberto Mora
Alberto Mora am 19 Nov. 2020
Bearbeitet: Alberto Mora am 19 Nov. 2020
I had an idea for a further development: does can help if I add a picture of a "white" paper as reference image for find the differences between the "colored" image (without shadows) and the "white" reference image (without shadows)?
Small update, I notice that applying a thresholding method on
stdfilt(image_grayScale)
could an interesting solution to divide the background from the colored region (i.e. amplify the difference between background and colored region). It seems working without problems also for shadows image. I will update if there are further improvments.
I check this interesing link, but in this case the usage of simple thresholding on the raw lead to poor results.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

cr
cr am 18 Nov. 2020
You can even out the light intensity across the image using imtophat(). Then use segmentation and/or ROI based processing functions -like roicolor(), activecontour, bfscore, etc. Shouldn't be hard.

Kategorien

Produkte

Version

R2020a

Gefragt:

am 18 Nov. 2020

Bearbeitet:

am 20 Nov. 2020

Community Treasure Hunt

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

Start Hunting!

Translated by