Launch an algorithm in several samples extracted from an image
2 次查看(过去 30 天)
显示 更早的评论
Hello, I would like to extract features of a raster image by using an active contour algorithm (see below). My goal is to obtain morphometry of each object. For each of them (92 features), I have created same size matrix (5 rows, 5 columns) with this code :
%svf is the name of the image
%xy_points are the center coordinates of each feature
For m=1:92;a(:,:,m)=svf(xy_points(m,1)-2:xy_points(m,1)+2,xy_points(m,2)-2:xy_points(m,2)+2);end
Thus, I obtained 92 matrix of 5x5.
This is my problem : I have succeeded in applying the active contour algorithm on 1 image (the whole image called "svf"). But I don't know how to apply it on my samples (matrix for each feature) and to repeat the process.
Thanks for your help.
0 个评论
回答(1 个)
Thorsten
2015-10-13
Why not
for m=1:92;
result = activecontour(svf(xy_points(m,1)-2:xy_points(m,1)+2,xy_points(m,2)-2:xy_points(m,2)+2));
% do something with result
end
2 个评论
Thorsten
2015-10-14
Your code has various issues:
. if you have swf as your image, why do you write it to a pgm image, then read it, instead on just working with swf
. why to you scale with 1, i.e., no scaling?
Besides this, my suggestion was to write a function activecontour with the image as an argument, that you then call in a loop over all your subimages.
另请参阅
类别
在 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!