out of memory using estimateCameraParameters

2 次查看(过去 30 天)
I'm doing a single camera callibration and I'm using a pretty much lazy method. Instead of taking some small amount of images, I film a short video of many frames of the chess board from different obstacles and distances and pass them all to the function, so it make the best fit (because I'm not an expert).
I'm doing pretty much the same things as in the example.
images = string(ls("G:\Vista_project\cur\"));
images = images(3:end);
images = arrayfun(@(s) append("G:\Vista_project\cur\", s), images);
[imagePoints, boardSize] = detectCheckerboardPoints(images);
imagePoints = squeeze(imagePoints);
squareSizeInMM = 20;
worldPoints = generateCheckerboardPoints(boardSize,squareSizeInMM);
I = imread("G:\Vista_project\cur\Vista_project0tc10202.jpg");
imageSize = [size(I, 1),size(I, 2)];
params = estimateCameraParameters(imagePoints,worldPoints,'ImageSize',imageSize);
How can I compute the maximal images that I can have in my directory so matlab could manage this method (estimateCameraParameters) without out of memory error (I have 16 GB).
That is the only thing I thought to resolve the problem ( to calculate manually what is my overload), because I don't want to choose the good photos manually, because I don't know which will give me the best callibration results.
My images of size 512 x 640 with 16 bit per pixel with one channel.The out of memory happens with 2223 images for callibration.
And a future question, how much for same images stereo callibration consumes ? Is it x2 (double of the memory as for one) ?
Thank you in advance.

回答(1 个)

Shreeya
Shreeya 2024-1-15
The image array accounts for 512*640*3*16*2223 bits (width*height*channels*number of bits per channel*number of images) of memory in the workspace. Since this array is not needed after calling the detectCheckerboardPoints function, clearing it before proceeding with the next computations can help mitigate the out of memory error.
You can use the following command in the MATLAB command window to clear the image array:
clear images

类别

Help CenterFile Exchange 中查找有关 MATLAB Support Package for USB Webcams 的更多信息

产品


版本

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by