Hello forum,
Given an image of size 100x100, I would like to set a region of size 3x3 to zero. I receive an error when the mid point is designated at (0,0) or the boundary. Can anyone help me on this ? Thanks
1 | initial version |
Hello forum,
Given an image of size 100x100, I would like to set a region of size 3x3 to zero. I receive an error when the mid point is designated at (0,0) or the boundary. Can anyone help me on this ? Thanks
2 | No.2 Revision |
Hello forum,
Given an image of size 100x100, I would like to set a region of size 3x3 to zero. I receive an error when the mid point is designated at (0,0) or the boundary. Can anyone help me on this ? Thanks
Mat image = imread("box.jpg");
Point center = Point(0,0);
Point tl = center - Point(1,1);
Point br = center + Point (1,1);
Rect roi = Rect(tl, br);
Mat image_roi = image(roi);
image_roi.setTo(0);
I know it is an error because tl = (-1,-1). What should i include to ensure that the rectangle does not go out of bounds when center = (0,0) ie. roi = Rect(Point(0,0), Point (1,1))
or when center is at the boundary. How does the filter/convolution function in opencv work without going out of bounds ?