FPGA Intellectual Property
PCI Express*, Networking and Connectivity, Memory Interfaces, DSP IP, and Video IP
6526 討論

Convolutiuon of an image using DSP builder

Altera_Forum
榮譽貢獻者 II
1,453 檢視

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 積分
6 回應
Altera_Forum
榮譽貢獻者 II
738 檢視

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
榮譽貢獻者 II
738 檢視

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

Altera_Forum
榮譽貢獻者 II
738 檢視

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
榮譽貢獻者 II
738 檢視

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
榮譽貢獻者 II
738 檢視

Can you attach your design?

Altera_Forum
榮譽貢獻者 II
738 檢視

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.
回覆