Image acquisition speed using a photometrics camera

1 view (last 30 days)
I have an imaging camera that I wanted to use and so I developed a Matlab GUI for this camera. The GUI displays 16 bits 128x128 images acquired from the camera at a specific rate. To change and manipulate properties of the camera I am using the MMCore library. The image acquisition works smoothly (as I am only displaying and not saving the images). Overtime as the images are being acquired, the speed of the acquisition slows down significantly (even if I have a circular buffer).
The code used for the displaying the images is as follows:
import mmcorej.*;
mmc = CMMCore;
mmc.loadDevice('Camera', 'PVCAM', 'Camera-1')
mmc.initializeDevice(mmc.getCameraDevice());
mmc.initializeCircularBuffer();
mmc.detectDevice(mmc.getCameraDevice());
mmc.setCircularBufferMemoryFootprint(1000);
mmc.startContinuousSequenceAcquisition(500);
cap = mmc.getBufferTotalCapacity();
img = zeros(128,128, 7000);
sig = zeros(1, 7000);
i=2;
n=0;
format shortg;
while (mmc.isSequenceRunning())
i=i+1;
if (mmc.getRemainingImageCount()> 0)
img1 = mmc.popNextImage;
[pixelType] = pixel(mmc);
[img1] = camprop(mmc, img1,pixelType);
img(:,:,i) = transpose(img1);
imagesc(img(:,:,i));
sig(i) = img(50,50,i);
sig(2)=1500;
Y =[sig(i),sig(i-1)];
X = [i , i-1];
subplot(2,1,1);
plot(X, Y);
hold on;
drawnow;
subplot(2,1,2);
imagesc(img(:,:,i));
drawnow;
end
if i== 1000
mmc.stopSequenceAcquisition();
end
end
exposuretime = mmc.getExposure();
i
mmc.clearCircularBuffer();
mmc.unloadAllDevices();
How can I make sure the frames will not slow down in Matlab?
Thank you in advance
  3 Comments
ahmed niri
ahmed niri on 21 Apr 2017
Edited: ahmed niri on 21 Apr 2017
Hi Carl, the memory usage does increase over time. Once the library is imported, the majority of memory gets used and then increases when we are acquiring more images. There is however enough memory for me to allocate 1000MB. Thanks

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!