Currently, I'm working with some images and would like to calculate, for example, gray value, area of the pixel, etc. To do that I need to first detect the object from the image.
I tried:
img = cv2.imread(file_path, cv2.IMREAD_GRAYSCALE)
edged = cv2.Canny(img, lower, upper)
But it detects all the edges of the object. I only like to detect the outline of the object (like the picture below, red line).
Is there any way to detect the outline of an object?
I suggest using the GRIP software to implement an imaging processing pipeline to do this (which I have already done for you).
My image processing is as follows:
Original image:
Perform median filter blur (to smooth out edges of cat's fur)
Perform HSV Threshold on image (to create a mask that removes the white around the cat)
Apply the mask from step 2 to get the pixel values from the original cat image
Now using the image from that mask, you can calculate your grey values and pixel areas
Here is the link to download the GRIP software
Here is a link to all my files (including the auto-generated Python image processing pipeline)