What function replaced vision.Geo​metricTran​sformEstim​ator

19 views (last 30 days)
I am currently attempting to use some demo code that was written a few years ago. The demo was to visualize SURF features in video data. I am using it for an object detection project. I keep getting an error: Unable to resolve the name vision.GeometricTransformEstimator. Is there a function that replaced this one?
Thank you for taking the time to look at the code and help me.
code snippet:
%% Define Geometric Transformation Objects
gte = vision.GeometricTransformEstimator;
gte.Method = 'Random Sample Consensus (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,:);
full code:
%% Copyright 2011-2013 The MathWorks, Inc.
% This is a simple demo to visualize SURF features of the video data.
%
% Original version created by Takuya Otani
% Senior Application Engineer, MathWorks, Japan
%
clear all; close all; clc;
%% Load reference image, and compute surf features
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);
figure; imshow(ref_img);
hold on; plot(ref_pts.selectStrongest(50));
%% Visual 25 SURF features
figure;
subplot(5,5,3); title('First 25 Features');
for i=1:25
scale = ref_pts(i).Scale;
image = imcrop(ref_img,[ref_pts(i).Location-10*scale 20*scale 20*scale]);
subplot(5,5,i);
imshow(image);
hold on;
rectangle('Position',[5*scale 5*scale 10*scale 10*scale],'Curvature',1,'EdgeColor','g');
end
%% Compare to video frame
image = imread('MWsample_full.png');
I = rgb2gray(image);
% Detect features
I_pts = detectSURFFeatures(I);
[I_features, I_validPts] = extractFeatures(I, I_pts);
figure;imshow(image);
hold on; plot(I_pts.selectStrongest(50));
%% Compare card image to video frame
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;
figure, showMatchedFeatures(image, ref_img, I_matched_pts, ref_matched_pts, 'montage');
title('Showing all matches');
%% Define Geometric Transformation Objects
gte = vision.GeometricTransformEstimator;
gte.Method = 'Random Sample Consensus (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,:);
% Draw the lines to matched points
figure;showMatchedFeatures(image, ref_img, I_inlier_pts, ref_inlier_pts, 'montage');
title('Showing match only with Inliers');
%% Transform the corner points
% This will show where the object is located in the image
tform = maketform('affine',double(tform_matrix));
[width, height,~] = size(ref_img);
corners = [0,0;height,0;height,width;0,width];
new_corners = tformfwd(tform, corners(:,1),corners(:,2));
figure;imshow(image);
patch(new_corners(:,1),new_corners(:,2),[0 1 0],'FaceAlpha',0.5);
  1 Comment
nadji hadroug
nadji hadroug on 4 Oct 2020
Hiii.
Dear AARON HILTON
you can just change the MATLAB version to version MATLAB R2015a/b
and your full codeis working exactly
.............................................
or you can tchek the toolbox of MATLAB R2015a and copy 'Define Geometric Transformation Objects.mdl'
to your version MATLAB..... as you like.
Good luck

Sign in to comment.

Answers (2)

Srivardhan Gadila
Srivardhan Gadila on 1 May 2020
Starting MATLAB R2016a release when you use the System object vision.GeometricTransformEstimator, MATLAB® issues a warning. Replace the use of the System object with it's corresponding function fitgeotrans
Refer to the following links:
  1. Computer Vision Toolbox Release Notes
  2. fitgeotrans
  3. "vision.GeometricTransformer" Object

Dariusz Maton
Dariusz Maton on 4 Apr 2022
Edited: Dariusz Maton on 4 Apr 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!