1 | initial version |
I will apply a threshold on your image, with threshold function with THRESH_TOZERO parameter. All pixel with a value greter than your threshold will be set to 0. Therefore, you will have a mask to copy only the non-zero pixel. If you want to "protect" white zone in your object, try to use findContours and drawContours to draw a mask of your object. The difficult part will be the threshold setting...