c++ opencv 函数参数简单说明使用
垂直,水平,垂直水平 flip
cv::flip(oriimg, oriimg,0);
cv::flip(oriimg, oriimg,1);
cv::flip(oriimg, oriimg,-1);
getAffineTransform,仿射变换,没带角度带缩放的平移
cv::Point2f p1[3], pp1[3];
p1[0] = cv::Point2f(973, 778);
p1[1] = cv::Point2f(3454, 770);
p1[2] = cv::Point2f(3475, 4995);
pp1[0] = cv::Point2f(49, 233);
pp1[1] = cv::Point2f(1459, 228);
pp1[2] = cv::Point2f(1487, 1748);
cv::Mat warp_mat = cv::getAffineTransform(p1, pp1);
// 返回 2*3 矩阵
// 0.5683 0 -506.94
// 0 0.3598 -46.067
// X= 0.5683
// Y= 0.3598
// W = -506.94
// H= -46.067
//目标点 x = ( 源图点x * X) + W
//目标点 y = ( 源图点y * Y) + H
getStructuringElement , 返回指定形状和尺寸 核
cv::Mat resultMat;
cv::Mat kernel= getStructuringElement(MORPH_RECT,Size(3,3));
cv::dilate(resultMat, resultMat, kernel);
cv::erode(resultMat, resultMat, kernel);