自己总是忘记,做个笔记
static const Vec3b bcolors[] =
{
Vec3b(0,0,255),
Vec3b(0,128,255),
Vec3b(0,255,255),
Vec3b(0,255,0),
Vec3b(255,128,0),
Vec3b(255,255,0),
Vec3b(255,0,0),
Vec3b(255,0,255),
Vec3b(255,255,255)
};
for(int x=0;x<gray.rows;x++)//gray为二值图
{
for(int y=0;y<gray.cols;y++)
{
if(gray.at<uchar>(x,y)==0)
{
img1.at<Vec3b>(x,y)=bcolors[5];//修改RGB值
Point p;
p.x=y;
p.y=x;
point.push_back(p);
}
}
}
时间: 2024-11-05 13:03:54