为什么 cv.findChessboardCorners 对我不起作用? [英] Why won't cv.findChessboardCorners work for me?

查看:55
本文介绍了为什么 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天全站免登陆