Sign In

Don't have a Xilinx account yet?

  • Choose to receive important news and product information
  • Gain access to special content
  • Personalize your web experience on Xilinx.com

Create Account

Username

Password

Forgot your password?
XClose Panel
Xilinx Home
Reply
ra7
Contributor
ra7
Posts: 23
Registered: ‎08-24-2010
0
Accepted Solution

Image Processing in Xilinx System Generator - Simple Q.

 

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.
Expert Contributor
ticktack
Posts: 149
Registered: ‎08-14-2007
0

Re: Image Processing in Xilinx System Generator - Simple Q.

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

Xilinx Employee
Xilinx Employee
xud
Posts: 43
Registered: ‎08-02-2007
0

Re: Image Processing in Xilinx System Generator - Simple Q.

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

ra7
Contributor
ra7
Posts: 23
Registered: ‎08-24-2010
0

Re: Image Processing in Xilinx System Generator - Simple Q.

[ Edited ]

 

 

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
Visitor
daragonhdz
Posts: 6
Registered: ‎01-27-2011
0

Re: Image Processing in Xilinx System Generator - Simple Q.

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

 

How did you solve this?

 

 

Contributor
salman866
Posts: 33
Registered: ‎11-26-2010
0

Re: Image Processing in Xilinx System Generator - Simple Q.

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

ra7
Contributor
ra7
Posts: 23
Registered: ‎08-24-2010
0

Re: Image Processing in Xilinx System Generator - Simple Q.

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.
Visitor
daragonhdz
Posts: 6
Registered: ‎01-27-2011
0

Re: Image Processing in Xilinx System Generator - Simple Q.

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

ra7
Contributor
ra7
Posts: 23
Registered: ‎08-24-2010
0

Re: Image Processing in Xilinx System Generator - Simple Q.

[ Edited ]

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.
Visitor
daragonhdz
Posts: 6
Registered: ‎01-27-2011
0

Re: Image Processing in Xilinx System Generator - Simple Q.

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