Skip to content

cv::imencode function fails writing vector<Mat> #26207

@sturkmen72

Description

@sturkmen72

Describe the feature and motivation

test code :

    vector<Mat> imgs;
    Mat img(100, 100, CV_8UC1);
    imgs.push_back(img);
    imgs.push_back(img.clone());
    std::vector<uchar> buf;
    bool ret = imencode(".tiff", img, buf);
    printf("imencode (Mat) success %d\n", ret);
    ret = imencode(".tiff", imgs, buf);
    printf("imencode (vector<Mat>) success %d\n", ret);

Additional context

output of test code:

imencode (Mat) success 1
OpenCV: terminate handler is called! The last OpenCV error is:
OpenCV(4.10.0-dev) Error: Assertion failed (0 <= i && i < (int)v.size()) in cv::_InputArray::getMat_, file C:\GitHub\opencv\modules\core\src\matrix_wrap.cpp, line 81

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions