I have generated a map named map_1.pgm using map_server package. I want to display it in an OpenCV window. How can I achieve this?

I am currently trying this -

std::string file_name = "map_1.pgm";

cv::namedWindow("map_1");
cv::imshow("map_one_window", m);

cv::waitKey(0);


This is my map_1.yaml

image: map_1.pgm
resolution: 0.050000
origin: [-100.000000, -100.000000, 0.000000]
negate: 0
occupied_thresh: 0.65
free_thresh: 0.196


However, on doing the above steps, I get a big OpenCV window which is completely grey.

How do I solve this problem?

I am attaching the results of xdg-open map_1.pgm.