opencv中的图像坐标

下图把Mat.at(x,y) , Point(x,y) ,Rect(x,y,w,h) 的坐标用程序生成的图像来表示;后面附有程序

opencv中的图像坐标_第1张图片

int main()
{

Mat img = imread("D:\\image\\q2.jpg");

cv::putText(img,"the line is img.at(100, : ) = Vec3b(255,255,255)",Point(0,80),1,0.8,Scalar(255,255,0));


for(int j=0;j

string str;

stringstream ss;

if( j%100 == 0){

ss<

ss>>str;

cv::putText(img,"Point("+str+",100)",Point(j,100),1,0.8,Scalar(0,255,0));

}

img.at(100,j)=Vec3b(255,255,255);

}

cv::rectangle(img,Rect(0,50,300,150),Scalar(2,0,0));

cv::putText(img,"Rect(0,50,300,150)",Point(300,200),1,0.8,Scalar(5,5,0));


for(int i=-5;i<5;++i)

for(int j=-5;j<5;++j)

img.at(Point(20+i,300+j))=255;

putText(img,"Point(20,300)",Point(20,300),1,1,Scalar(0,0,0));


imshow("ori",img);

waitKey(0);

return 0;

}


你可能感兴趣的:(图像处理)