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!