Ask Your Question

Crack detection using OpenCV and Python

asked 2019-05-13 15:14:12 -0500

updated 2019-05-13 15:22:04 -0500

I am trying to identify cracks in different structures using OpenCV. I have used sobel edge detection to detect cracks. The images have been attached below. However, it also detects edges which add to the false positives. I want to subtract the edges and just keep the crack highlighted. The image that I am working on has a wooden panel with crack.

Original Image:

image description

Crack Detected:

image description

edit retag flag offensive close merge delete



Hi, have no quick solution but I have some idea to remove most of false positive. You can check the colour value in proximity of the crack (the "external border" of the crack), if the mean is under a threshold then the line is a crack, otherwise it will not be a crack. This will not work on multi colorued cracked object: in that case in my opinion can be a good idea combine it with disparity map (aka 2 cameras). It is possible to use the disparity to understand what is a border and what it isn't, so it gonna be more easy to distinguish crack since it gonna be a line at the same disparity more or less.

Probably there already exist something better than this, one of my colleague is working in the same thing but I think he use a trained neural network.

HYPEREGO gravatar imageHYPEREGO ( 2019-05-14 03:35:10 -0500 )edit

erosion ? dilate ? HoughLine ? Sobel ? Laplace ?

LiorA gravatar imageLiorA ( 2019-05-14 05:47:54 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2019-05-14 23:48:34 -0500

kaim gravatar image

I think you can use cv2.connectedcomponentswithstats to find the area and chuck all the unwanted parts.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-05-13 15:14:12 -0500

Seen: 164 times

Last updated: May 13