用MATLAB读取图片计算布氏硬度

该博客介绍了如何利用MATLAB处理图像,通过灰度化、边缘检测和二值化来识别凹痕,并通过填充空洞计算其面积,进一步根据力和凹痕直径计算布氏硬度数。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

A = imread('D:\Learn\MatlabCode\Material manufacturing and technology\cailiao1.png'); % Indentation image acquired
A1 = rgb2gray(A); 
figure
imshow(A1);
threshold=graythresh(A1); 
B = im2bw(A1,threshold); % Separate the indentation from the background with the im2bw function in MATLAB
figure
imshow(B);
C = edge(B,'sobel',(graythresh(A1)*.1));
% Use strel function and imdilate function to expand the edge to fill the gaps in the edge
I = strel('line',3,90); 
H = strel('line',3,0);
D = imdilate(C,[I H]);
E = imfill(D,'holes'); % Here the imfill function is used to fill these gaps
figure
imshow(C);
area = bwarea(E);
% Here we find the diameter of the indentation, and then convert the diameter calculated in the figure to the unit we want.
d = sqrt(4*area/pi)/100;
P = 1514.65;
D = 5;
HBN = 2*P/(pi*D*(D-sqrt(D^2-d^2)));
fprintf('The Brinell Hardness Number is %f\n',HBN);

%https://wenku.baidu.com/view/50dd30c56137ee06eff918d0.html

我们需要先读取图片,然后将图片进行灰度处理,再进行边缘化和二值化处理,最后读出半径,带入施加的力后可以计算出来布氏硬度。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值