0
I am working on an image and I want to separate the white part (marbling) from the red part (meat), but in the image there is noise, nothing more than reflections on the image. I managed to apply some filters but I still get a lot of noise. Is there any way to remove this reflection in a better way? Follow my example:
original image
image = cv2.imread('image.jpg')
#Tratando imagem
hsv_image = cv2.cvtColor(image, cv2.COLOR_RGB2HSV)
h, s, v = cv2.split(hsv_image)
clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(10,10))
v = clahe.apply(v)
hsv_image = cv2.merge([h, s, v])
hsv_image = cv2.cvtColor(hsv_image, cv2.COLOR_HSV2RGB)
cv2.imshow("Image", hsv_image)
cv2.waitKey(0)
# Aplicando Máscara.
lower_range3=np.array([0, 0, 63])
upper_range3=np.array([255,72,255])
mask3=cv2.inRange(hsv_image, lower_range3, upper_range3)
cv2.imshow("marble_mask", mask3)
cv2.waitKey(0)
Treated image (hsv_image)
Final image (mask3)
Although the treatment seems that nothing has changed, some images improve, I took a very extreme photo. If anyone has an alternative other than opencv, you are welcome.
What you need is not the reverse of this last image?
– Danizavtz
Sorry, what would be negative? I’m actually doing so, to make a calculation based on non-zero pixels. But the reflection is entering the calculation. I do not know if I was clear.
– Curious G.
I corrected, I meant reverse. Would you take the last image and reverse what is zero to value one, and vice versa.
– Danizavtz
Exactly that, but the problem is the noise. It does not differentiate marbling and reflection. I would like to apply a filter to remove this reflection.
– Curious G.
Have you tried the frequency filters?
– FourZeroFive
@Fourzerofive what is this approach?
– Curious G.
Filter is basically to use an array and convolution it into the image, applying the values of the matrix to each step on each pixel. http://www.songho.ca/dsp/index.html
– FourZeroFive