nihui/opencv-mobile

cv::imdecode 接口读取jpg图片异常

1658988725 opened this issue · 3 comments

imdecode 直接读取内存的jpg图片解析异常
但是把图片存入文件,用imread解析文件正常

#if 0
    std::vector<unsigned char> buff(jpg, jpg + len);
    // cv::Mat m = cv::imdecode(cv::Mat(buff), 1);
    cv::Mat m = cv::imdecode(buff, 1);
#else
    std::string filename("test.jpg");
    std::ofstream ofs(filename.c_str());
    ofs.write((const char*)jpg, len);
    ofs.close();
    cv::Mat m = cv::imread(filename.c_str(), 1);
    double meanValue = blurdetection(m);
    rsq["meanValue"] = meanValue;
#endif
nihui commented

confirmed

nihui commented

fixed in 2a7d0b4