This is my first post on this forum, and I have been working to come up with a solution for a final project in my hardware design class using system verilog on an Altera Cyclone FPGA. I've been having trouble finding a solution for overflow when convolving a 3x3 pixel intensity matrix (RGB, values from 0-255) with a specific kernel (blurring, canny edge detection, embossing, etc.)
The question I have is this: What should I do to deal with a result that is greater than 255? I've seen some references suggesting to "wrap the values around" from 255 back to 0 and up, and also have seen some references suggesting to multiply all pixels by a "shrinking factor" (e.g. .8) to avoid ever having to deal with pixel intensity overflow.
Sadly, I've found few references explaining how to deal with this issue in hardware realization. Am I missing something here? Any assistance would be greatly appreciated.
Specifically, what if you convolved a matrix of
[255, 255, 255; 255 255 255; 255, 255, 255] * [1, 1, 1; 1, 1, 1; 1, 1, 1]
? Wouldn't your result contain values outside of your range of 0-255?