using a for loop to create a structure of images
이전 댓글 표시
I'm using matlab to control a microscope camera. I set up a script to grab 8 frames and average them, shown partially below. (The mmc lines are java commands that let MATLAB communicate via Java to the camera and other microscope parts via the micromanager API):
xpix = mmc.getImageWidth;
ypix = mmc.getImageHeight;
mmc.snapImage();
im.im1 = mmc.getImage();
im.im1 = reshape(uint16(im.im1), xpix, ypix);
mmc.snapImage();
im.im2 = mmc.getImage();
im.im2 = reshape(uint16(im.im2), xpix, ypix);
...
mmc.snapImage();
im.im8 = mmc.getImage();
im.im8 = reshape(uint16(im.im8), xpix, ypix);
avim = (im.im1 + im.im2 ... + im.im8)/8;
So, is there an easier way I could set this up using a for loop? I don't know how to tell it to name a variable or parts of a structure sequentially. It would be nice if there were a variable n, that the use could input to tell it how many frames to average, either in the first line of the script (n=4) or as a variable when i make it into a function. I am not profient in MATLAB so my efforts to write a for loop so far have not worked.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 MATLAB Support Package for IP Cameras에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!