gear
gear

Reputation: 421

How to improve initialization time of cv::Mats in OpenCV?

I am preparing 16 cv::Mat variables with a given size and black pixel color as default on program start. To do that, I pass the variables one after the other to the following function. The loading process takes about 22 seconds in release mode (Windows, Visual Studio 2022) on an Intel W-2295 3.00 GHz. What does take so long, and how could I improve this time?

int init_mat(cv::Mat& mat)
{
    cv::Size size_from_config(80000, 3000);

    mat = cv::Mat(size_from_config, CV_8UC3, cv::Vec3b(0, 0, 0));

    return EXIT_SUCCESS;
}

Upvotes: 0

Views: 165

Answers (0)

Related Questions