简体   繁体   中英

Mat_<unsigned char> in opencv - Mat datatypes

In the below code if I read image using imread the image is displaying differently and if the source is camera it is showing normal colored image. And below is the code.

Can some one explain bit in detail with some good link if possible?

int main () {

    cv :: Mat_<unsigned char> src;
    cv :: VideoCapture cap(0);

    while ( 1 ) {
        cap >> src;
//      src = cv :: imread ( "C:\\Users\\hubuser10\\Desktop\\1.jpg" );

        imshow ( "test image", src );
        cv :: waitKey(1);
    }

}

Result from imread: 在此处输入图片说明

Camera image:

在此处输入图片说明

Both VideoCapture and imread without additional parameter returns 3-channels BGR frames. Use cv::Mat_<cv::Vec3b> type.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM