I have problem for detection for surface ceramics image, how i can detect crack surface , pls give me some advice. this my code for detect crack surface
function [img1_array, img2_array,img3_array, img4_array,Zme]= DefectScan(input_path,input_path2);
% clear all;
% close all;
I = imread(input_path2);
J = imread(input_path);
I = rgb2gray(I);
J = rgb2gray(J);
% f=figure,imshow(I);
% g=figure,imshow(J);
hy = fspecial('sobel');
hx = hy';
Iy = imfilter(double(I), hy, 'replicate');
Ix = imfilter(double(I), hx, 'replicate');
ey = fspecial('sobel');
fx = ey';
Jy = imfilter(double(J), ey, 'replicate');
Jx = imfilter(double(J), fx, 'replicate');
gradmag = sqrt(Ix.^2 + Iy.^2);
gradmag2 = sqrt(Jx.^2 + Jy.^2);
K=figure,imshow(gradmag,[]);
L=figure,imshow(gradmag2,[]);
set(K, 'visible','off');
set(L, 'visible','off');
filename = 'temp_file.jpg'
filename2 = 'temp_file2.jpg'
saveas(K, filename)
saveas(L, filename2)
i1 = imread(filename)
i2 = imread(filename2)
delete(filename)
delete(filename2)
[x, y, rgb] = ind2sub([size(i1,1) size(i1,2) size(i1,3)], find(i1 ~= 255));
A = i1(min(x):max(x)-1,min(y):max(y)-1,:);
[x, y, rgb] = ind2sub([size(i2,1) size(i2,2) size(i2,3)], find(i2 ~= 255));
B = i2(min(x):max(x)-1,min(y):max(y)-1,:);
A = rgb2gray(A)
B = rgb2gray(B)
I = edge(A,'sobel')
J = edge(B,'sobel')

3 件のコメント

Anton Semechko
Anton Semechko 2012 年 6 月 13 日
Put up a sample image so people can see what you are working with. For instructions on how you can do this, see :
http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers
Walter Roberson
Walter Roberson 2012 年 6 月 16 日
"We're sorry but you do not have access to this page"
Dio Donaika
Dio Donaika 2012 年 6 月 16 日
im sory this question not for u i mean for all, i really sory

サインインしてコメントする。

回答 (5 件)

Dio Donaika
Dio Donaika 2012 年 6 月 16 日

0 投票

this link picture : http://i1164.photobucket.com/albums/q570/diodonaika/1.jpg my code just detect pinhole like this http://i1164.photobucket.com/albums/q570/diodonaika/0674.jpg i want to detect crack from tile, need for help ...

5 件のコメント

Walter Roberson
Walter Roberson 2012 年 6 月 16 日
When I look at your 1.jpg I cannot see any pinholes or cracks myself ? I do see lines in the image, but those have the appearance of being just part of the texture. Are all of the lines cracks ?
Dio Donaika
Dio Donaika 2012 年 6 月 16 日
its not crack but ceramic pattern , maybe this picture more clearly http://i1164.photobucket.com/albums/q570/diodonaika/2.jpg
Image Analyst
Image Analyst 2012 年 6 月 16 日
No, not really. I'd give the same answer as Walter did for 1.jpg.
Walter Roberson
Walter Roberson 2012 年 6 月 16 日
I see some slanted lines that are fairly straight, but those look to me like scratches rather than cracks.
I see a number of areas that are raised, but possibly the places that appear lower are instead filled with something that is optically transparent and the tile overall has a flat surface.
Could you perhaps post the images 1 and 2 again, with cracks pointed out with marks?
Dio Donaika
Dio Donaika 2012 年 7 月 22 日
Im soory to late, because i just have the data from my senior this image crack http://i1164.photobucket.com/albums/q570/diodonaika/diodo.jpg and i have done detect the crack http://i1164.photobucket.com/albums/q570/diodonaika/diodo2.jpg
this my code I = imread('diodo.jpg');
I = rgb2gray(I);
% f=figure,imshow(I);
% g=figure,imshow(J);
hy = fspecial('sobel');
hx = hy';
Iy = imfilter(double(I), hy, 'replicate');
Ix = imfilter(double(I), hx, 'replicate');
gradmag = sqrt(Ix.^2 + Iy.^2);
K=figure,imshow(gradmag,[]);
set(K, 'visible','on');
filename = 'temp_file.jpg'
saveas(K, filename)
i1 = imread(filename)
delete(filename)
[x, y, rgb] = ind2sub([size(i1,1) size(i1,2) size(i1,3)], find(i1 ~= 255));
A = i1(min(x):max(x)-1,min(y):max(y)-1,:);
A = rgb2gray(A)
I = edge(A,'sobel')
%934 742
I = imcrop(I,[10 7 914 728]);
I = imresize(I, [2000 2500])
f=figure,imshow(I);
set(f, 'visible','on');
imwrite(I, filename)
bw = imread(filename)
delete(filename)
bw = im2bw(bw, graythresh(bw))
bw = bwareaopen(bw,65);
set(f, 'visible','on');
f, imshow(bw)
What do i do next to calculate crack in centimeter ? please help me

サインインしてコメントする。

Image Analyst
Image Analyst 2012 年 7 月 22 日

0 投票

"What do i do next to calculate crack in centimeter ?" Well, what is the size of your field of view in cm? Let's say it's 30 cm and your image width is 1000 pixels. Then your calibration factor is 30/1000 cm per linear pixel, or 30^2/1000^2 cm^2 per pixel area. So just multiply your pixel lengths or areas by those factors to get the results in cm or cm^2.

8 件のコメント

Dio Donaika
Dio Donaika 2012 年 7 月 22 日
編集済み: Dio Donaika 2012 年 7 月 22 日
how i can get pixel lenght or areas by those factor. what is in my code. can you explain with code matlab, im newbie matlab , sorry can u help with code thanks for u attention
Image Analyst
Image Analyst 2012 年 7 月 22 日
Use regionprops() on the binary image you showed. See my BlobsDemo for an example: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
Dio Donaika
Dio Donaika 2012 年 7 月 22 日
oke i will try, use labeling for my image
Dio Donaika
Dio Donaika 2012 年 7 月 26 日
flowchart from my code grayscale, gradient magnitude, and sobel. I think there's a method that should be added, but i dont know what, plese help ?
Image Analyst
Image Analyst 2012 年 7 月 27 日
I think you need to add blocks to your flowchart, like "connected components labeling" (bwlabel) and "feature extraction" (or whatever you want to call the use of the regionprops() function), like I already told you above, and show you in BlobsDemo.
Dio Donaika
Dio Donaika 2012 年 7 月 28 日
oke i will try, thanks so much image analyst
Dio Donaika
Dio Donaika 2012 年 8 月 27 日
is there another way to detect defects in the image that I have. My method was rejected by the faculty, can you help me what I should do in order to identify the image
Dio Donaika
Dio Donaika 2012 年 8 月 27 日
for k = 1:length(B)
boundary = B{k};
plot(boundary(:,2), boundary(:,1), 'black', 'LineWidth', 1)
end
stats = regionprops(L,'Perimeter', 'MajorAxisLength','EquivDiameter', 'Area');
I have followed the commands you give, but my college teacher does not allow to use it because it had previously been used by senior. please help me.im confused to ask to whom

サインインしてコメントする。

Sarhat
Sarhat 2012 年 11 月 29 日

0 投票

Hello
I have used your algorithm for Crack detection in the pavement but doesn't helped. I have made an algorithm for detection of crack based on sobel edge detection. the problem, there are lots of false positive which I want to remove and only remain the edges belong to cracks.
Regards

1 件のコメント

Image Analyst
Image Analyst 2012 年 11 月 29 日
I don't see a question. If you have a question on MATLAB programming, you can start your own thread. But we give a lot more help on MATLAB programming and some, but not so much, on algorithm development.

サインインしてコメントする。

vijendra sn
vijendra sn 2014 年 8 月 12 日

0 投票

Hi Dio,
I am using your code for my project work. I am not able identify the dent in the image which i have attached. Please can u help out in this regards

10 件のコメント

Image Analyst
Image Analyst 2014 年 8 月 12 日
That code is not appropriate for dents. And, an optical image like that is not good for dents anyway. You need a profilometer image, not just a regular optical camera snapshot.
vijendra sn
vijendra sn 2014 年 8 月 12 日
thanks for ur reply...
but for other images i can find dents
Image Analyst
Image Analyst 2014 年 8 月 12 日
編集済み: Image Analyst 2014 年 8 月 12 日
That's nice. Post your own new thread if you need help. Show images that work and don't work.
vijendra sn
vijendra sn 2014 年 8 月 12 日
y not on this image?
Image Analyst
Image Analyst 2014 年 8 月 12 日
Because they're not profilometer images and you can't get depth from optical images. Plus there's a lot of clutter in the image. And the Crystal Ball Toolbox has not been released yet.
vijendra sn
vijendra sn 2014 年 8 月 12 日
But i don't need to find depth of the image just i need to find dent in the image
Image Analyst
Image Analyst 2014 年 8 月 12 日
Should have posted your own question like I asked and I would have answered. I'll check again in the morning for it.
Krishna
Krishna 2016 年 7 月 7 日
Hi Image analyst, Even I am trying to use this code to find the crack length in this image. Can you please help me with it asap, I am unable to get the proper output.
Krishna
Krishna 2016 年 7 月 7 日
Here is the image

サインインしてコメントする。

Preetham Manjunatha
Preetham Manjunatha 2024 年 12 月 19 日
編集済み: Preetham Manjunatha 2025 年 5 月 16 日

0 投票

Here is the MATLAB Crack segmentation and Crack width, length and area estimation codes to calculate/estimate the crack area, width and length. In addition, this package assumes the crack is segmented either using morphological method or multiscale gradient-based or deep learning semantic segmentation methods. This package estimates the crack area, width and length (pixel scale can be provided to estimate these physical quantities). Lastly, the semantic segmentation and object detection metrics for the cracks can be found using Cracks binary class bounding box and segmentation metrics package.

カテゴリ

ヘルプ センター および File ExchangeRead, Write, and Modify Image についてさらに検索

質問済み:

2012 年 6 月 13 日

編集済み:

2025 年 5 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by