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?
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 (??). 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)?
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.)
> 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
> > 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 :-)