Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Neighborhood search for Maxima - 2D filter

Status
Not open for further replies.

sreevenkjan

Full Member level 5
Joined
Nov 4, 2013
Messages
268
Helped
27
Reputation
54
Reaction score
26
Trophy points
1,308
Location
Germany
Activity points
3,115
Hi All,


I am trying to find a maxima using a 8 neighborhood pixel for an filtered image. It is basically a 2D filter moving along the pixels of the image from left to right. I am trying to implement the same using VHDL. I have few questions regarding the approach.

1. When I read the pixels in a stream fashion, I need to read one complete row to access the pixel of below row. Suppose if the image has a width i.e 200 pixels. do I need to read 200 pixels completely to access the next row??. IS there another method to solve this??

If I am using a 3x3 filter then I will have to read 400 pixels so that I have starting pixel values of the below 2 rows.

2. Also is it useful to use a bram as row buffer or is it better to initialize an array and use it as a row buffer??
 

1. You dont need to read all the pixels at once. With some line delays and shift registers you can easily slide the 3x3 filter over the streaming input to provide a streaming filtered output.

2. An array will synthesise to a bram - so they are the same thing, unless you access the array incorrectly and it infers a load of registers (and it will make your compile times very long and eat all your resources).

- - - Updated - - -

1. Well actually, imagine the filter stays still and the data flows through the filter...
 

when you say line delays....the line delays are equal to the width of the image right??...I am able to access the pixels horizontally using shift registers but to access the pixel in the second row then I need to use a delay whose size is equal to that of the image row size....this would take more clock cycles if I am reading one pixel per clock cycle...
 

If you have two line delays, then the output has a latency of two lines + 2 pixels. The rams are dual ported so you can write the previous line whilst reading the current one. You only need to read one pixel from the line delay at a time, then put it in a shift register.

See the attached picture. It produces a streaming output from streaming input, 2 lines and 2 pixel (plus pipelining in the FIR) delay.

filter.png
 

Thanks TrickyDicky....so when you say output has a latency of 2 lines and 2 pixels then I should have read 2 rows of image and store it into line buffers and while I am streaming the third row I need to read a pixel at a time from the stream and also the other pixels...

also if I increase the filter size to a bigger size then it increases the latency...can I not just read one complete row at a time in a single clock cycle??
 

Forget about reading lines - you are reading individual pixels. The input stream is 1 pixel at a time, read from a memory 1 pixel at a time. A video is provided one pixel at a time.

No, you cannot read an entire row at a time - you dont have the memory bandwidth (or if you do, it would be very innefficient use of the ram resources).
The above example assumes that the filter is not seperable - most 3d filters can be separated into a 3x1 and 1x3 filters, giving a 3x3 result. Even better then if the filter is symmetrical. This saves register and multiplier resources.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top