Ask Your Question
0

Hello trying to create a cv::Mat() got Insufficient memory

asked 2017-02-22 07:07:23 -0600

corneliu.cincea gravatar image

This is what i have: rows = 9208 cols = 15152 cv::Mat img_masked = cv::Mat(sourceImage.rows, sourceImage.cols, sourceImage.type()); Error: OpenCV Error: Insufficient memory (Failed to allocate 418558848 bytes) in cv::OutOfMemoryError, file C:\builds\master_PackSlave-win32-vc11-shared\opencv\modules\core\src\alloc.cpp, line 52 OpenCV Error: Assertion failed (u != 0) in cv::Mat::create, file C:\builds\master_PackSlave-win32-vc11-shared\opencv\modules\core\src\matrix.cpp, line 411

Do you know why? Or how I can do differently?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
3

answered 2017-02-22 07:58:24 -0600

pi-null-mezon gravatar image

When you try to allocate more than 2 in power of 32 bytes in the 32-bit system it could not be done because there is not enough memory you can address (9208 * 15152 * 4(channels) > 2 in power of 32). Your image is too big for your build system. So what you should do? In case you are working in 32-bit operation system you should upgrade your operation system to 64-bit. In case you working in 64-bit system, you probably use 32-bit build environment (compiler), just switch to 64-bit build tools.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-02-22 07:07:23 -0600

Seen: 2,943 times

Last updated: Feb 22 '17