Ask Your Question

Revision history [back]

imshow doesn't show the intensity values and Point info

I'm trying to display an image(3channels) with imshow function. The problem is it shows the image perfectly but it doesn't show the x and y axis information and the intensity values for grayscale or rgb for color images.

Only the image is showing up. I'm using Windows and Eclipse CDT, but the same code in Ubuntu works good.

#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
using namespace cv;

int main() {
    cv::Mat imgrgb = imread("C:\\Users\\Len\\Documents\\project\\Images\\1-11.jpg", CV_LOAD_IMAGE_COLOR);
    // Check that the image read is a 3 channels image and not empty
    CV_Assert(imgrgb.channels() == 3);
    if (imgrgb.empty()) {
        cout << "Image is empty. Specify correct path" << endl;
        return -1;
    }
    cv::cvtColor(imgrgb, img, CV_BGR2GRAY);
    namedWindow("Test", cv::WINDOW_AUTOSIZE);
    imshow("Test", imgrgb);
    waitKey(0);
}