相关疑难解决方法(0)

OpenCV 2 Centroid

我试图找到轮廓的质心,但在C++(OpenCV 2.3.1)中实现示例代码时遇到了问题.谁能帮我吗?

c++ opencv image-processing centroid

10
推荐指数
2
解决办法
3万
查看次数

c中opencv中轮廓/对象的质心?

是否有一些好的和更好的方法来找到opencv中的轮廓质心,而不使用内置函数?

opencv image-processing visual-c++

4
推荐指数
2
解决办法
1万
查看次数

ZeroDivisionError(Python)

我的某些图像出现了零分割错误(即使其中许多图像都可以正常工作):

这是代码:

image = skimage.io.imread('test.png', False)
image_gray = skimage.io.imread('test.png', True)
blurred = cv2.GaussianBlur(img_as_ubyte(image_gray), (5, 5), 0)
thresh = threshold_li(blurred)
binary = blurred > thresh
binary_cv2 = img_as_ubyte(binary)

# find contours in the thresholded image
cnts = cv2.findContours(binary_cv2.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
cnts = cnts[0] if imutils.is_cv2() else cnts[1]

# loop over the contours
for c in cnts:
    # compute the center of the contour
    M = cv2.moments(c)
    cX = int(M["m10"] / M["m00"])
    cY = int(M["m01"] / M["m00"])

    # draw the contour and …
Run Code Online (Sandbox Code Playgroud)

python opencv scikit-image

2
推荐指数
2
解决办法
6873
查看次数