imread(),imshow(),nameWindow(),waitKey()的基本用法
imread(const string& filename, int flags = 1)
imread()为读取图片函数。
第一个参数:为图片文件路径
第二个参数为加载类型。第二个参数,可控制不同加载方式。第二个参数默认是1,其含义为按照RGB格式加载图片。一般而言,默认加载即可。
以下是opencv定义第二个参数数值的含义。
IMREAD_UNCHANGED = -1, //!< If set, return the loaded image as is (with alpha channel, otherwise it gets cropped).
IMREAD_GRAYSCALE = 0, //!< If set, always convert image to the single channel grayscale image.
IMREAD_COLOR= 1, //!< If set, always convert image to the 3 channel BGR color image.
IMREAD_ANYDEPTH= 2, //!< If set, return 16-bit/32-bit image when the input has the corresponding depth, otherwise convert it