问题1:
显示的是灰色的界面,不能正常显示图像。
解决方法:在imshow之后加上waitKey即可。原因here;
Note:This function should be followed by waitKey function which displays the image for specified milliseconds. Otherwise, it won’t display the image. For example, waitKey(0) will display the window infinitely until any keypress (it is suitable for image display). waitKey(25) will display a frame for 25 ms, after which display will be automatically closed. (If you put it in a loop to read videos, it will display the video frame-by-frame)
参考
1.imread;
完