cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ra7
Participant
Participant
22,470 Views
Registered: ‎08-24-2010

Image Processing in Xilinx System Generator - Simple Q.

Jump to solution

 

Hey folks,

 

I'm quite embarrassed to actually ask this as it's such a simple task...

 

I'm new to System Generator and worked through the 7 quick start labs with no problems, but beginning to explore image processing I'm having problems actually processing the data through the gateway IO.

 

I'm currently working with a simple model where the image is prepared for gateway input and output where no operations occur within the FPGA boundary.

 

Through reading it is my understanding to prepare the image for passing into the gateway input the image should be:

  • Transposed
  • Converted from 2-D matrix to 1-D vector
  • Converted to frame
  • Unbuffered

The data passes into the gateway and back out, but attempting to reconstruct the orginal results in a black screen.

 

The image reconstruction process is:

  • Buffered
  • Convert to 2-D matrix
  • Transpose data.

The image data being processed is the red component of the peppers.png file provided by Matlab.

 

Any help to get me on why way will be much appreciated.

 

 

 

 

------------------------------------------------------
Recreational FPGA Explorer.
0 Kudos
1 Solution

Accepted Solutions
ra7
Participant
Participant
24,676 Views
Registered: ‎08-24-2010

Forgot I posted this.

 

Yeah its the sampling time that caused it.

 

As System Generator is clock cycle accurate you need to assign a simulation run time of (at least) the image dimension, for example if it is a 512 by 512 image then set the simulation run time to a minimum of 512*512.

------------------------------------------------------
Recreational FPGA Explorer.

View solution in original post

38 Replies
ticktack
Explorer
Explorer
22,212 Views
Registered: ‎08-14-2007

Take a look at example under $DSP_Tools\sysgen\examples\shared_memory\hardware_cosim\conv5x5_video

0 Kudos
xud
Xilinx Employee
Xilinx Employee
22,184 Views
Registered: ‎08-02-2007

This message was moved by Xilinx Forum Moderator. If you have any questions, please contact Forum Moderator.

0 Kudos
ra7
Participant
Participant
22,138 Views
Registered: ‎08-24-2010

 

 

I looked at the convolution 5x5 models provided, but they weren't doing what I particularly wanted, I kept getting an error from the shared memory block.

 

What I've done is have an image broken down to a pixel stream and recompiled with no problems in simulink, but when it passes through the FPGA boundary (Gateways Input and Output) it gives me a black screen. See the attached image for simulation details.

 

I assumed it was due to numerical error. I tried various bit combinations in the Gateway Input block, but to no avail.

 

Any help on it would be appreciated.

 

EDIT:Updated post to help those who are new to System Generator and are having similar problems.

 

This model works.

The image being processed is a 512x512 greyscale Lenna image, hence only 1 output image component from the image read block. The simulation run time should be set to at least the pixel dimensions of the image processed, where; gateway sampling is 1 and the System Generator token simulink sampling set to 1.

------------------------------------------------------
Recreational FPGA Explorer.
sysgen_problem.JPG
0 Kudos
daragonhdz
Visitor
Visitor
21,614 Views
Registered: ‎01-27-2011

Hi, I'm new to System Generator and I have the same problem.

 

How did you solve this?

 

 

0 Kudos
salman866
Contributor
Contributor
21,598 Views
Registered: ‎11-26-2010

Hi

I am not sure but I think there could be a problem of sampling time. If you could just attach your model than the problem could be more easily understood

                                                SALMAN

0 Kudos
ra7
Participant
Participant
24,677 Views
Registered: ‎08-24-2010

Forgot I posted this.

 

Yeah its the sampling time that caused it.

 

As System Generator is clock cycle accurate you need to assign a simulation run time of (at least) the image dimension, for example if it is a 512 by 512 image then set the simulation run time to a minimum of 512*512.

------------------------------------------------------
Recreational FPGA Explorer.

View solution in original post

daragonhdz
Visitor
Visitor
21,542 Views
Registered: ‎01-27-2011

Hi again,

 

I did what you said and set the simulation run time to 512*512 and greater, but the output is still black.

 

the system period on the System Generator block is set to 1

the solver type is fixed-step, discrete (no continuous states)

 

is this ok?

 

I added a "To Workspace" block at the output to see the actual values and it shows that the output is a 512*512*2 matrix

where the first matrix is full of zeros and the second matrix has the actual image values.

 

Perhaps the display block is showing the first matrix values..Any thoughts on that?

 

thanks

0 Kudos
ra7
Participant
Participant
21,530 Views
Registered: ‎08-24-2010

The machine I'm currently on doesn't have all the MATLAB toolboxes necessary to give your model a proper examination, so my current help will be quite limited. I'll look at it on another later today.

 

Is the source image a 512x512 pixel image?

Are you processing an individual image type component (such as the red, green or blue) or is the image read block outputing all RGB components on the same line?

Is the data type conversion to unsigned 8 bit block really neccessary?

 

 

Edit:

 

I ran your model on a machine with the correct MATLAB toolboxes.

I used a 512x512 Lenna image in JPG format.

The image from file was set to a one dimensional signal, you need to process the image components seperately, so change it to produce seperate color signals (R | G | B).

I used a video viewer sink and it produced the image, while the video display sink did not. 

 

Hope that helps

 

------------------------------------------------------
Recreational FPGA Explorer.
0 Kudos
daragonhdz
Visitor
Visitor
21,492 Views
Registered: ‎01-27-2011

Hi,

 

I used the Video viewer block and it displayed the image.. at last

 

dont know why the video display block didn't work

 

anyway, this is enough for my application, thanks a lot for your help

0 Kudos
shamimsf
Newbie
Newbie
15,135 Views
Registered: ‎10-05-2011
 
0 Kudos
shamimsf
Newbie
Newbie
15,136 Views
Registered: ‎10-05-2011

Hi

 

After going through it, the output image is shown only for few second and gone.

if i want to keet it displayed on screen , what can be done

 

regards

shamim

 

0 Kudos
tala
Visitor
Visitor
14,983 Views
Registered: ‎05-12-2012

HI

 

I wanna to build simple  image processing application that is (Brighyness )

 picture  below shows the architecture  but the output is just white line (I attache  output image below)

would you please to tell me what is the errors .brightness.JPG

Thank you in advance

outputbrightness.JPG
0 Kudos
vlavruhin
Explorer
Explorer
14,969 Views
Registered: ‎12-08-2010

Hi.

 

Your block diagram looks ok. The issue seems to be connected with the parameters of blocks. Could you attach your model file? Or at least describe settings of all blocks?

 

Also you may find similar thread helpful:

http://forums.xilinx.com/t5/DSP-Tools/SYSGEN-How-to-deliver-image-inside-quot-Gateway-In-quot/td-p/187732

 

Best Regards,
Vitaly.
0 Kudos
tala
Visitor
Visitor
14,957 Views
Registered: ‎05-12-2012
Hi Vlavruhin
thank you very much for reply me
Im so sorry I can't attach my model file now because i store it in PC at my office (my work)
the size of image 300*300 .

gateway in setting is Output Type: Unsigned

Number of bits: 8 or 16 I don't remember

Binary point:0 these setting was the in all block which include this parameter.
please help me Vitaly
thank you in advance

0 Kudos
vlavruhin
Explorer
Explorer
14,951 Views
Registered: ‎12-08-2010

Hi.


the size of image 300*300 .
gateway in setting is Output Type: Unsigned
Number of bits: 8 or 16 I don't remember
Binary point:0 these setting was the in all block which include this parameter.

Ok, but what are other parameters?

 

First of all, try to get image at output without brightness processing part, i.e. connect Gateway In to Gateway Out directly.

Best Regards,
Vitaly.
0 Kudos
tala
Visitor
Visitor
14,943 Views
Registered: ‎05-12-2012

Hi Vitaly.

i hope you can help me 

This model attached below 

0 Kudos
ra7
Participant
Participant
14,940 Views
Registered: ‎08-24-2010

I gave your model a quick look over.

I don't have XSG on this machine, but I noticed your reconstruction of the image stream is wrong; it's set for a single 300 pixel row, hence the single pixel row on the output scope.

Buffer: change 'Output buffer size' to 300x300.

Convert 1-D to 2-D: change output columns to 300.

 

Should work after that.

 

------------------------------------------------------
Recreational FPGA Explorer.
0 Kudos
tala
Visitor
Visitor
14,934 Views
Registered: ‎05-12-2012

Hi ra7

thank you for your sugestion .

But the output is still black window

help me please 

thank you in advance

0 Kudos
vlavruhin
Explorer
Explorer
14,899 Views
Registered: ‎12-08-2010

Hi.

 

Block To Video Display isn't supported in my system. But let me give you several recommendations that will allow you to get a working model:

 

1. Replace To Video Display block with Matrix Viewer block. Set its properties: colormap matrix = gray(256), minimum input value = 0, maximum input value= 255.

2. Set bitwidth of Gateway In block equal to 8 (since image pixels are represented by 8-bits numbers).

3. Set Buffer Overlap parameter of Buffer block equal to 0 (there is no need for overlap).

 

Now you should be able to see an image at the output.

Best Regards,
Vitaly.
0 Kudos
tala
Visitor
Visitor
13,462 Views
Registered: ‎05-12-2012
Hi Vitaly
I used video viewer and I saw the image at output,
would you please to ask you what is the relation between sample time(image form file) and display the image.
thank you a lot for your help
Regards
Tala
0 Kudos
vlavruhin
Explorer
Explorer
13,445 Views
Registered: ‎12-08-2010

Hi, Tala.

 

These sample times are same. First, you get whole image from file as a matrix. Then you process this image pixel by pixel. After that, you combine all pixels in the resulting image (matrix) and show it.

Best Regards,
Vitaly.
0 Kudos
tala
Visitor
Visitor
13,440 Views
Registered: ‎05-12-2012
Thank you very much Vitaly
Regards
Tala
0 Kudos
bhaskar872
Observer
Observer
13,115 Views
Registered: ‎06-23-2012

hi , did anyone figure out how to input video frames in gateway in of sysgen?i was trying the same but only one video frame comes out of gateway out.I just could'nt figure why its happining ,is it that gateway in block cant handle son many frames per second?i used the following

video from multimidia-reshape-to frame-unbuffer-gateway in-gateway out-buffer-reshape-video viewer

 

when i remove the gateway in and gateway out block and simulate only in simulink its comes out fine

bhaskar

0 Kudos
diego.a.giral
Visitor
Visitor
12,722 Views
Registered: ‎05-20-2013

Good Afternoon

 

I am currently working with images by XSG and I can not display images, I'm working with models of this forum but I get, I kindly request your cooperation in order to solve my problem.

 

Attached the model in simulink

0 Kudos
laila2013
Visitor
Visitor
12,592 Views
Registered: ‎06-05-2013

hi 
I'm new to System Generator

 

to prepare the image for passing into the gateway  and hardware architecture I must to do the following steps always ?????

 

transposed
Converted from 2-D to 1-D matrix vector
Converted to frame
Unbuffered

 

I tried to do the following test but it does not work
can you help me what is the problem??

0 Kudos
12,146 Views
Registered: ‎05-06-2013

very good software to do image manipulating, thank you for your advice. hope i can process my image normally now.

0 Kudos
12,049 Views
Registered: ‎08-12-2013

Hi ra7

 

i tried your model but i didn't got the output image in the video viewer block of gateway in and gateway out.

 

i used lena 256*256 as input..

 

pls go through the model and find out the problem

Hemanth
0 Kudos
ertam
Visitor
Visitor
11,908 Views
Registered: ‎02-12-2014

hi,  my problem is image dimension , please help me thanks, error picture: http://i57.tinypic.com/ame9ld.jpg

 

 

0 Kudos
11,902 Views
Registered: ‎08-12-2013

Attach m-file for mcode block

Hemanth
0 Kudos