How to detect punctured tyre of a car in an image

3 views (last 30 days)
I have been working on the project where I need to detect punctured tyre of a car using image processing. I started with simple idea of edge detection.
  1. take an image apply edge detection
  2. if I get the proper outer circle then tyre is not punctured.I had some problem with edge detection those are
  3. every time I have to play with threshold value of edge detection operator to avoid unwanted edges .
  4. irrespective of edge detection operator or threshold rim of wheel is getting detected.
I solved second problem to some extent but results are not satisfactory. here is my code:
close all;
clear all;
clc;
I = imread('sample1.jpg');%read an image
t = graythresh(I);
BW = im2bw(I, t);
[L, num] = bwlabel(BW);% Leave just "big" components on binary image
stats = regionprops(L, 'Area', 'PixelIdxList');
area_vector = [stats(:).Area];
area_vector = sort(area_vector);
threshold_pos = floor(num * 0.98);
threshold = area_vector(threshold_pos);
for i=1:num
if(stats(i).Area < threshold)
BW(stats(i).PixelIdxList) = false;
end
end
str = strel('disk', 5);% Dilate image with a circle of small radius
BW = imdilate(BW, str);
L = bwlabel(BW);% Take component with biggest area as the circle
stats = regionprops(L, 'Area', 'BoundingBox', 'Centroid', 'EquivDiameter');
area_vector = [stats(:).Area];
[max_value, max_idx] = max(area_vector);
soi = stats(max_idx);
circle = imcrop(I, soi.BoundingBox);% Set output variable
radius = soi.EquivDiameter/2;% get the radius
I = imread('sample1.jpg');% to mask the rim part
imageSize = size(I);
ci = [449,459,radius]; % center and radius of circle ([c_row, c_col, r]),I manually calculated c_row,c_col
[xx,yy] = ndgrid((1:imageSize(1))-ci(1),(1:imageSize(2))-ci(2));
mask = uint8((xx.^2 + yy.^2)<ci(3)^2);
croppedImage = uint8(zeros(size(I)));
croppedImage(:,:,1) = I(:,:,1).*mask;
croppedImage(:,:,2) = I(:,:,2).*mask;
croppedImage(:,:,3) = I(:,:,3).*mask;
figure(1);
imshow(croppedImage);
I=rgb2gray(I);
croppedImage=rgb2gray(croppedImage);
figure(2);
imshow(edge(I,'sobel')-edge(croppedImage,'sobel'));
these are my sample inputs (both are not punctured):
with these progression how do I proceed i,e how to remove those unwanted edges? and how to find lower half of the outer circle and validate that it is not punctured? I need algorithm or piece of code to proceed , further is my method will result in faithful result? or is there any alternative way to detect punctured tyre like using training samples to classifier to distinguish between normal and punctured tyre?.Thank You.

Answers (1)

Image Analyst
Image Analyst on 30 Apr 2015
Why do you think an edge detector will be able to find a puncture. A puncture may be on the part of the tire not in view. It may not have edges any stronger than the lettering and other features on the tire. And how are you going to distinguish the tire from the under-fender part of the image? Or don't you need to? All you're trying to do is to find the area of the tire and that won't find punctures.
  2 Comments
Manjunath kg
Manjunath kg on 1 May 2015
yes you are right but which method do you suggest? as an worst case scenario even if I'm able to distinguish between completely flat tire and normal one is also fine.Thank you
Image Analyst
Image Analyst on 1 May 2015
I don't think you can find punctures at all, so I would give up on that . I think the best you can do is to try to find underinflated tires . I'd first find the bottom half of the tire and plot the radius of curvature as a function of distance along the perimeter. I think you'll find that the flat part (super high radius of curvatures) will be longer for underinflated tires than properly inflated tires. Don't you agree?

Sign in to comment.

Categories

Find more on Wheels and Tires 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!