我有MATLAB版本R2012b的问题。insertShape
和detectMinEigenFeatures
都是"计算机视觉系统工具箱"的功能。我已经安装了"计算机视觉系统工具箱"。以下是ver
的输出,显示了所有已安装的工具箱。
MATLAB Version: 8.0.0.783 (R2012b)
MATLAB License Number: 724504
Operating System: Microsoft Windows 7 Version 6.2 (Build 9200)
Java Version: Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode
MATLAB Version 8.0 (R2012b)
Simulink Version 8.0 (R2012b)
Bioinformatics Toolbox Version 4.2 (R2012b)
Computer Vision System Toolbox Version 5.1 (R2012b)
Curve Fitting Toolbox Version 3.3 (R2012b)
DSP System Toolbox Version 8.3 (R2012b)
Fuzzy Logic Toolbox Version 2.2.16 (R2012b)
Global Optimization Toolbox Version 3.2.2 (R2012b)
Image Processing Toolbox Version 8.1 (R2012b)
MATLAB Builder NE Version 4.1.2 (R2012b)
MATLAB Compiler Version 4.18 (R2012b)
MATLAB Report Generator Version 3.13 (R2012b)
Mapping Toolbox Version 3.6 (R2012b)
Neural Network Toolbox Version 8.0 (R2012b)
Optimization Toolbox Version 6.2.1 (R2012b)
Parallel Computing Toolbox Version 6.1 (R2012b)
Signal Processing Toolbox Version 6.18 (R2012b)
Spreadsheet Link EX Version 3.1.6 (R2012b)
Statistics Toolbox Version 8.1 (R2012b)
System Identification Toolbox Version 8.1 (R2012b)
Wavelet Toolbox
我测试的代码是:
%Create System objects for reading and displaying video and for drawing a bounding box of the object.
videoFileReader = vision.VideoFileReader('visionface.avi');
videoPlayer = vision.VideoPlayer('Position', [100, 100, 680, 520]);
%Read the first video frame, which contains the object, define the region.
objectFrame = step(videoFileReader);
objectRegion = [264, 122, 93, 93];
%As an alternative, you can use the following commands to select the object region using a mouse. The object must occupy the majority of the region.
figure; imshow(objectFrame);
objectRegion=round(getPosition(imrect))
%Show initial frame with a red bounding box.
objectImage = insertShape(objectFrame, 'Rectangle', objectRegion,'Color', 'red');
figure; imshow(objectImage); title('Yellow box shows object region');
%Detect interest points in the object region.
points = detectMinEigenFeatures(rgb2gray(objectFrame), 'ROI', objectRegion);
当我运行这段代码时,我得到这个错误:
未定义函数'insertShape'和'detectMinEigenFeatures'single'和'double'类型的输入参数
有什么问题吗?
似乎detectMinEigenFeatures
和insertShape
都是在matlab版本r2013a
中引入的。您正在运行r2012b
,这些功能在计算机视觉工具箱中还不存在。
所以如果你能升级到r2013a
,我想你的问题应该解决了。
在R2012b中有一个解决方案。你可以使用视觉。对象,该对象还实现了最小特征值角点检测算法。