Convolution of ROI using as border the pixels outside the ROI
Hello,
is it possible to calculate the convolution of a ROI of an image and use as border the border of the ROI which is outside the ROI (not included in the ROI)?
If yes, how is it calculated?
For example, I used filter2D on a ROI selected with Rect(), but in filter2D there isn't a border option which matches with what I'm describing above..
example.png edit: To visualize what I'm describing, in the attached file, I want to calculate the convolution of the yellow ROI using as border the pixels around the yellow ROI (the ones included in the blue rectangle but do not belong to the yellow rectangle).
Thank you for your time, Panos
hey, took me 5 times to understand your 1st line ;)
(while it all makes sense, maybe a small image / drawing would be helpful to others)
I added an example image and using it tried to explain what I want to do.
Said in another way: I would like to be able to calculate the convolution only for the image pixels that the kernel resides entirely inside the image. So, lets say that the example.png describes the case where the kernel size is 3x3.
what if you do the convolution on a roi, that's kernelsize/2 larger than your actual roi, and crop the result back later ?
That is valid, but I want to avoid the extra calculations because I'm measuring execution time. What you are saying is what I'm currently doing, but since I'm measuring execution time, I would prefer an exact solution.