single-shot-pro-cam-calib icon indicating copy to clipboard operation
single-shot-pro-cam-calib copied to clipboard

error use cv.findHomography

Open fare129 opened this issue 11 months ago • 8 comments

Hi Huang, now that I've run into this problem, can you please give some advice? I am using matlab2021a+mexopencv-3.4.1. Detail: 错误使用 cv.findHomography MEX �ļ���������ı�׼�쳣�� What() ��: OpenCV(3.4.1) D:\dev\opencv\modules\calib3d\src\fundam.cpp:372: error: (-5) The input arrays should be 2D or 3D point sets in function cv::findHomography

��.

出错 Calibration.getNodesAndPrjCorners>findMatchAndWarp (第 83 行) [Hcp, inliers] = cv.findHomography(camNodesUndistort, prjNodes, ...

出错 Calibration.getNodesAndPrjCorners (第 47 行) [prjCorners(:,:,i), nodePairs{i}] = findMatchAndWarp(imLightNames{i}, ...

出错 calibrateGUI (第 93 行) [nodesCell, ~] = Calibration.getNodesAndPrjCorners(calibInfo, camParams, camCorners, verbose, useParallel);

出错 calibApp/CalibrateButtonPushed (第 868 行) calibrateGUI(app); % call calibration function

错误使用 matlab.ui.control.internal.controller.ComponentController/executeUserCallback (第 410 行) 计算 Button PrivateButtonPushedFcn 时出错。

fare129 avatar Mar 02 '24 13:03 fare129

These are the photos I took. colorGrid01 colorGrid02 colorGrid03 colorGrid04 colorGrid05 lightGrid01 lightGrid02 lightGrid03 lightGrid04 lightGrid05

fare129 avatar Mar 02 '24 13:03 fare129

Can you check whether any of input to cv.findHomography is empty?

BingyaoHuang avatar Mar 04 '24 08:03 BingyaoHuang

yes, it is empty, and when I use your data, the program works fine, but the data I collect myself reports an error. Can you tell me if it is because the background of the picture taken has an effect? A pure white background is needed is it?

fare129 avatar Mar 04 '24 08:03 fare129

Because when I reshot with a different background, there had a new problem: 索引中的冒号运算符的非有限端点或增量。

出错 ImgProc.segColorGrid (第 129 行) imBWCb(y-winSize:y+winSize,x-winSize:x+winSize) = 1;

出错 ImgProc.getMatchedNodes (第 28 行) [imBWGrid, imColorGridMasked] = ImgProc.segColorGrid(whiteLight, colorGrid, camCorners, verbose);

出错 Calibration.getNodesAndPrjCorners>findMatchAndWarp (第 72 行) [camNodes, prjNodes] = ImgProc.getMatchedNodes(imLightName, imColorName, camCorners, prjW, prjH, verbose);

出错 Calibration.getNodesAndPrjCorners (第 47 行) [prjCorners(:,:,i), nodePairs{i}] = findMatchAndWarp(imLightNames{i}, ...

出错 calibrateGUI (第 93 行) [nodesCell, ~] = Calibration.getNodesAndPrjCorners(calibInfo, camParams, camCorners, verbose, useParallel);

出错 calibApp/CalibrateButtonPushed (第 868 行) calibrateGUI(app); % call calibration function

错误使用 matlab.ui.control.internal.controller.ComponentController/executeUserCallback (第 410 行) 计算 Button PrivateButtonPushedFcn 时出错。

fare129 avatar Mar 04 '24 09:03 fare129

Maybe the board segmentation did not work well on your setup. You can set break point and debug the code, see whether the intermediate results look reasonable. You can tick Verbose option in the software to enter debug mode.

BingyaoHuang avatar Mar 04 '24 09:03 BingyaoHuang

Yes, it will report an error on the segmentation part, does this look like it means that the background should be as whiteboard background as possible, as much as possible as in your case? 1709543917768

fare129 avatar Mar 04 '24 09:03 fare129

Here's a photo captured from my second experiment.I don't think the interference should count for much anymore, but it's still a mistake in the segmentation. colorGrid01 lightGrid01

fare129 avatar Mar 04 '24 09:03 fare129

Yes, it will report an error on the segmentation part, does this look like it means that the background should be as whiteboard background as possible, as much as possible as in your case? 1709543917768

The checkerboard region should be all black. You can check the segmentation results of my data, and compare it with yours.

BingyaoHuang avatar Mar 04 '24 10:03 BingyaoHuang