Surface roughness determined from a depth map.
3 views (last 30 days)
Show older comments
Andri de Waal
on 2 Oct 2023
Commented: Andri de Waal
on 3 Oct 2023
Hi,
I would like to determine the surface rougness of a microscopic picture.

I have code that creates a depth map:
File_Name='CPTi_D2_75_right_off_centre.tif';
% micron/pixel
% this is the spatial resolution of the input
Resolution=0.459;
% Number of intensity levels in the image,
% if you think that the result porosity is overestimated,
% just increase this number and vice versa, it accepts integers
N=18;
A = imread(File_Name);
if ndims(A) == 3
B = rgb2gray(A);
end
level = multithresh(B ,N);
C= imquantize(B,level);
RGB1 = label2rgb(B);
imwrite(RGB1,[File_Name(1:end-4) '_Depth Map.png']);
P=zeros(size(C));
for I=1:size(C,1)
for J=1:size(C,2)
if C(I,J)==1
P(I,J)=1;
end
end
end
P=1-P;
P=bwmorph(P,'majority',1);
figure;
imshow(RGB1); title('Depth Map')

I would like to use to create a 2D graph of the various distances and then use that to calculate the surface roughness.
Can anyone help me with this? Would it be possible? If not, any other suggestions?
Thank you for taking the time to assist me.
Kind Regards,
Andri
0 Comments
Accepted Answer
Image Analyst
on 2 Oct 2023
Looks like youi're assuming that your brightness corresponds to depth. Assuming that's true there are several definitions of roughness. In fact whole books have been written about them. Perhaps the most common are Sa and Sq. Sa is the average absolute deviation from the mean surface, in other words
Sa = mean2(abs(C - mean2(C)));
More Answers (0)
See Also
Categories
Find more on Biomedical Imaging in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!