Search code examples
pythonopencvcontouredge-detection

Increase the degree of a specific color range in an image for object detection


I have a number of lobster images as shown in the photo. My goal is to identify the edge between the carapace and the body and its coordinates. However, it seems like the methods of finding contours based on HSV thresholds or Canny edge detection output didn't work well when I applied to these images.

My idea is to find a way to 'amplify' the color difference between two areas of an image to make it easier for finding mask/contours based on color threshold?

For example, if I can make the yellow of the edge in the image stronger, then I can easily find the mask of this area using color threshold, can we do that?

Thanks.enter image description here


Solution

  • This color is closer to the rest of the picture than one think (in the HLS space).

    IMO, the best way to enhance it is by means of the Euclidean distance to that particular orange in RGB space.

    For instance, the pixels at distance 32√3:

    enter image description here