Ask Your Question

Revision history [back]

If you are at pixel x,y you could copy the rectangle into a new Mat as

cv::Mat foo = img.colRange(x-1,x+1).rowRange(y-1,y+1)