I don't know how to convert imwarp function in matlab to simulink models(variable size matrix & output type problem)

1 visualizzazione (ultimi 30 giorni)
HI, there.
I have a question regarding MATLAB function to Simulink. if you guys give me small tips, then i really thankful to you.
Now, i'm going to convert matlab function (imwarp) to simulink and i'm using matlab function blocks.
In that fuction block, i have to write codes in MATLAB.
.
.
my code is here,
function dst_img = warp(src_img)
% moving point
Pimg = [1, 1 ;
640,1 ;
266,330;
396,330];
% moving point
Pworld = [1, 1 ;
640,1 ;
1, 330;
640,330];
Tform = fitgeotrans(Pimg, Pworld, 'projective'); % fitgeotrans(movingpoints, fixedpoints, transform type
dst_img = double(imwarp(src_img,Tform));
.
.
.
It's quite simple and it works well in matlab command window.
but if i stitch this function in 'Matlab function block' in simulink,
They give me some error as follow
.
.
I heard that simulink is based on 'C' language
Every simulink block need to be fixed before start simulation.
I already know the size of output images (in matlab)
so I added some initializing part on the top of the code after function dst_img = warp(src_img)
.
dst_img = double(zeros(332, 3165, 3));
.
even I add some part to let them know the size of output, the same error also comes to me
what should I do to finish my work (converting imwarp matlab function to simulink block) ??
.
.
and also i wonder about 'imwarp' function in image processing toolbox.
Is it possible to know the output size before operating impwarp function??
from now, I get the output size of imwarp manually in MATLAB command windows by running 'imwarp' function
.
.
if you have similar experience with me, and if you overcome these tough time,
if you don't mind, plz let me know the way.
.
Thank you for your reading.
I'll wait your answer.
bye
.
.
.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by