Using vision.GeometricTransformer on a webcam video stream
9 views (last 30 days)
Show older comments
Hello,
I'm working on a stereo vision project using two webcams. I take two still images and rectify them using the standard method as described by the help documentation.
The final step in the rectification processes uses the vision.GeometricTransformer to transform and crop the two images as described by their transformation matrices.
I'd like to use this same function on the live video stream, so that the user may aim in 3D. However, I get the error:
Error using vision.GeometricTransformer/step Inputs must be either numeric or logical variables or fi objects.
My code is as follows:
function GetImage
%Load camera settings and transformation matrices
camcal = load('files/camcal.mat');
recmat = load('files/recmat.mat');
%Activate camera
vidL = videoinput('winvideo', camcal.selectLv, 'YUY2_1920x1080',...
'ReturnedColorSpace', 'rgb');
%Make transformer
htrans = vision.GeometricTransformer(...
'TransformMatrixSource', 'Input port', ...
'OutputImagePositionSource', 'Property', ...
'OutputImagePosition', recmat.bbox);
%Perform transformation
vidLt = step(htrans, vidL, recmat.grayl);
%Show result
preview(vidLt);
I produced the same using Simulink, using all the same matrix values, and it works fine. Which makes me think it should be able to work in Matlab.
Any ideas?
Thanks.
0 Comments
Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!