With the removal reflection of a red image (opencv)

Asked

Viewed 34 times

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

inserir a descrição da imagem aqui

    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)

inserir a descrição da imagem aqui

Final image (mask3)

inserir a descrição da imagem aqui

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.

  • 1

    What you need is not the reverse of this last image?

  • 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.

  • I corrected, I meant reverse. Would you take the last image and reverse what is zero to value one, and vice versa.

  • 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.

  • 1

    Have you tried the frequency filters?

  • @Fourzerofive what is this approach?

  • 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

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.