Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Altera_Forum
Honored Contributor I
720 Views

Convolutiuon of an image using DSP builder

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 I
5 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.

Altera_Forum
Honored Contributor I
5 Views

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

Altera_Forum
Honored Contributor I
5 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.
Altera_Forum
Honored Contributor I
5 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.

Altera_Forum
Honored Contributor I
5 Views

Can you attach your design?

Altera_Forum
Honored Contributor I
5 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.