Unable to find the number of pixels on the boundary of a ROI
Mostrar comentarios más antiguos
Hi,
I want to find the number of pixels on the boundary of a ROI. I also want to find the number of pixels inside the ROI. I tried the regionprops method but it is throwing me an error message. Any suggestions would be appreciated.
myFolder = 'D:\regionGrowing_MLT\newim\Segmentation Results';
% Check to make sure that folder actually exists. Warn user if it doesn't.
if ~isfolder(myFolder)
errorMessage = sprintf('Error: The following folder does not exist:\n%s\nPlease specify a new folder.', myFolder);
uiwait(warndlg(errorMessage));
myFolder = uigetdir(); % Ask for a new one.
if myFolder == 0
% User clicked Cancel
return;
end
end
% Get a list of all files in the folder with the desired file name pattern.
filePattern = fullfile(myFolder, '*.jpg'); % Change to whatever pattern you need.
theFiles = dir(filePattern);
for k = 1 : length(theFiles)
baseFileName = theFiles(k).name;
fullFileName = fullfile(theFiles(k).folder, baseFileName);
fprintf(1, 'Now reading %s\n', fullFileName);
% Now do whatever you want with this file name,
% such as reading it in as an image array with imread()
imageArray = imread(fullFileName);
imageArray=imbinarize(imageArray);
s = regionprops(imageArray,'Area','Perimeter');
s(k,:)=s;
end
The following error message is displayed:
Unable to perform assignment because the size
of the left side is 1-by-1 and the size of
the right side is 5-by-1.
Error in im3d (line 24)
s(k,:)=s;
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Neighborhood and Block Processing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!