错误的代码
6视图(30天)
显示旧的评论
嗨,你能给我纠正我的错误
这是我的代码:
boxPoints = imread (“C: \ \ ima1.bmp图像”);
图;
imshow (boxPoints);
标题(一个盒子的图片);
sceneImage = imread (“C: \ \ im1.jpg图像”);
图;
imshow (sceneImage);
标题(“一个混乱的场景的图像”);
boxPoints = detectSURFFeatures (boxPoints);
scenePoints = detectSURFFeatures (sceneImage);
图;
imshow (boxImage);
标题(100年从盒子里最强的特征点图像);
持有在;
情节(selectStrongest (boxPoints, 100));
图;
imshow (sceneImage);
标题(300年最强的从场景图像特征点);
持有在;
情节(selectStrongest (scenePoints, 300));
[boxFeatures, boxPoints] = extractFeatures (boxImage boxPoints);
[sceneFeatures, scenePoints] = extractFeatures (sceneImage scenePoints);
boxPairs = matchFeatures (boxFeatures sceneFeatures);
matchedBoxPoints = boxPoints (boxPairs (: 1):);
matchedScenePoints = scenePoints (boxPairs (:, 2):);
图;
showMatchedFeatures (boxImage sceneImage matchedBoxPoints,…
matchedScenePoints,“蒙太奇”);
标题(“推定地匹配点(包括异常值)”);
[tform, inlierBoxPoints inlierScenePoints] =…
estimateGeometricTransform (matchedBoxPoints matchedScenePoints,仿射的);
图;
showMatchedFeatures (boxImage sceneImage inlierBoxPoints,…
inlierScenePoints,“蒙太奇”);
标题(“匹配点(仅内围层)”);
boxPolygon = [1,1;…%左上的
尺寸(boxImage, 2), 1;…%右上的
大小(boxImage, 2),大小(boxImage, 1);…%右下角
1、大小(boxImage, 1);…%左下侧
1,1];%左上的再次关闭多边形
newBoxPolygon = transformPointsForward (tform boxPolygon);
图;
imshow (sceneImage);
持有在;
线(newBoxPolygon (: 1), newBoxPolygon (:, 2),“颜色”,“y”);
标题(“检测盒”);
这是错误:
错误在detectSURFFeatures(第81行)
checkImage(我);
错误在Untitled2(1号线)
boxPoints = detectSURFFeatures (boxImage);
答案(3)
图像分析
2016年3月16日
boxImage应该是灰度或二进制。你刚读它从一个BMP图像可能是颜色。试试这个,看看它修复:
%得到图像的尺寸。
% numberOfColorBands应该= 1。
(行、列,numberOfColorChannels) = (boxImage)大小;
如果numberOfColorChannels > 1
%这不是灰度像我们预期的颜色。
%将它转换成灰度只通过绿色通道。
boxImage = boxImage (:: 2);%绿色通道。
结束
3评论
清洁能源
2016年3月17日
编辑:清洁能源
2016年3月17日
嗯……它看起来像你的输入是正确的。但什么样的形象你在读什么?这些都是接受输入的类
extractFeatures(我点)
当你调用它:
%类支持金宝app
% - - - - - - - - - - - - -
%我可以逻辑的输入图像,uint8, uint16 int16,单身,或
%的两倍,它必须是真实的和nonsparse。点可以是一个SURFPoints,
% MSERRegions、cornerPoints或BRISKPoints对象,或int16 uint16,
% int32, uint32,单引号或双。
你用的也点?detectSURFFeatures如上你正在使用它的输出应该是很好,但也许你改变了什么吗?