Undefined function 'findScaleTransform' for input arguments of type 'double'. How to solve it?

1 回表示 (過去 30 日間)
mohd  bin
mohd bin 2015 年 11 月 15 日
コメント済み: Dmytro 2023 年 4 月 19 日
%%Rescale replacment video frame
% Load replacment video frame
videoFrame = step(video);
% Get replacement and reference dimensions
repDims = size(videoFrame(:,:,1));
refDims = size(referenceImage);
% Find transformation that scales video frame to replacmente image size, preserving aspect ratio
scaleTransform = findScaleTransform(refDims,repDims);
outputView = imref2d(size(referenceImage));
videoFrameScaled = imwarp(videoFrame, scaleTransform, 'OutputView', outputView);
figure(1)
imshowpair(referenceImage, videoFrameScaled, 'Montage');
i got this problem at this section, when i'm doing this tutorial:
any help will be appreciated.
thank you
  3 件のコメント
dinesh92x
dinesh92x 2017 年 3 月 29 日
Oh!! I have the same problem.If any body find solution please provide me. Why "findScaleTransform" is not working.??
jingshuig
jingshuig 2018 年 12 月 14 日
HI,
I think "findScaleTransform" is a private function in the example.
I'v find a solution . May be useful.
function [scaleTransform ]= findScaleTransform(refDims,repDims)
scaleTransform=affine2d([repDims(1)/refDims(1) 0 0 ; 0 repDims(2)/refDims(2) 0 ;0 0 1]);
end
Add this function in the dir,and named "findScaleTransform.m"

サインインしてコメントする。

回答 (2 件)

S. Muhammad Hossein Mousavi
S. Muhammad Hossein Mousavi 2018 年 2 月 1 日
Please I have the same too.

jingshuig
jingshuig 2018 年 12 月 14 日
HI,
I think "findScaleTransform" is a private function in the example.
I'v find a solution . May be useful.
function [scaleTransform ]= findScaleTransform(refDims,repDims)
scaleTransform=affine2d([repDims(1)/refDims(1) 0 0 ; 0 repDims(2)/refDims(2) 0 ;0 0 1]);
end
Add this function in the dir,and named "findScaleTransform.m"
  2 件のコメント
jingshuig
jingshuig 2019 年 1 月 2 日
add some new:
% 2019 01 02
%find transform
function [scaleTransform ]= findScaleTransform(refDims,repDims)
if (repDims(1)/repDims(2) > 1) && (refDims(2)/refDims(2) > 1) % When the ratio of length to width is the same
scaleTransform=affine2d([1/(repDims(1)/refDims(1)) 0 0 ; 0 1/(repDims(2)/refDims(2)) 0 ;0 0 1]);
else % When the ratio of length to width is different
scaleTransform=affine2d([0 1/(repDims(2)/refDims(1)) 0 ; 1/(repDims(1)/refDims(2)) 0 0 ;0 0 1]);
end
end
Dmytro
Dmytro 2023 年 4 月 19 日
I think You have at least one mistake in the condition because Your (refDims(2)/refDims(2) > 1) always is false and You go to else case

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeFeature Detection and Extraction についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by