Quantifying pore size distribution for a 2-d image

I have an image and I need to find the pore size distribution for the image. I have a short deadline, your suggestions/comments are highly welcomed.

 采纳的回答

I suggest you use image analysis. Check out my BlobsDemo ( http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862 ) if you need an example. Post your image if you need additional assistance (actually I'm not sure why you didn't already do this since you say you have such a short deadline).

6 个评论

Thanks for your useful comment. Also do you know if there is any way to color blobs-pores based on their sizes? I dont get the logic of label2rgb function.
Sure, sort the connected components and then give each one it's own color based on that order.
I have sorted them, I get the size distribution, my problem is how to assign color to each one. Do you know how to do that?
Use the label2rgb() function. Here's a snippet:
labeledImage = bwlabel(binaryImage, 8); % Label each blob so we can make measurements of it
coloredLabels = label2rgb (labeledImage, 'hsv', 'k', 'shuffle'); % pseudo random color labels
imshow(labeledImage);
Thanks, but my problem is exactlty how to give a color to them, the hsv is a colormap.
When I try to define my own colormap matrix(nx3), the problem is I dont know what should be the size of my own colormaps,(n?)
Your colormap would have to have at least as many rows as you have objects.

请先登录,再进行评论。

更多回答(1 个)

ali: Regarding your last comment requesting a code example:
clc; % Clear the command window.
workspace; % Make sure the workspace panel is showing.
fontSize = 30;
% Create sample image.
binaryImage = zeros(15,20);
binaryImage(2:3:16, 3:16) = 1
% Display it.
subplot(1,2,1);
imshow(binaryImage, []);
title('Binary Image', 'fontSize', fontSize);
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
% Label each blob so we can make measurements of it
[labeledImage numberOfRegions] = bwlabel(binaryImage, 8);
% Make up a custom colormap.
% Figure out how many colors there should be.
% It should have one more for black, which isn't given a label.
numberOfColors = numberOfRegions+1;
halfNumberOfColors = floor(numberOfColors / 2); % For green ramps.
myColorMap = zeros(numberOfColors, 3);
% Make up red component - an upward ramp.
myColorMap(:,1) = linspace(0,1,numberOfColors)';
% Make up green component: an inverted V shape.
myColorMap(1:halfNumberOfColors,2) = linspace(0,1,halfNumberOfColors)';
myColorMap(halfNumberOfColors+1:end,2) = linspace(0,1,halfNumberOfColors)';
% Make up blue component: a downward ramp.
myColorMap(:,3) = linspace(1,0, numberOfColors)';
% Print custom colormap values out to the command window.
disp(myColorMap);
% Apply the colormap to the labeled image and create a new RGB image.
coloredLabels = label2rgb (labeledImage, myColorMap, 'k');
% Display the colored image.
subplot(1,2,2);
imshow(coloredLabels, []);
caption = sprintf('Image converted to RGB\nusing Custom Colormap');
title(caption, 'fontSize', fontSize);

类别

帮助中心File Exchange 中查找有关 Images 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by