How to detect pipeline crack using Opencv and Python?
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()
This 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.
opencv image-processing computer-vision
add a comment |
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()
This 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.
opencv image-processing computer-vision
This question would fit better on dsp.stackexchange.com
– Georgy
Nov 22 '18 at 10:49
1
can you show more examples of crack and pipes? We need to know how the pipe should look under normal conditions and what kind of crack can we expect from the image. Where else can the crack appear? Do we need to detect crack far away from the robot or only cracks around the robot?
– yapws87
Nov 22 '18 at 11:50
In addition to the comment from @yapws87 : It probably would go a long way, if there is a chance to get a good flatfield or better set of flatfields which would compensate for the differences in lightening over the image area. Working on appropriately reduced images usually is considerably easier. Can we always ignore the central area which here is sort-of marked by the connection(?) to the next pipe element?
– planetmaker
Nov 22 '18 at 11:52
@yapws87, currently i have only one crack for testing which is shown at the image above. I will create more soon. The pipe color is gray but i wished i could get white one but due to size i did not get around my place. The crack can appear anywhere on the pipe. Yes the nearer cracks from the camera are to be detected.
– Ibrahim
Nov 22 '18 at 12:28
@planetmaker, yes ignoring the center region will be good since the pipe joints get detected. If there is a way to find crack contours close the boundary of the image and ignore the center part it will be better
– Ibrahim
Nov 22 '18 at 12:31
add a comment |
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()
This 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.
opencv image-processing computer-vision
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()
This 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.
opencv image-processing computer-vision
opencv image-processing computer-vision
asked Nov 22 '18 at 10:41
Ibrahim Ibrahim
3610
3610
This question would fit better on dsp.stackexchange.com
– Georgy
Nov 22 '18 at 10:49
1
can you show more examples of crack and pipes? We need to know how the pipe should look under normal conditions and what kind of crack can we expect from the image. Where else can the crack appear? Do we need to detect crack far away from the robot or only cracks around the robot?
– yapws87
Nov 22 '18 at 11:50
In addition to the comment from @yapws87 : It probably would go a long way, if there is a chance to get a good flatfield or better set of flatfields which would compensate for the differences in lightening over the image area. Working on appropriately reduced images usually is considerably easier. Can we always ignore the central area which here is sort-of marked by the connection(?) to the next pipe element?
– planetmaker
Nov 22 '18 at 11:52
@yapws87, currently i have only one crack for testing which is shown at the image above. I will create more soon. The pipe color is gray but i wished i could get white one but due to size i did not get around my place. The crack can appear anywhere on the pipe. Yes the nearer cracks from the camera are to be detected.
– Ibrahim
Nov 22 '18 at 12:28
@planetmaker, yes ignoring the center region will be good since the pipe joints get detected. If there is a way to find crack contours close the boundary of the image and ignore the center part it will be better
– Ibrahim
Nov 22 '18 at 12:31
add a comment |
This question would fit better on dsp.stackexchange.com
– Georgy
Nov 22 '18 at 10:49
1
can you show more examples of crack and pipes? We need to know how the pipe should look under normal conditions and what kind of crack can we expect from the image. Where else can the crack appear? Do we need to detect crack far away from the robot or only cracks around the robot?
– yapws87
Nov 22 '18 at 11:50
In addition to the comment from @yapws87 : It probably would go a long way, if there is a chance to get a good flatfield or better set of flatfields which would compensate for the differences in lightening over the image area. Working on appropriately reduced images usually is considerably easier. Can we always ignore the central area which here is sort-of marked by the connection(?) to the next pipe element?
– planetmaker
Nov 22 '18 at 11:52
@yapws87, currently i have only one crack for testing which is shown at the image above. I will create more soon. The pipe color is gray but i wished i could get white one but due to size i did not get around my place. The crack can appear anywhere on the pipe. Yes the nearer cracks from the camera are to be detected.
– Ibrahim
Nov 22 '18 at 12:28
@planetmaker, yes ignoring the center region will be good since the pipe joints get detected. If there is a way to find crack contours close the boundary of the image and ignore the center part it will be better
– Ibrahim
Nov 22 '18 at 12:31
This question would fit better on dsp.stackexchange.com
– Georgy
Nov 22 '18 at 10:49
This question would fit better on dsp.stackexchange.com
– Georgy
Nov 22 '18 at 10:49
1
1
can you show more examples of crack and pipes? We need to know how the pipe should look under normal conditions and what kind of crack can we expect from the image. Where else can the crack appear? Do we need to detect crack far away from the robot or only cracks around the robot?
– yapws87
Nov 22 '18 at 11:50
can you show more examples of crack and pipes? We need to know how the pipe should look under normal conditions and what kind of crack can we expect from the image. Where else can the crack appear? Do we need to detect crack far away from the robot or only cracks around the robot?
– yapws87
Nov 22 '18 at 11:50
In addition to the comment from @yapws87 : It probably would go a long way, if there is a chance to get a good flatfield or better set of flatfields which would compensate for the differences in lightening over the image area. Working on appropriately reduced images usually is considerably easier. Can we always ignore the central area which here is sort-of marked by the connection(?) to the next pipe element?
– planetmaker
Nov 22 '18 at 11:52
In addition to the comment from @yapws87 : It probably would go a long way, if there is a chance to get a good flatfield or better set of flatfields which would compensate for the differences in lightening over the image area. Working on appropriately reduced images usually is considerably easier. Can we always ignore the central area which here is sort-of marked by the connection(?) to the next pipe element?
– planetmaker
Nov 22 '18 at 11:52
@yapws87, currently i have only one crack for testing which is shown at the image above. I will create more soon. The pipe color is gray but i wished i could get white one but due to size i did not get around my place. The crack can appear anywhere on the pipe. Yes the nearer cracks from the camera are to be detected.
– Ibrahim
Nov 22 '18 at 12:28
@yapws87, currently i have only one crack for testing which is shown at the image above. I will create more soon. The pipe color is gray but i wished i could get white one but due to size i did not get around my place. The crack can appear anywhere on the pipe. Yes the nearer cracks from the camera are to be detected.
– Ibrahim
Nov 22 '18 at 12:28
@planetmaker, yes ignoring the center region will be good since the pipe joints get detected. If there is a way to find crack contours close the boundary of the image and ignore the center part it will be better
– Ibrahim
Nov 22 '18 at 12:31
@planetmaker, yes ignoring the center region will be good since the pipe joints get detected. If there is a way to find crack contours close the boundary of the image and ignore the center part it will be better
– Ibrahim
Nov 22 '18 at 12:31
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53429103%2fhow-to-detect-pipeline-crack-using-opencv-and-python%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53429103%2fhow-to-detect-pipeline-crack-using-opencv-and-python%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
This question would fit better on dsp.stackexchange.com
– Georgy
Nov 22 '18 at 10:49
1
can you show more examples of crack and pipes? We need to know how the pipe should look under normal conditions and what kind of crack can we expect from the image. Where else can the crack appear? Do we need to detect crack far away from the robot or only cracks around the robot?
– yapws87
Nov 22 '18 at 11:50
In addition to the comment from @yapws87 : It probably would go a long way, if there is a chance to get a good flatfield or better set of flatfields which would compensate for the differences in lightening over the image area. Working on appropriately reduced images usually is considerably easier. Can we always ignore the central area which here is sort-of marked by the connection(?) to the next pipe element?
– planetmaker
Nov 22 '18 at 11:52
@yapws87, currently i have only one crack for testing which is shown at the image above. I will create more soon. The pipe color is gray but i wished i could get white one but due to size i did not get around my place. The crack can appear anywhere on the pipe. Yes the nearer cracks from the camera are to be detected.
– Ibrahim
Nov 22 '18 at 12:28
@planetmaker, yes ignoring the center region will be good since the pipe joints get detected. If there is a way to find crack contours close the boundary of the image and ignore the center part it will be better
– Ibrahim
Nov 22 '18 at 12:31