- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
SYSGEN: How to deliver image inside "Gateway In"
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
10-31-2011 07:51 AM
Hello,
How can I deliver image matrix (Image From File, Simulink) trough block Gateway In. The output of Image From File is matrix 240x320. Gateway In accepts only scalars. DSP block Unbuffer doesn't help, as it only converts 240x320 into flow 1x320. Should I develop some custom converter, or there is some Simulink facility ?
Thanks in advance.
Regards.
Pavel.
Solved! Go to Solution.
Re: SYSGEN: How to deliver image inside "Gateway In"
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-01-2011 12:46 AM
Hi,
do the data setup for your simulation in matlab.
Then your simulink model can read the data from the workspace.
You can even trigger the simulation from your matlab script.
e.g:
t= 1:1000;
t=t'; %make it a column vector
image= some_load_image_function();
image_stream =image(:);
sim('my_model.mdl');
% you can add extra code for intense result analysis after this.
%provided the simulink results have been written to the workspace.
And there's also some "Convert 2-D to 1-D" in the Signal Processing Blockset.
Have a nice simulation
Eilert
Re: SYSGEN: How to deliver image inside "Gateway In"
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-01-2011 02:16 AM - edited 11-01-2011 02:19 AM
Hello Eilert,
Thank you for suggestions.
Concerning matlab setup, for the moment I don't need in additional extracode. Maybe later ...
What I want to do for the moment is just run a simple simulation - run image through Xilinx gateways. But it doesn't work (please, look at picture in attachment).Gateway In accepts only scalars, but not arrays - either 1xN, or MxN.
It seems that to accomplish this task one must create some sort of clocked transmitter, that sent one pixel of image array per clock.
Or maybe there is other solution - find some kind of tsuch ransmitter in Simulink blocksets, or read image directly in Xilinx block ?
Regards.
Pavel.
Re: SYSGEN: How to deliver image inside "Gateway In"
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-01-2011 06:01 AM
Hello, Pavel.
Try to use "Reshape" block to convert your image to the vector. And then convert it to the stream of samples by using block "Unbuffer".
Best Regards,
Vitaly.
Vitaly.
Re: SYSGEN: How to deliver image inside "Gateway In"
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-01-2011 06:51 AM
Hello Vitaly,
Simulation run without errors. Thanks.
:smileyhappy:
Now the problem is how to get image out of Xilinx Gateway Out. The array simout is filled with '0' (please look at picture)
Maybe I didn't correctly set Gateway In:
Output Type: Unsigned
Number of bits: 8
Binary point:1
Regards,
Pavel.
Re: SYSGEN: How to deliver image inside "Gateway In"
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-01-2011 10:02 PM
Hello, Pavel.
It's better to set "binary point" to 0 if your input's type is 'uint8'. But it's not critical.
It seems that your problem is connected with simulation time.
In order to get some meaningful data out of "Buffer" block, simulation time should be equal or larger than your buffer size. In your case it's 240*320. It's due to the fact that buffer needs time to accumulate input samples. And after that it ouputs the frame of accumulated samples.
Best Regards,
Vitaly.
Vitaly.
Re: SYSGEN: How to deliver image inside "Gateway In"
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-01-2011 11:17 PM
Hi guys,
actually the Reshape block and the Convert 2D to 1D block perform the same operation.
I missed that something like Unbuffer is needed in the simulink environment, because I rarely work directly there.Sorry.
(Too unflexible, too much clicking in dialogs)
In the script using u(:) is sufficient, because the column vector data from the workspace is read in elementwise.
(Also I'm using just simple In/Out blocks rather than From/To Workspace, so I can use my models directly as subsystems for larger systems.)
Have a nice simulation
Eilert
Re: SYSGEN: How to deliver image inside "Gateway In"
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-02-2011 12:40 AM
The best! :smileyhappy:
Only bizarre thing - array simout contains 153600 elements (240*320*2) and first half is '0'.
I set simulation time to 320*240.
Regards.
Pavel.
Re: SYSGEN: How to deliver image inside "Gateway In"
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-02-2011 03:02 AM
Yes, but it's normal. All pixels (or samples) are processed in the system one by one. So when you input one pixel, the system outputs one pixel. But buffer block waits for all input pixels of given image size (240*320) before it can output this frame. You can set default initial value of output as parameter "Initial conditions" of "Buffer" block.
Best Regards,
Vitaly.
Vitaly.
Re: SYSGEN: How to deliver image inside "Gateway In"
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
11-02-2011 03:07 AM
eilert wrote:
(Too unflexible, too much clicking in dialogs)In the script using u(:) is sufficient, because the column vector data from the workspace is read in elementwise.
(Also I'm using just simple In/Out blocks rather than From/To Workspace, so I can use my models directly as subsystems for larger systems.)
Have a nice simulation
Eilert
Hello, Eilert.
Absolutely agree with you. Processing of MATLAB variables is much easier to do in scripts than in Simulink.
Vitaly.











