egg shape modelling

Measure egg volume and surface area

Our research into egg camouflage resulted in hundreds of egg photographs that needed cutting out from their backgrounds. I searched for a simple tool or equation that would let us do this easily, but the equations didn’t fit our eggs very well, or were difficult to solve from a few points. So I came up with a new mathematical formula that describes the shape of an egg, and can be fitted to a few anchor points. The tool fitted egg shapes so well that I developed the script to work out the surface area and volume of the eggs with a greater precision than the traditional length and breadth method. This tool is described and tested in my publication (download PDF).

Installation

  • Make sure you’ve got ImageJ (a great open source image editor).
  • Download the zip file here
  • Unzip and copy the “Egg Tools” folder into your imagej plugins folder (e.g. C:/Program Files/ImageJ/plugins for windows).
  • Restart ImageJ and the tool will be loaded.
Egg shape modelling tool - the egg's curvature can be calculated from a few points around the edge of the egg and then the egg's surface area and volume can be calculated.
Egg shape modelling tool – the egg’s curvature can be calculated from a few points around the edge of the egg and then the egg’s surface area and volume can be calculated.

Instructions

  • Photograph your egg(s) side-on with a scale-bar in the photo at the same height as the centre of the egg. Make sure there is no lens distortion (e.g. when you photograph a flat chequerboard all the lines come out straight in the photo. If you do have barrel or pincushion distortion you can correct it (e.g. with RAWTherapee or Photoshop).
  • Open the image in ImageJ, select the multi-point tool. Place a point on the tip and base of the egg, and three or more extra points around the edge on each side (8 points in total, as in the above photo).
  • Go Plugins>Egg Tools>Egg Measurement and follow the instructions, or see the video below.

Why is this useful?

The geometrical properties of eggs – such as volume and surface area – have uses ranging from ecological, physiological and morphological studies in birds, to predictions of chick condition in the poultry industry. Although measurements of an egg’s length and breadth can be used to approximate an egg’s geometry, the coefficients used in these models are specific to the original test population, and within-species variation in egg shape means these methods cannot be used reliably outside of that original test population. The mathematical formula here describes the curvature of a bird’s egg, and it can be used to calculate the shape, volume and surface area of an egg precisely from digital images. Using data from a number of species I demonstrated that the model has a greater level of accuracy than length and breadth-based methods.

 

egg equation black

How it works

The equation is essentially an ellipse that has a normal distribution added. The variable a describes the width of the ellipse, b describes where the centre of the ellipse bulge sits, and c describes how acute/pointed that bulge is.

Egg shape examples

Video walk-through

18 Comments

  1. Jana
    October 1
    Reply

    Nice tool- but why are all the measurements displayed with NA? Width:NA, Length:NA- bascically everything!

    • jolyon
      October 2
      Reply

      Thanks for getting in touch Jana. The problem was caused by inputting “mm” in the scale bar length. You should only put in the numbers when asked for the scale bar length (no letters). I’ll update the code to catch this error when I get some time.

  2. Lee
    February 1
    Reply

    I wonder this tools can use for any eggs like duck and chicken ..

    • jolyon
      February 1
      Reply

      yes the tool should work well with almost any bird species’ eggs, and even a lot of other species. Pretty much any elliptical object that is squished length-ways in one place should work.

  3. lee
    February 5
    Reply

    thank you so much for your suggest, and do you have any tools that can mesurement of grain like rice grain or any grains …..

    • jolyon
      February 5
      Reply

      I’ve never tried modelling grains of rice. You could give this tool a go and see how well it maps the outline. However, I guess many grains are slightly flattened rather than having a circular cross-section, in which case this egg tool won’t predict the volume well. For measuring grains I imagine you’d need an image taken from above and from one side, then assume an elliptical cross-section. Alternatively you could use full 3D scanning (e.g. laser scanning might work well).

  4. Lee
    February 12
    Reply

    Thank you again

  5. manzar
    April 4
    Reply

    Thank you for the tool, but I cannot use it for my own samples images, it draws a line around the egg but doesn’t show the Accept and Adjust buttons and therefore no measurement is possible. How can I fix the problem? It works with your sample image and my images are also in jpg format.

    • jolyon
      April 12
      Reply

      The buttons are placed below the egg, so if there’s not enough image below the egg they might not be full visible. You could try copying your image into a larger image, or rotating it so there’s more space below the egg?

  6. Jallal Gnaim
    April 25
    Reply

    Please can you provide us with more information about the protocol of taking pictures of the egg.

    • jolyon
      April 25
      Reply

      Thanks for your question, you can follow the brief instructions above (take photos side-on etc..) The accuracy will depend on you getting the eggs positioned so that their long axis is at right angles to the camera. I used a plastic washer or sheet of foam with a hole in it to position the eggs. Then just photograph with a scale bar at the same height as the centre of the egg, and also at right-angles to the camera. The egg doesn’t need to fill the whole photo, though shouldn’t be too low resolution. You can fit quite a few eggs into one photo if that’s easiest too.

  7. alison
    August 28
    Reply

    Hi Jolyon! I was wondering if you could perhaps explain the proof of your equation a little further? I’m struggling to understand where you’re coming from.

    • jolyon
      September 13
      Reply

      Hi Alison, I’m afraid I’d have to rework the post to explain the process. However, the equation is essentially just an ellipse where x1 = a*COS(2*PI()*x)+b, y1 = b*SIN(2*PI()*x), then this is modified by multiplying y1 with a normal distribution: y2 = 1/(alpha*(2*PI()))*EXP(-0.5*((x-mu)/alpha)^2). I hope that makes sense!

  8. Estefania
    October 29
    Reply

    Thank you for the tool! is there a way of measuring other objects?
    I am trying to measure lung volumes. Thank you!

    • jolyon
      October 31
      Reply

      Hi Estefania, What kind of images are you using to calculate lung volume? The nice thing about eggs is that they’re spherical in sections taken through the long-axis, whereas things like lungs will have more complex shapes. However, there is likely to be a good correlation between the area covered by lungs in two dimensions with their overall volume. You could therefore wok out the area covered by the lungs in pixels and convert this to square centimetres. There will much more error associated with this method than the egg methods though.

  9. JC
    November 27
    Reply

    Hello, thank you for this tool. I am having trouble getting the plugin to work because it seems like imageJ only reads plugin in either .class or .jar format. I see that the plugins you made are in .txt files and imageJ is unable to recognize them after placing them in the plugins folder. I was wondering is there a solution to this? Thanks.

    • jolyon
      November 27
      Reply

      Hi, are you trying to use the plugin with FIJI rather than normal ImageJ? If so, you just need to rename the script with “.ijm” instead of “.txt” so that FIJI recognises it as a macro script.

      • JC
        November 27
        Reply

        It works now, thank you very much again!

Leave a Reply

Your email address will not be published. Required fields are marked *