简体   繁体   中英

OpenCV, Dlib - Mat object outputed as black image

I have 4 channel Mat object. I'm trying(as part of a process), to convert it to dlib data(make some changes), and back to Mat .

For some reason, the final output is complete black. I'm trying to be as much efficient in terms of runtime.

cv::Mat image;
cv::cvtColor(image, image, CV_RGBA2BGR); //convert to 3 channels
//COPY pointer saves runtime
dlib::array2d<dlib::rgb_pixel> dlibimg;
dlib::assign_image(dlibimg, dlib::cv_image<dlib::bgr_pixel>(cvimg));
image = dlib::toMat(dlibimg); //black

Any suggestions, why the output is complete black?

dlib::array2d<dlib::rgb_pixel> dlibimg should be

`dlib::array2d<dlib::rgb_alpha_pixel> dlibimg`  

as you have given 4 channel Mat image.

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