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
2 个评论
by which method you have found dent?
@Samadhan Kshirsagar, he gave the code below in his answer:
Did you scroll down and see it?
采纳的回答
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 个评论
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
2014-9-15
编辑:Image Analyst
2014-9-15
My Matlab version is 7.10.0.499(2010a).
Please upgrade. What happens when you say "which bwconvhull"?
更多回答(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

类别
在 帮助中心 和 File Exchange 中查找有关 Deep Learning Toolbox 的更多信息
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
