私は C++ が初めてで、cv::Mat のリストを作成しようとしています。
これは非常に多くのメモリを割り当てる可能性がありますが、リストにロードする小さなマットは約 10 個しかありません。
このコードを作成しましたが、なぜ機能しないのかわかりません。
void Utils::getFramesFromVideo(std::string file,std::list<cv::Mat>& listMatOutput) {
    cv::VideoCapture* videoCapture = new cv::VideoCapture(file);
    bool hasImage = false;
    cvNamedWindow("WhileReading", 1);
    do {
        cv::Mat frame;
        hasImage = videoCapture->read(frame);
        if (hasImage) {
            listMatOutput.push_back(frame);
            imshow("WhileReading", frame);
            waitKey(0);//give some time to see the frame (debug)
        }
    } while (hasImage);
    cvNamedWindow("AfterReading", 2);
    for (std::list<Mat>::const_iterator iterator = listMatOutput.begin();
            iterator != listMatOutput.end(); iterator++) {
        imshow("AfterReading", *iterator);
        waitKey(0);//give some time to see the frame (debug)
    }
    videoCapture->release();
}
最初の読み込みではフレームが正しく表示されますが、2 番目のウィンドウ (AfterReading) では画像が黒く赤い縞模様になっています。誰かアドバイスをお願いできますか?