1 | initial version |
Your a lucky guy (or not… because it could crash at any time…). As @berak says, in Debug, you should get an exception as bounds are checked. It's your job, as a developer to checks the bounds of images you are scanning. The bounds are not checked in release, and if you want to be sure that there is not out-of-bound access, and obviously don't want to use the rows and cols members, have a look at the iterator (begin and end) of the cv::Mat class. They are similar to STL iterator.
If you are interested in the many ways you could use to scan your image, have a look at that tutorial that will show you most of the common way to scan an image, and highlight the performance you could expect for each of them.