我正在尝试保存原始灰度图像的黑色像素位置,然后想将其绘制到灰度图像的修改版本中。我的代码在这里:
std::vector< std::vector <cv::Point> > Black_Pixel;
for(int y = 0; y < Original_Image.rows; y++)
{
for(int x = 0; x < Original_Image.cols; x++)
{
if (Original_Image.at<unsigned char>(x,y) == 0 )
{
Black_Pixel[0].push_back(cv::Point(x,y));
Black_Pixel.push_back( std::vector <cv::Point>());
}
}
}
for( unsigned int idx = 0; idx < Black_Pixel.size(); idx++ )
{
New_image.at<unsigned char>(Black_Pixel[0][idx].x,Black_Pixel[0][idx].y) = 0;
cv::waitKey();
}