我喜欢使用 5 x 5 矩阵制作一个 11 x 11 矩阵,如下所示。有没有比这更好的方法?
int csz = 5;
Mat zz = Mat::zeros(csz, csz, CV_32FC1);
Mat oo = Mat::ones(csz, csz, CV_32FC1);
Mat hh = 0.5 * Mat::ones((csz*2 + 1), 1, CV_32FC1);//column matrix
cv::Mat chkpat1((csz * 2 + 1), (csz * 2 + 1), CV_32FC1);
chkpat1(Range(0, 5),Range(0, 5)) = zz;//first quadrant
chkpat1(Range(0, 5),Range(6, 11)) = oo;//second quadrant
chkpat1(Range(5, 11),Range(0, 5)) = oo;//third quadrant
chkpat1(Range(6, 11),Range(6, 11)) = oo;//fourth quadrant
chkpat1(Range(0, 11),Range(5, 6)) = hh;//middle column
chkpat1(Range(5, 6),Range(0, 11)) = hh.t();//middle row