-
Notifications
You must be signed in to change notification settings - Fork 0
Resolving skimage problems
Following on from my discussion on skimage's edge filters here, the results obtained were outstanding. All bar one filter, Prewitt, had returned very clean edges for all the cleaned image. However, upon further implementation with Robert's work, there were a few issues with using the 2D array returned from the edge filters. Using this returned array as part of the find contours method, Robert and I found the following error:
error: OpenCV(3.4.3) C:\projects\opencv-python\opencv\modules\imgproc\src\contours.cpp:199: error: (-210:Unsupported format or combination of formats) [Start]FindContours supports only CV_8UC1 images when mode != CV_RETR_FLOODFILL otherwise supports CV_32SC1 images only in function 'cvStartFindContours_Impl
In order to fix this error, the image array needs to be converted from float64 to uint8. In order to do so, the code below casts the array to uint8.
sobelEdges = 255 * data # Now scale by 255
sobelEdges = sobelEdges.astype(np.uint8) # cast image to 8 bitThe resulting image is then use part of a mask, as per the code below:
# Here we create empty mask, then a draw filled polygon shape around it relative to the largest contour
# Mask is black, polygon is white
mask = np.zeros(edgeNoiseyCar.shape)
cv2.fillConvexPoly(mask, max_contour[0], (255))The resulting mask from the sample images, doesn't provide as clean as an edge.
Here we see that great edge detection as seen inn my previous post here.
But then after the dtype casting, finding contours, then applying polyFill mask, we can a messy output. Not usable for background extraction.
Further work is definitely needed. These results will be shared during the next team meeting, and the next step forward will be decided upon as a team.


