0

I want to read the picture in grayscale and rotate it 90 degrees, but I am making a mistake somewhere. Is there anyone who can help?

cv::Mat image = imread(".../jpg", IMREAD_GRAYSCALE);
cv::resize(image, image,cv::Size(400,400));
cv::Mat imageson;

int rows = image.rows;
int cols = image.cols;


for (int i = 0; i < cols; i++)
{
    for (int j = 0; j < rows ; j++)
    {
        imageson.at<uchar>(i,j) = image.at<uchar>(rows-1-j,i);
    }
}

cv::imshow("image",imageson);
cv::waitKey(0);

// im beginner btw. output = (exit value:-1)

0 Answers0