Crack Detection Matlab Code For Finite
18.08.2019
63 - Comments
- Matlab code for bone fracture detection. Important.!About matlab code for bone fracture detection is Not Asked Yet?. Please ASK FOR matlab code for bone fracture detection BY CLICK HERE.
- What is the MATLAB code for crack detection in. Learn more about algorithm for crack detection.
- Matlab Code For Gaussian Elimination
- Matlab Code For Newton's Method
- Crack Detection Matlab Code For Finite Element
%%%%%EDGE DETECTION BY SOBEL METHOD%%%%%
close all;
clc;
img=imread('a.jpg');
B=rgb2gray(img);
subplot(2,2,1)
imshow(B)
pause(2)
I=double(B);
for i=1:size(I,1)-2
for j=1:size(I,2)-2
%Sobel mask for x-direction:
mx=((2*I(i+2,j+1)+I(i+2,j)+I(i+2,j+2))-(2*I(i,j+1)+I(i,j)+I(i,j+2)));
%Sobel mask for y-direction:
my=((2*I(i+1,j+2)+I(i,j+2)+I(i+2,j+2))-(2*I(i+1,j)+I(i,j)+I(i+2,j)));
B(i,j)=sqrt(mx.^2+my.^2);
end
end
subplot(2,2,2)
imshow(B); title('Sobel gradient');
pause(2)
%Define a threshold value
Thresh=100;
B=max(B,Thresh);
B(Bround(Thresh))=0;
B=uint8(B);
subplot(2,2,3)
imshow(~B);title('Edge detected Image');
12 Comments
on 9 Apr 2015
Results are verified with Fushen Liu and Ronaldo I. Download crack autocad civil 3d 2013 32 bit. Borja, “A contact algorithm for frictional crack propagation with the extended finite element method”, INTERNATIONAL JOURNAL FOR NUMERICAL METHODS IN ENGINEERING. 2D XFEM for Crack eXtended finite element MATLAB code 3D Truss elements finite element MATLAB code.
Thanks for your blob demo, helped alot! In line with your example I have started to tweak my code as below and would like to ask the following questions before.
i) Is thebwlabel function labelling ALL 4-5 cracks in the image under one label? if yes how do I make sure it labels each crack separately?
ii) the area returned from regionprop function is it for ALL 4-5 cracks in image? if yes how do get the area for each crack separately?
iii) thebwboundaries function returns 34 boundaries how do plot these boundaries such that the edges of each crack is highlighted.
iv) finally based on all these can you clarify me on how to determine the length of each crack (4-5 as shown in the sample image)? It was not clear from your example.
I=imread('two.jpg');
figure,imshow(Igray)
%% Binarize
binaryImage = im2bw(Igray, level);
title('Binarized image')
labeledImage = bwlabel(binaryImage);
%% Boundaries
numberOfBoundaries = size(boundaries, 1);
on 9 Apr 2015
No, they're all separate. measurements is an array of structures. Each structure represents one blob. The fields of the structure are whatever you measure, like area, perimeter, etc.
on 10 Apr 2015
Okay, thanks. I see the problem in my code. When I convert the image 'two.jpg' image to binary the cracks in are shown in black as background, while the surface of the steel is taken as foreground white. Thus the label and regionprop function returns only 'one' label and field respectively. How can I fix this pls?
I think with this fixed I can apply bwboundaries function to find which two boundaries are the farthest for each label (each crack) right?
on 10 Apr 2015
YES! I have managed to label and plot out each crack and also get its boundaries and area. see code below:
figure,imshow(I)
level = 0.599;
figure,imshow(binaryImage)
binaryImage2=zeros(row,col);
Matlab Code For Gaussian Elimination
for j=1:col
binaryImage2(i,j)=1;
binaryImage2(i,j)=0;
Matlab Code For Newton's Method
end
figure,imshow(binaryImage2)
figure,imshow(binaryImage2)
figure,imshow(binaryImage2)
binaryImage2 = bwareaopen(binaryImage2, round(0.001*numel(binaryImage2)));
number_of_labeles = max(max(labeledImage))
for i= 1:number_of_labeles
figure, imshow(Im)
numberOfBoundaries = size(boundaries, 1);
I would like to know if I can apply farthest boundaries points demo on each label to determine the length of each crack???? Thanks alot!
on 10 Apr 2015
This code is not very efficient and you could cut out a few steps (inverse and clean). However when I tried to run it on the image your originally attached, two.jpg, it didn't seem to work at all. Please attach 'GCC4.jpg' so I can improve your code.
on 11 Apr 2015
Right, In Binarize section the value of level is not same for 'two.jpg'.
binaryImage = im2bw(Igray,level);
GCC4.jpg is attached
Thanks!
on 13 Apr 2015
Well that looks completely different and would require a different algorithm. Your first image could probably be segmented fairly well with a global threshold. Maybe try adapthisteq() on this to even out the slow undulations and give a flatter image which you can then use a global threshold on.
on 14 Apr 2015
Like you said the first image is straight forward with global threshold.
However the second is not well segmented even with the adapthisteq() function.
Crack Detection Matlab Code For Finite Element
Is there a Variable or optimum global thresholding function? and can I use it here?
Else I will stick to selecting graythresh level by trial and error for now (if no simple way out), with that, what are the improvements you offered the code?
on 14 Apr 2015
See my interactive thresholding app:http://www.mathworks.com/matlabcentral/fileexchange/29372-thresholding-an-image
If it doesn't work well after adapthisteq(), then you're going to have to develop a much more sophisticated algorithm. It looks like if you improved this lighting, camera, and focus that you could get a much better image to start with.
on 8 Nov 2018
I went through your code and couldn't understand the distance measurement. if possible, could you let me know the algorithm.
on 8 Nov 2018
I have no idea what algorithm or program you're talking about. There has been lots of code segments posted here. Please be specific.
on 7 Feb 2019
I have tried your code 'farthest_points.m' . how can I choose another image other than you have set?
Sign in to comment.