How could I calculate leaf area in R starting from a picture taken knowing pixel resolution, focal length and...












0















I am looking for an automated way to measure leaf area from a picture taken by a general camera. I would like to use my phone camera since it would make the job easier. I can use ImageJ but I believe there could be a faster way to do it.



So far I know the following features:




  • pixel resolution ( 3042 x 4032 )

  • focal length of the camera ( 26 mm equivalent )

  • camera sensor ( 7.01 mm x 5.79 mm )

  • height of camera ( 25 cm )


I'm asking for R because I have been working on it for a while and I wouldn't change software.
I tried some packages such as EBIimage and magick but I didn't go that far. I can load a picture but I cannot work out any calculation from number of pixel.



Anyone ever tried to do something similar in R?



Please comments and answers would be very appreciated.



Thank you.










share|improve this question

























  • Please provide a minimal reproducible example.

    – Christoph
    Nov 21 '18 at 19:42
















0















I am looking for an automated way to measure leaf area from a picture taken by a general camera. I would like to use my phone camera since it would make the job easier. I can use ImageJ but I believe there could be a faster way to do it.



So far I know the following features:




  • pixel resolution ( 3042 x 4032 )

  • focal length of the camera ( 26 mm equivalent )

  • camera sensor ( 7.01 mm x 5.79 mm )

  • height of camera ( 25 cm )


I'm asking for R because I have been working on it for a while and I wouldn't change software.
I tried some packages such as EBIimage and magick but I didn't go that far. I can load a picture but I cannot work out any calculation from number of pixel.



Anyone ever tried to do something similar in R?



Please comments and answers would be very appreciated.



Thank you.










share|improve this question

























  • Please provide a minimal reproducible example.

    – Christoph
    Nov 21 '18 at 19:42














0












0








0


1






I am looking for an automated way to measure leaf area from a picture taken by a general camera. I would like to use my phone camera since it would make the job easier. I can use ImageJ but I believe there could be a faster way to do it.



So far I know the following features:




  • pixel resolution ( 3042 x 4032 )

  • focal length of the camera ( 26 mm equivalent )

  • camera sensor ( 7.01 mm x 5.79 mm )

  • height of camera ( 25 cm )


I'm asking for R because I have been working on it for a while and I wouldn't change software.
I tried some packages such as EBIimage and magick but I didn't go that far. I can load a picture but I cannot work out any calculation from number of pixel.



Anyone ever tried to do something similar in R?



Please comments and answers would be very appreciated.



Thank you.










share|improve this question
















I am looking for an automated way to measure leaf area from a picture taken by a general camera. I would like to use my phone camera since it would make the job easier. I can use ImageJ but I believe there could be a faster way to do it.



So far I know the following features:




  • pixel resolution ( 3042 x 4032 )

  • focal length of the camera ( 26 mm equivalent )

  • camera sensor ( 7.01 mm x 5.79 mm )

  • height of camera ( 25 cm )


I'm asking for R because I have been working on it for a while and I wouldn't change software.
I tried some packages such as EBIimage and magick but I didn't go that far. I can load a picture but I cannot work out any calculation from number of pixel.



Anyone ever tried to do something similar in R?



Please comments and answers would be very appreciated.



Thank you.







r image-processing area






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 3 '18 at 13:54









Caleb Kleveter

7,46284068




7,46284068










asked Nov 21 '18 at 19:34









GianmarcoGianmarco

1




1













  • Please provide a minimal reproducible example.

    – Christoph
    Nov 21 '18 at 19:42



















  • Please provide a minimal reproducible example.

    – Christoph
    Nov 21 '18 at 19:42

















Please provide a minimal reproducible example.

– Christoph
Nov 21 '18 at 19:42





Please provide a minimal reproducible example.

– Christoph
Nov 21 '18 at 19:42












1 Answer
1






active

oldest

votes


















0














Use calibrators.




  1. Take three (or more) sheets of paper with different area.

  2. Then take pictures of the sheets at the same distance (25 cm)*.

  3. Calculate the pixel area of each sheet.

  4. Divide metric area by pixel area of each sheet. Let's call this number k.

  5. Calculate the average k.

  6. Calculate the metric area of the leaf by using this formula: metric_area = k * pixel_area.


*You can also use calibrators for different distances from the leaf. That's a bit more complicated, but probably more precise than calculating.



Be aware that lens with focal length of 26mm will have some distortion on the edges of the image. You would be better off if you used 50 mm or more lens. Otherwise, always center the leaf on the image and leave some space around the leaf.



That's how I would do it. I would use Python and scikit-image instead of R, I find it easier and better documented for image analysis.






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%2f53419350%2fhow-could-i-calculate-leaf-area-in-r-starting-from-a-picture-taken-knowing-pixel%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














    Use calibrators.




    1. Take three (or more) sheets of paper with different area.

    2. Then take pictures of the sheets at the same distance (25 cm)*.

    3. Calculate the pixel area of each sheet.

    4. Divide metric area by pixel area of each sheet. Let's call this number k.

    5. Calculate the average k.

    6. Calculate the metric area of the leaf by using this formula: metric_area = k * pixel_area.


    *You can also use calibrators for different distances from the leaf. That's a bit more complicated, but probably more precise than calculating.



    Be aware that lens with focal length of 26mm will have some distortion on the edges of the image. You would be better off if you used 50 mm or more lens. Otherwise, always center the leaf on the image and leave some space around the leaf.



    That's how I would do it. I would use Python and scikit-image instead of R, I find it easier and better documented for image analysis.






    share|improve this answer




























      0














      Use calibrators.




      1. Take three (or more) sheets of paper with different area.

      2. Then take pictures of the sheets at the same distance (25 cm)*.

      3. Calculate the pixel area of each sheet.

      4. Divide metric area by pixel area of each sheet. Let's call this number k.

      5. Calculate the average k.

      6. Calculate the metric area of the leaf by using this formula: metric_area = k * pixel_area.


      *You can also use calibrators for different distances from the leaf. That's a bit more complicated, but probably more precise than calculating.



      Be aware that lens with focal length of 26mm will have some distortion on the edges of the image. You would be better off if you used 50 mm or more lens. Otherwise, always center the leaf on the image and leave some space around the leaf.



      That's how I would do it. I would use Python and scikit-image instead of R, I find it easier and better documented for image analysis.






      share|improve this answer


























        0












        0








        0







        Use calibrators.




        1. Take three (or more) sheets of paper with different area.

        2. Then take pictures of the sheets at the same distance (25 cm)*.

        3. Calculate the pixel area of each sheet.

        4. Divide metric area by pixel area of each sheet. Let's call this number k.

        5. Calculate the average k.

        6. Calculate the metric area of the leaf by using this formula: metric_area = k * pixel_area.


        *You can also use calibrators for different distances from the leaf. That's a bit more complicated, but probably more precise than calculating.



        Be aware that lens with focal length of 26mm will have some distortion on the edges of the image. You would be better off if you used 50 mm or more lens. Otherwise, always center the leaf on the image and leave some space around the leaf.



        That's how I would do it. I would use Python and scikit-image instead of R, I find it easier and better documented for image analysis.






        share|improve this answer













        Use calibrators.




        1. Take three (or more) sheets of paper with different area.

        2. Then take pictures of the sheets at the same distance (25 cm)*.

        3. Calculate the pixel area of each sheet.

        4. Divide metric area by pixel area of each sheet. Let's call this number k.

        5. Calculate the average k.

        6. Calculate the metric area of the leaf by using this formula: metric_area = k * pixel_area.


        *You can also use calibrators for different distances from the leaf. That's a bit more complicated, but probably more precise than calculating.



        Be aware that lens with focal length of 26mm will have some distortion on the edges of the image. You would be better off if you used 50 mm or more lens. Otherwise, always center the leaf on the image and leave some space around the leaf.



        That's how I would do it. I would use Python and scikit-image instead of R, I find it easier and better documented for image analysis.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 21 '18 at 20:21









        Tilen KTilen K

        462




        462
































            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%2f53419350%2fhow-could-i-calculate-leaf-area-in-r-starting-from-a-picture-taken-knowing-pixel%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

            "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

            Alcedinidae

            RAC Tourist Trophy