Path: news.mathworks.com!not-for-mail
From: witek@mathworks.com
Newsgroups: comp.soft-sys.matlab
Subject: Re: inverse fisheye and perspective transform in simulink
Date: Wed, 1 Jul 2009 13:09:51 +0000 (UTC)
Organization: The MathWorks, Inc., Natick, MA 01760
Lines: 43
Message-ID: <h2fn6v$9ci$1@fred.mathworks.com>
References: <h2aua3$81i$1@fred.mathworks.com>
NNTP-Posting-Host: glider.dhcp.mathworks.com
X-Trace: fred.mathworks.com 1246453791 9618 144.212.109.13 (1 Jul 2009 13:09:51 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 1 Jul 2009 13:09:51 +0000 (UTC)
User-Agent: tin/1.9.2-20070201 ("Dalaruan") (UNIX) (Linux/2.6.22.8-mw017 (x86_64))
Xref: news.mathworks.com comp.soft-sys.matlab:551985


Hi Samuel,

> Can I use simulink blocks (I have the 'image and video' and 'signal processing' blockset) 
> to perform an
>inverse fisheye transform? How can this be done?

There is no block for fisheye transform in the video blockset.  You'd have to write that transform
yourself. 

> Can I use simulink blocks (I have the 'image and video' and 'signal processing' blockset) to 
> perform an inverse fisheye transform? How can this be done?

You can although for a block with complexity of a fisheye transform, I'd recommend writing it as
a C or C++ s-function. It is also possible to write it using basic 
blocks and/or EML.

> I am using the 'Projective transform block' (with mode 'quadrilateral to rectangle' and inverse 
> mapping method 'Exact Solution' - I understand that this equates to a reverse mapping method) to perform a perspective transform. From the help file it seems like the input pixel coordinates are being calculated new each time (??). 

That's correct, the mapping is not stored.  Storage of the mapping per pixel would require a sizable 
amount of memory. If you are planning to go to a DSP, this approach would potentially create an
issue in terms of memory resources. BTW.  Have a look at Estimate Geometric Transform and Apply 
Geometric Transform blocks.  The Apply Geo Tform block takes a transformation matrix instead of 
a set of points and it is also suitable for performing projective transformation. 

> Is it possible to specify that a look-up table method should be used, afterall isn't this how the
> image processing toolbox function 'imtransform' works (I've tried using this these functions 
> with embedded Matlab but simulink does not support them)?

That is how the image processing function works although it's designed for a PC.  Besides, every time
you invoke the image processing toolbox function, it also recomputes that mapping so you end up 
recomputing it either way.  To use the image proc. toolbox functions in EML, you can use the 
extrinsics keyword (just google "EML extrinsics").  Using extrinsics implies that you will not
be able to generate code from the functions that you'd use by using the keyword.

> Have I got any hope of using Real time workshop and the TIc6 support package to generate fast 
> code for a TIc64xx dsp? (However, the model will still be useful even if fast code cannot be created.)

You do have hope -:). It will not be a trivial task though if you want to achieve high frame rates.

Witek