Image acquisition speed using a photometrics camera
Show older comments
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
Hi Ahmed, how does the memory usage change over time? You can monitor this with the 'memory' command in MATLAB, or with your OS task manager. If the memory usage is increasing, are you able to determine which commands correspond to the increase in memory? Additionally, how much memory does your system have? You are allocating 1000 MB to the buffer, you can try lowering this to see if it helps.
ahmed niri
on 21 Apr 2017
Edited: ahmed niri
on 21 Apr 2017
Ali Özgür Argunsah
on 26 Nov 2018
Did you solve this problem?
Answers (0)
Categories
Find more on Image Acquisition Toolbox Supported Hardware in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!