Find the object in the image
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I need to find only the tiger object in this picture by applying segmentation operations and other operations, but I don't know much about it.
enter image description here
opencv image-processing
add a comment |
I need to find only the tiger object in this picture by applying segmentation operations and other operations, but I don't know much about it.
enter image description here
opencv image-processing
add a comment |
I need to find only the tiger object in this picture by applying segmentation operations and other operations, but I don't know much about it.
enter image description here
opencv image-processing
I need to find only the tiger object in this picture by applying segmentation operations and other operations, but I don't know much about it.
enter image description here
opencv image-processing
opencv image-processing
asked Jan 3 at 13:11


nfc yoklamanfc yoklama
1
1
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Have you done any research before asking? Stack Overflow is not meant to solve your project for you. Also, in my experience openCV has a pretty steep learning curve. By someone giving you some code that does what you want you'll learn nothing. You'll learn most by trying for yourself. A lot.
With that being said, below is some code that removes background. It is very basic and specific to your image. In general it is not very good, as you can see in the result. But since your new to opencv maybe it is not too complex for you to understand.
I would encourage you to research the operations that are done in the code until you understand them. (read here, here and here) Look at the images before and after the operations to see what it does. Then, when you're up for it, you can create a better backgroundsubtractor yourself by following this tutorial or by using grabcut
Result:
# load image
img = cv2.imread("animal.jpg")
# detect edges
edges = cv2.Canny(img,100,100)
# merge edges to big blob
kernel = np.ones((10,10),np.uint8)
edges = cv2.morphologyEx(edges, cv2.MORPH_CLOSE, kernel)
# detect contour of blob
im2, contours, hierarchy = cv2.findContours(edges, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
# draw filled contour on edges-img
for cnt in contours:
cv2.drawContours(edges, [cnt], 0, (255,255,255), -1)
# uses edges-img as mask to remove background
res = cv2.bitwise_and(img,img,mask=edges)
cv2.imshow("img", res)
cv2.waitKey(0)
cv2.destroyAllWindows()
add a comment |
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%2f54022977%2ffind-the-object-in-the-image%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Have you done any research before asking? Stack Overflow is not meant to solve your project for you. Also, in my experience openCV has a pretty steep learning curve. By someone giving you some code that does what you want you'll learn nothing. You'll learn most by trying for yourself. A lot.
With that being said, below is some code that removes background. It is very basic and specific to your image. In general it is not very good, as you can see in the result. But since your new to opencv maybe it is not too complex for you to understand.
I would encourage you to research the operations that are done in the code until you understand them. (read here, here and here) Look at the images before and after the operations to see what it does. Then, when you're up for it, you can create a better backgroundsubtractor yourself by following this tutorial or by using grabcut
Result:
# load image
img = cv2.imread("animal.jpg")
# detect edges
edges = cv2.Canny(img,100,100)
# merge edges to big blob
kernel = np.ones((10,10),np.uint8)
edges = cv2.morphologyEx(edges, cv2.MORPH_CLOSE, kernel)
# detect contour of blob
im2, contours, hierarchy = cv2.findContours(edges, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
# draw filled contour on edges-img
for cnt in contours:
cv2.drawContours(edges, [cnt], 0, (255,255,255), -1)
# uses edges-img as mask to remove background
res = cv2.bitwise_and(img,img,mask=edges)
cv2.imshow("img", res)
cv2.waitKey(0)
cv2.destroyAllWindows()
add a comment |
Have you done any research before asking? Stack Overflow is not meant to solve your project for you. Also, in my experience openCV has a pretty steep learning curve. By someone giving you some code that does what you want you'll learn nothing. You'll learn most by trying for yourself. A lot.
With that being said, below is some code that removes background. It is very basic and specific to your image. In general it is not very good, as you can see in the result. But since your new to opencv maybe it is not too complex for you to understand.
I would encourage you to research the operations that are done in the code until you understand them. (read here, here and here) Look at the images before and after the operations to see what it does. Then, when you're up for it, you can create a better backgroundsubtractor yourself by following this tutorial or by using grabcut
Result:
# load image
img = cv2.imread("animal.jpg")
# detect edges
edges = cv2.Canny(img,100,100)
# merge edges to big blob
kernel = np.ones((10,10),np.uint8)
edges = cv2.morphologyEx(edges, cv2.MORPH_CLOSE, kernel)
# detect contour of blob
im2, contours, hierarchy = cv2.findContours(edges, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
# draw filled contour on edges-img
for cnt in contours:
cv2.drawContours(edges, [cnt], 0, (255,255,255), -1)
# uses edges-img as mask to remove background
res = cv2.bitwise_and(img,img,mask=edges)
cv2.imshow("img", res)
cv2.waitKey(0)
cv2.destroyAllWindows()
add a comment |
Have you done any research before asking? Stack Overflow is not meant to solve your project for you. Also, in my experience openCV has a pretty steep learning curve. By someone giving you some code that does what you want you'll learn nothing. You'll learn most by trying for yourself. A lot.
With that being said, below is some code that removes background. It is very basic and specific to your image. In general it is not very good, as you can see in the result. But since your new to opencv maybe it is not too complex for you to understand.
I would encourage you to research the operations that are done in the code until you understand them. (read here, here and here) Look at the images before and after the operations to see what it does. Then, when you're up for it, you can create a better backgroundsubtractor yourself by following this tutorial or by using grabcut
Result:
# load image
img = cv2.imread("animal.jpg")
# detect edges
edges = cv2.Canny(img,100,100)
# merge edges to big blob
kernel = np.ones((10,10),np.uint8)
edges = cv2.morphologyEx(edges, cv2.MORPH_CLOSE, kernel)
# detect contour of blob
im2, contours, hierarchy = cv2.findContours(edges, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
# draw filled contour on edges-img
for cnt in contours:
cv2.drawContours(edges, [cnt], 0, (255,255,255), -1)
# uses edges-img as mask to remove background
res = cv2.bitwise_and(img,img,mask=edges)
cv2.imshow("img", res)
cv2.waitKey(0)
cv2.destroyAllWindows()
Have you done any research before asking? Stack Overflow is not meant to solve your project for you. Also, in my experience openCV has a pretty steep learning curve. By someone giving you some code that does what you want you'll learn nothing. You'll learn most by trying for yourself. A lot.
With that being said, below is some code that removes background. It is very basic and specific to your image. In general it is not very good, as you can see in the result. But since your new to opencv maybe it is not too complex for you to understand.
I would encourage you to research the operations that are done in the code until you understand them. (read here, here and here) Look at the images before and after the operations to see what it does. Then, when you're up for it, you can create a better backgroundsubtractor yourself by following this tutorial or by using grabcut
Result:
# load image
img = cv2.imread("animal.jpg")
# detect edges
edges = cv2.Canny(img,100,100)
# merge edges to big blob
kernel = np.ones((10,10),np.uint8)
edges = cv2.morphologyEx(edges, cv2.MORPH_CLOSE, kernel)
# detect contour of blob
im2, contours, hierarchy = cv2.findContours(edges, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
# draw filled contour on edges-img
for cnt in contours:
cv2.drawContours(edges, [cnt], 0, (255,255,255), -1)
# uses edges-img as mask to remove background
res = cv2.bitwise_and(img,img,mask=edges)
cv2.imshow("img", res)
cv2.waitKey(0)
cv2.destroyAllWindows()
answered Jan 3 at 15:07
J.D.J.D.
1,307229
1,307229
add a comment |
add a comment |
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%2f54022977%2ffind-the-object-in-the-image%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