Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: inverse fisheye and perspective transform in simulink
Date: Wed, 1 Jul 2009 14:53:01 +0000 (UTC)
Organization: Application Solutions
Lines: 21
Message-ID: <h2ft8d$hdb$1@fred.mathworks.com>
References: <h2aua3$81i$1@fred.mathworks.com> <h2fn6v$9ci$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1246459981 17835 172.30.248.37 (1 Jul 2009 14:53:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 1 Jul 2009 14:53:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1885308
Xref: news.mathworks.com comp.soft-sys.matlab:552032


Hi Witek, thanks for the response.

> > 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. 

Actually this is an algorithm that is already created for a TI DSP and I'm looking at whether I could have created it using Simulink tools. The approach that is taken is to compute the lookup table in advance, and there is some clever memory managent for bringing the relevent bits of the lookup table. (This frees up the DSP for doing other things!). I'm starting to realise that Real time Workshop (like most things) is no magic box and wont be able to do any complex memory management without me doing a lot of work.

I think that, as you suggested, an extrinsic embedded matlab function or a C++ s-function is what is needed and I should perhaps forget about generating code for perspective transforms. There's plenty of other more suitable tasks that Simulink automatic code generation would be more suited to.

>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. 
> 
Thanks, I had a look at this block but couldn't seem to get this working. I generated my tranform matrix using the image processing function 'maketform' with argument 'projective' (and this worked when I used the image processing imtransform function to transform my image) but using this tranform matrix in the 'Apply Geometric Transform block' didn't seem to produce the right transform at all. Is there some difference between the transform matrix used by 'imtransform' and the one used by the 'Geometric Transform block'?

Best Regards 
Sam  :-)