什么功能取代了视觉?GeometricTransformEstimator

37次浏览(最近30天)
亚伦·希尔顿
亚伦·希尔顿 2020年4月28日
我目前正在尝试使用一些几年前编写的演示代码。演示是为了在视频数据中可视化SURF功能。我使用它为一个对象检测项目。我总是得到 错误:无法解析名称视觉。GeometricTransformEstimator .有替代这个的函数吗?
感谢您花时间查看代码并帮助我。
代码片段:
定义几何变换对象
一种= vision.GeometricTransformEstimator;
一种。方法=“随机抽样共识(RANSAC)”
[tform_matrix, inlierIdx] = step(gte, ref_matched_pts, I_matched_pts);
ref_inlier_pts = ref_matched_pts (inlierIdx:);
I_inlier_pts = I_matched_pts (inlierIdx:);
完整的代码:
版权所有2011-2013 The MathWorks, Inc.
%这是一个简单的演示,可视化的SURF功能的视频数据。
%由大谷拓哉创建的原始版本
%日本MathWorks高级应用工程师
清晰的所有;关闭所有;clc;
%%加载参考图像,并计算冲浪特征
ref_img = imread (“MWqueen_crop_small.bmp”);
ref_img_gray = rgb2gray (ref_img);
ref_pts = detectSURFFeatures (ref_img_gray);
[ref_features, ref_validPts] = extractFeatures(ref_img_gray, ref_pts);
图;imshow (ref_img);
持有;情节(ref_pts.selectStrongest (50));
%% Visual 25 SURF功能
图;
次要情节(5、5、3);标题(“前25的特性”);
i = 1:25
规模= ref_pts .Scale;
形象= imcrop (ref_img [ref_pts(我)。Location-10规模*规模20 * 20 *规模);
次要情节(5 5我);
imshow(图片);
持有
矩形(“位置”,[5*刻度5*刻度10*刻度10*刻度],“弯曲”, 1“EdgeColor”‘g’);
结束
%%与视频帧比较
形象= imread (“MWsample_full.png”);
I = rgb2gray(图片);
%检测功能
I_pts = detectSURFFeatures(我);
[I_features, I_validPts] = extractFeatures(I, I_pts);
图;imshow(图片);
持有;情节(I_pts.selectStrongest (50));
%%比较卡图像和视频帧
index_pairs = matchFeatures(ref_features, I_features);
ref_matched_pts = ref_validPts (index_pairs (: 1)) .Location;
I_matched_pts = I_validPts (index_pairs (:, 2) .Location;
图,showMatchedFeatures(图像,ref_img, I_matched_pts, ref_matched_pts,“蒙太奇”);
标题(显示所有匹配的);
定义几何变换对象
一种= vision.GeometricTransformEstimator;
一种。方法=“随机抽样共识(RANSAC)”
[tform_matrix, inlierIdx] = step(gte, ref_matched_pts, I_matched_pts);
ref_inlier_pts = ref_matched_pts (inlierIdx:);
I_inlier_pts = I_matched_pts (inlierIdx:);
把线画到匹配的点上
showMatchedFeatures(image, ref_img, I_inlier_pts, ref_inlier_pts,“蒙太奇”);
标题('仅使用Inliers显示匹配');
%%变换角点
%这将显示物体在图像中的位置
tform = maketform (仿射的双(tform_matrix));
[width, height,~] = size(ref_img);
角落=[0,0;高度,0;高度,宽度,0,宽度);
New_corners = tformfwd(tform, corners(:,1),corners(:,2));
图;imshow(图片);
补丁(new_corners (: 1) new_corners (:, 2), [0 1 0],“FaceAlpha”, 0.5);
1评论
nadji hadroug
nadji hadroug 4 .厨师
Hiii。
亲爱的亚伦·希尔顿
你可以把MATLAB版本改成版本 MATLAB R2015a / b
你的完整代码运行正常
.............................................
或者你可以查看MATLAB R2015a的工具箱并复制' 定义几何变换对象。mdl
到你的 MATLAB版本……作为你喜欢。
祝你好运

登录评论。

答案(1)

Srivardhan Gadila
Srivardhan Gadila 2020年5月1日
当你使用System对象时,启动MATLAB R2016a版本 愿景。GeometricTransformEstimator , MATLAB®发出警告。用System对象对应的函数替换它的使用 fitgeotrans
请参阅以下链接:
  1. 计算机视觉工具箱发布说明
  2. fitgeotrans
  3. ”的愿景。GeometricTransformer”对象

社区寻宝

在MATLAB中心找到宝藏,并发现社区如何可以帮助你!

开始狩猎!