I have been working on a piece of code where I need to work with square ROI scattered throughout the image. Each time I need to check if the patch is really contained inside the image (as efficiently as possible), and I expected to find some kind of native method in cv::Mat which provides this functionality. However, I haven't found it. The closest solution I have found is that described in here.
So, I would like to known if anyone knows about some native (fast) solution. Otherwise, I wondered if it is worth adding it as a pull request. The fast solution I was thinking of is sth like this:
x >= 0 && y >= 0 && x < mat.cols && y < mat.rows
I'm just willing to contribute, but as a newbie I wondered if such a simple method is not implemented yet because of some main reason I haven't taken into account.