FPGA Intellectual Property
PCI Express*, Networking and Connectivity, Memory Interfaces, DSP IP, and Video IP
6462 Discussions

Convolutiuon of an image using DSP builder

Altera_Forum
Honored Contributor II
1,374 Views

Here i am attaching a file which will show convolution operation but i am not getting blurred output image at the end.What to do?

0 Kudos
6 Replies
Altera_Forum
Honored Contributor II
659 Views

Sorry, the image is too low resolution for me to quite make out what your design looks like. Could you upload a higher resolution version (if you can't do it on this forum, upload it at a free image sharing site such as imgur.com) and post a couple of details about what output you are getting.

0 Kudos
Altera_Forum
Honored Contributor II
659 Views

i have updated the pic please check it suggest me the solution..

0 Kudos
Altera_Forum
Honored Contributor II
659 Views

Did you intend it to be a 2x2 convolution matrix? to avoid half pixel shifts you need to do an odd number filter, like 3x3 or 5x5. But you have a x4 overall gain, so I guess you've got a very bright white output image? 

You also restrict your image size to 300 wide.
0 Kudos
Altera_Forum
Honored Contributor II
659 Views

U r right thanx its help me a lot,but again when i am doing 3 by 3 convolution and taking 256 pixels image black output is coming.

0 Kudos
Altera_Forum
Honored Contributor II
659 Views

Can you attach your design?

0 Kudos
Altera_Forum
Honored Contributor II
659 Views

When you are doing your filter, you are adding the pixel values but they are in uint8 format, so the sum can't get above 255. You have to make sure that the bit widths accommodate your sum to get large enough. ALSO you need to divide the result by your filter size. So if you are doing a 3x3 blur you should be adding the pixel values of the 9 pixels and then dividing the sum by 9.  

 

In the attached simulink file, i simply did 3x3 blurring (as an average of pixel values) on the individual R,G,B channels. The blurring works if all your bitwidths are set correctly. For example the accumulator bitwidth is set to 16 instead of 8 (although 16 is far too much). Then I also have a gain block of 1/9 to average the sums. Also I'm just using the native simulink library, not dsp builder but the concepts remain.
0 Kudos
Reply