为什么cv.findChessboardCorners不适合我? [英] Why won't cv.findChessboardCorners work for me?

查看:781
本文介绍了为什么cv.findChessboardCorners不适合我?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下图片传递给cv.findChessboardCorners,由于我无法理解的原因,它只是没有给我角落位置。棋盘非常明显,白线厚度也非常突出。

The following image is passed on to cv.findChessboardCorners and for reasons I can't understand, it just does not give me the corner locations. The chessboard is quite evident and the white line thickness is quite prominent too.

你知道为什么这不起作用吗?

Do you know why this won't work?

图像尺寸是960X1280,网眼尺寸是[15,11]即每行15个内角和每列11个内角。

The image size is 960X1280 and the mesh size is [15,11] i.e 15 internal corners per row and 11 internal corners per column.

输出始终为空矩阵。我尝试更改参数和使用直方图均衡的函数,所以我假设像素分布不会有问题。

The output is always an empty matrix. I tried changing the parameters and the function used histogram equalization so I'm assuming the pixel distribution won't be a problem.

推荐答案

我希望你不介意Python中的答案,而不是matlab。 (他们使用相同的openCV库,我希望命令之间的对应关系清晰。)

I hope that you don't mind an answer in Python, as opposed to matlab. (They use the same openCV library and I hope the correspondence between commands is clear.)

你的图像不变对我来说很好用,下面的代码可以找到角落和显示它们在窗口中带有彩色点:

Your image unchanged works fine for me with the code below which finds the corners and displays them with colored points in a window:

#!/usr/bin/python
import cv2.cv as cv
import sys

filename = sys.argv[1]
im = cv.LoadImage(filename, cv.CV_LOAD_IMAGE_GRAYSCALE)
im3 = cv.LoadImage(filename, cv.CV_LOAD_IMAGE_COLOR)
chessboard_dim = (15, 11)
found_all, corners = cv.FindChessboardCorners( im, chessboard_dim )
cv.DrawChessboardCorners( im3, chessboard_dim, corners, found_all )
cv.ShowImage("Chessboard with corners", im3)
cv.WaitKey()

输出图像(略微裁剪)看起来像:

The output image (slightly cropped) looks like:

这篇关于为什么cv.findChessboardCorners不适合我?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆