I have developed a robot that captures images of the pipeline interior as it moves. The requirement was to be able to detect cracks inside. So far i tried several OpenCV codes that find the crack contours but i was not successful.
Code I'm working on:
import cv2
import numpy as np
image = cv2.imread('pipe_photo1.jpg')
blurred = cv2.pyrMeanShiftFiltering(image,41,91)
gray = cv2.cvtColor(blurred,cv2.COLOR_BGR2GRAY)
ret, threshold = cv2.threshold(gray,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU)
_, contours, _ = cv2.findContours(threshold, cv2.RETR_LIST, cv2.CHAIN_APPROX_NONE)
print (len(contours))
cv2.drawContours(image,contours, -1,(0,0,255),6)
cv2.namedWindow("Display",cv2.WINDOW_NORMAL)
cv2.imshow("Display",image)
cv2.waitKey()
Below is the image i obtained from the camera. I want to detect only the crack shown at the bottom of the pipe and be able to draw it using red lines. Your help will really save me in achieving my objectives before its due.