Code covered by the BSD License  

Highlights from
Dent Detection in a vehicle after collision

image thumbnail

Dent Detection in a vehicle after collision

by

 

10 Sep 2011 (Updated )

This program will find the dent in a vehicle after collision has occurred.

finddent(F1,F2)
%Program to find the dent in a vehicle after a collision has occured
% F1 - This is a file name for original image of the vehicle(without dent)
% F2 - This is a file name for the image with dent in the vehicle
%Author : Ashutsoh
%Muzaffarpur Bihar India.
%Email: ashutosh87@gmail.com

function [X] = finddent(F1,F2)
% This is Ashu
feature accel on
profile on, profile clear
%F1=input('Enter the file name for original picture of vehicle: ');
%F2=input('Enter the file name for picture of the vehicle with dent: ');
%a=imread('voltconcept-600 original.jpg');
%b=imread('voltconcept-600 original - Copy.jpg');
a=imread(F1);
b=imread(F2);
c=imabsdiff(a,b);
d=rgb2gray(c);
[r1 c1]=size(d);
b=imread(F2);
for i=1:r1
    for k=1:c1 
        if d(i,k)<=10
            e(i,k)=0;
        else
            e(i,k)=255;
        end
    end
end
bw2=im2bw(e);
bwfill=imfill(bw2,'holes');
boundary=bwboundaries(bwfill);
imshow(b)
hold on;
[row1,dim]=size(boundary);
 for k=1:row1
x1=boundary{k};
h=plot(x1(:,2),x1(:,1),'g','LineWidth',1);
 end
saveas(gcf,'dent_detection','jpg');
X=imread('dent_detection','jpg');
profile report
 

Contact us