Process an area by trapezoid shape in image processing

Hi everybody
I'm trying to extract cracks from asphalt image. camera angle makes me to process an area by trapezoid shape as road surface. but as i said, i need to extract crack which is a linear object. Then when i use an algorithm for extracting linear objects, the border of trapezoid would be recognized as crack too. when i use grayscale properties of pixels such as thresholding, because of color of asphalt, detecting crack wouldn't go well.
I need your help for doing process on trapzoid area or any other guidness for detecting this crack.
Thanks.

6 Comments

If you are sure the crack detection would work on a rectangular image, why not use a keystone correction to make your image rectangular?
Also, I have my doubts if the color of the asphalt would actually make the crack detection hard. You would just have to come up with a way to detect a difference with the background. I suspect the white line is actually more of a problem, since it changes the background color.
"...the border of trapezoid would be recognized as crack too."
In addition to Rik's advice, if your algorithm is correctly identifying the crack as well as other linear edes, wouldn't it be relatively easy to identify which edges are linear and remove them thereby isolating the crack?
Comment posted as flag by mohammadreza pourebrahimi:
Thank you for guidance. White line can be removed at binary image and wouldn't assume as a problem, would you please say about the features which makes different between crack and background. Also I tried too use KeystoneCorrector that seems well for this problem, but I couldn't find source of it. there are some that doesn't work.
If you are looking for the source of the app posted on the FEX: contact the author. I asked politely and explained what I wanted to use it for, after which he sent me the code. That was back in March 2017, so you would have to see if he is still using the same email address.
Before you ask: since it isn't my code I don't feel comfortable forwarding the code to you. Looking at the code itself, it looks like it is simply using interp2 to resample the image.
Hi mohammadreza,
flags are intended for inappropriate comments, duplicated questions and so forth, which is not what is happening here. It would be prefererable if you were to delete the flags from the comments.
I'm amature here. Thank you for explaining about flag. I will use it in appropriate way.

Sign in to comment.

Answers (1)

It is a simple morphological operation to generate a binary mask for the trapezoid's interior. You can use that to eliminate false positives at the road edges.
load theRoad
A=rgb2gray(A);
roadMask=imerode(bwconvhull(imbinarize(A)),strel("disk",3));
imshowpair(edge(A), edge(A).*roadMask, "montage");

Community Treasure Hunt

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

Start Hunting!