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;
}







-1















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










share|improve this question





























    -1















    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










    share|improve this question

























      -1












      -1








      -1








      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










      share|improve this question














      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 3 at 13:11









      nfc yoklamanfc yoklama

      1




      1
























          1 Answer
          1






          active

          oldest

          votes


















          0














          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:



          enter image description here



          # 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()





          share|improve this answer
























            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
            });


            }
            });














            draft saved

            draft discarded


















            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









            0














            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:



            enter image description here



            # 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()





            share|improve this answer




























              0














              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:



              enter image description here



              # 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()





              share|improve this answer


























                0












                0








                0







                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:



                enter image description here



                # 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()





                share|improve this answer













                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:



                enter image description here



                # 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()






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 3 at 15:07









                J.D.J.D.

                1,307229




                1,307229
































                    draft saved

                    draft discarded




















































                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    MongoDB - Not Authorized To Execute Command

                    Npm cannot find a required file even through it is in the searched directory

                    in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith