Improving Rock Extraction Analysis in OpenCV

I've been experimenting with OpenCV and trying my hand at some image analysis with NASA images. My goal is to extract rocks from scenes from the Mars rovers. I've managed to extract a few, but the hit rate is pretty poor as seen in these pictures:

Original:

在这里输入图像描述

After Processing:

在这里输入图像描述

I have been using a Canny edge detector, finding the enclosed contours, and then filtering those by size. I have tried using some of the morphological operations like dilate and erode to help improve my hit rate, but it hasn't seemed to help.

Here is my attempt at extraction:

original_img = cv2.imread('mars_sample_image.jpg', 0)
edges = cv2.Canny(edited_img, 100, 200)
ret, thresh = cv2.threshold(edges, 127, 255, 0)
contours, hierarchy = cv2.findContours(thresh, cv2.RETR_CCOMP, cv2.CHAIN_APPROX_NONE)

enclosed_contours = []
other_contours = []
for i in range(len(contours)):
    if hierarchy[0][i][0] < 0:
        enclosed_contours.append(contours[i])
    else:
        other_contours.append(contours[i])
contours = [contour for contour in enclosed_contours if cv2.contourArea(contour) > 100]

Any suggestions to increase my hit rate would be greatly appreciated!

链接地址: http://www.djcxy.com/p/23698.html

上一篇: OpenCV:从边缘检测图像中检测字母和单词

下一篇: 改进OpenCV中的岩石提取分析