The program I’m trying to write aims to replace some pixel’s values according to their coordinates. The error message —> Mat “outp” can not be converted into bool, here is the part of the program
...
Mat image ;
vector<Point> coor{Point(7,7)}; // --> define a vector with a given coordinates
Mat outp = getPixels(image, coor); // --> get the pixel's value
for (int row = 0; row < image.rows; row ++) // --> loop through the image
{
for (int col = 0; col < image.cols; col ++)
{
if( outp == 0 ) // --> if the pixel for the given coordinates equals 0 (black pixel )
{
image.at<uchar>(row,col) = 255; // --> replace the pixel with 255 instead of 0
int pixelValue = image.at<uchar>(row,col);
outputFile << pixelValue << '\t';
}
else {
int pixelValue = image.at<uchar>(row,col);
outputFile << pixelValue << '\t';
}
outputFile << endl;