How can find area of the dent detected?

Hi, i have already found the dent in the laminates but i need find the area of the dent
please help me on this

 Accepted Answer

You forgot to attach your image. All I can suggest then is to run my Image Segmentation Tutorial: http://www.mathworks.com/matlabcentral/fileexchange/25157-image-segmentation-tutorial---blobsdemo--

12 Comments

Dent Detection in Car Bodies,
ICPR00(Vol IV: 775-778).
IEEE via DOI 0009
Structured light. BibRef
TITLE = "Dent Detection in Car Bodies",
BOOKTITLE = ICPR00,
YEAR = "2000",
PAGES = "Vol IV: 775-778",
BIBSOURCE = "http://www.visionbib.com/bibliography/applicat839.html#TT113769"}
Just call regionprops() if you've already segmented the dents
labeledImage = bwlabel(dentBinaryImage);
measurements = regionprops(labeledImage, 'Area');
allAreas = [measurements.Area]
I want to find out area in millimeter or centimeter..how to find out.
Here is my code;
A = imread('DSC_0252.jpg'); b = rgb2gray(A);
hx = fspecial('sobel'); hy = hx'; Iy = imfilter(double(b), hy, 'circular'); Ix = imfilter(double(b), hx, 'circular');
gradmag = sqrt(Ix.^2 + Iy.^2);
k=figure,imshow(gradmag,[]); set(k, 'visible','off'); 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));
C = i1(min(x):max(x)-1,min(y):max(y)-1,:);
C = rgb2gray(C); figure,imshow(C); I = edge(C,'sobel');
I = imcrop(I,[10 7 920 725]); I = imresize(I, [3500 3700]);
f=figure,imshow(I); set(f, 'visible','off'); imwrite(I, filename);
bw = imread(filename); delete(filename);
bw1 = bwareaopen(bw,1100); bwfill=imfill(bw1,'holes'); boundary=bwboundaries(bwfill);
figure,imshow(I),hold on;
[row1,dim]=size(boundary);
for k=1:row1 x1=boundary{k}; h=plot(x1(:,2),x1(:,1),'c','LineWidth',1); end
labeledImage = bwlabel(bw1); measurements = regionprops(labeledImage, 'Area'); allAreas = [measurements.Area]
Did you get the article yet? Are you going to?
The best method is to use profilometry to get actual topographic information. For example an instrument from GFM http://www.gfm3d.com/index.php?option=com_content&id=65%3Amikrocad&lang=en
I don't think your method is that good or robust. It depends on the size being large, so it can't measure small dents. I didn't run it but I don't see imconvhull() being called and since there is only an edge on one side of the dent, the side with the ramp won't be included. Keep working on it though. As you can imagine once you have a robust program it will probably be hundreds if not thousands of lines long.
I don't know how to use imconvhull() as i don't have image processing tool box
k=figure,imshow(gradmag,[]);
set(k, 'visible','off');
filename = 'temp_file.jpg';
saveas(k, filename);
i1 = imread(filename);
delete(filename);
In this small code, i am saving the image and reading the image again.I don't want to save and read as it takes too much time for processing. Is there any method to develop....
I don't know why you want i1 to be a screenshot. What are you going to do with a screenshot of the figure? What good is that instead of the actual image that is displayed in the figure? Get the Image Processing Toolbox. You really don't want to rewrite it yourself and there are too many useful functions in there for getting boundaries, making measurements, doing size filtering and connected components labeling, displaying images, etc.
Hi,
I am not getting the correct functions. can u tell me, how to code for above small code
Isn't "allAreas" the areas that you're looking for? Remember to do
bw1 = bwconvull(bw1);
like I suggested before you label the image.
i am getting error for this code:
A = imread('DSC_0977.jpg');
B = rgb2gray(A);
hx = fspecial('sobel');
hy = hx';
Iy = imfilter(double(B), hy, 'circular');
Ix = imfilter(double(B), hx, 'circular');
gradmag = sqrt(Ix.^2 + Iy.^2);
k=figure(1),imshow(gradmag,[]);
set(k, 'visible','off');
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));
C = i1(min(x):max(x)-1,min(y):max(y)-1,:);
C = rgb2gray(C);
I = edge(C,'sobel');
I = imcrop(I,[10 7 920 725]);
I = imresize(I, [3250 3700]);
f=figure(3),imshow(I);
set(f, 'visible','off');
imwrite(I, filename);
bw = imread(filename);
delete(filename);
bw1 = bwareaopen(bw,1500);
bwfill = imfill(bw1,'holes');
boundary = bwboundaries(bwfill);
figure(2),imshow(I),hold on;
[row1,dim]=size(boundary);
for k=1:row1
x1=boundary{k};
h=plot(x1(:,2),x1(:,1),'c','LineWidth',1);
end
bw1 = bwconvull(bw1);
labeledImage = bwlabel(bw1);
measurements = regionprops(labeledImage,'Area');
allAreas = [measurements.Area];
ERROR IS: Undefined function or method 'bwconvull' for input arguments of type 'logical'
Well how old is your version? bwconvhull() is several years old but if you have an antique version, then you may not have that function and should upgrade.
vijendra sn
vijendra sn on 15 Sep 2014
Edited: Image Analyst on 15 Sep 2014
My Matlab version is 7.10.0.499(2010a).
Please upgrade. What happens when you say "which bwconvhull"?

Sign in to comment.

More Answers (1)

Hi,
i used bwconvhull function...how to analyze this function but still i couldn't get how to find area of the these dent detected. There are 9 dent area detected.
How to find the area of the 1 pixel in image
close all;
clear all;
clc;
A = imread('DSC_0977.jpg');
B = rgb2gray(A);
hx = fspecial('sobel');
hy = hx';
Iy = imfilter(double(B), hy, 'circular');
Ix = imfilter(double(B), hx, 'circular');
gradmag = sqrt(Ix.^2 + Iy.^2);
k=figure(1),imshow(gradmag,[]);
set(k, 'visible','off');
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));
C = i1(min(x):max(x)-1,min(y):max(y)-1,:);
C = rgb2gray(C);
I = edge(C,'sobel');
I = imcrop(I,[10 7 920 725]);
I = imresize(I,[3250 3500]);
f=figure(3),imshow(I);
set(f, 'visible','off');
imwrite(I, filename);
bw = imread(filename);
delete(filename);
bw1 = bwareaopen(bw,750);
bwfill = imfill(bw1,'holes');
boundary = bwboundaries(bwfill);
figure(2),imshow(I),hold on;
[row1,dim]=size(boundary);
for k = 1:row1
x1= boundary{k};
h = plot(x1(:,2),x1(:,1),'c','LineWidth',1);
bw2 = bwconvhull(boundary{k});
[label,Total]=bwlabel(bw2);
measurements = regionprops(label,'Area');
allareas(k,1)= [measurements.Area];
end

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!