1. cv::Mat 的属性
cv::Mat img ;
img = cv::imread( img_path, CV_LOAD_IMAGE_COLOR ) ;
if ( !img.data )
std::cout << "Could not open or find file " << img_path << std::endl ;
int img_rows = img.rows ; Mat 的高宽属性
int img_cols = img.cols ;
for( int h; h<img_rows; h++)
for( int w; w<img_cols; w++ )
{
img.at<uchar>(h, w ) ; note the order of the height and cols
} similar as that of matlab.
cv::Mat img( height, width, CV_8UC1, cv::Scalar(0) ) ;
------------------------------------------------------------------------------------
cv::Rect roi ;
roi.x = 0 ; start index of width
roi.y = 0 ; start index of height
roi.width = (int) img_cols/2 ;
roi.height = (int) img_rows/2 ;
cv::Mat c