Problems applying algorithm to multiple images
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi my aim is to remove noise and segment bacteria from time lapse microscopy images. So far I have created a function to that does this and can be applied to any of the images independently. I would like to create a new function or adapt the present one to loop over the images and apply the algorithm. I have looked at the Matlab help page Batch Processing Images in Parallel and after following the instructions I get the following error Error in ==> batchProcessFiles at 12 Cell contents reference from a non-cell array object. The line mentioned reads I = imread(fileNames{1}); I am confused as fileNames is a cell array object containing all the images to be looped over. Also I am getting a warning stating that variable fcn is indexed but not sliced in a parfor loop. The lines of code are parfor (k = 1:nImages)
I = imread(fileNames{k});
segmentedCellSequence(:,:,k) = fcn(I);
댓글 수: 1
Image Analyst
2012년 7월 30일
What is fcn? What does "indexed but not sliced" mean? (I don't have the parallel toolbox, in case those are special parallel terms.) Is fcn an array or a function? If it's an array, how can it take a 2D or 3D image as an index?
답변 (2개)
gargoyle
2012년 8월 2일
as i understand this: you have a function which you want to apply to every image in a folder. assuming that is what you want. try the following:
get the file list from your folder with images (root)
root='C:\some path\'; % you can enter your path here
file_list=dir([root '*.tiff'])% here i assume you have a tiff file and you will %get all the tiff files in the folder
%now the for loop:
for count=1:numel(file_list)
img=imread([root file_list(count).name]) %this will open the images you can %also try something called bfopen (search for it) if you dont have raw tiff %files
%use img to run your code on
end
댓글 수: 1
gargoyle
2012년 8월 2일
OOPS. Walter already covers this with his link and there is some error checking also included there.
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!