My objective is to be able to obtain the size, in pixels, of objects in images I'm receiving from a camera.

I've tried two approaches thus far, both working to some extent, and I'm wondering if there's any other approach you can suggest.

The first approach was using the CIE Delta E formulas. I would parse through the BGR 24 image data and then locate the appropriate pixels that form part of the object I wish to size. This approach works well when I know the object colors and positions beforehand, not so much when I don't. Another drawback of this approach is that calculating the Delta E for every pixel is extremely computationally expensive.

To circumvent my reliance on having to know the colors and positions beforehand, I used Connected-component Labeling to find the objects and size them.

Here's an example of what I'm doing using connected component labeling.

enter image description here

As you can see from the image above, I'm making four measurements, horizontal, vertical, left diagonal, and right diagonal. After I've sized the object I know where it is in the image, I then debayer the image into a BGR24 image and take several color samples. Debayering the image constitutes about 50% of the processing time, which is more than I prefer.

Now, my question is: What other approaches are there for finding the size in pixels of objects in an image?

  • Are your objects elliptical? Could you assume this? – Tolga Birdal Jul 12 '16 at 11:02
  • @TolgaBirdal They are all roughly elliptical – Kermit the Hermit Jul 13 '16 at 6:50
  • You could use PCA for this estimation. An very simple, applied article came up on a web search: csse.monash.edu.au/publications/2004/tr-2004-160-full.pdf Certainly there are more detailed information available if you find this method appropriate. Also there are certainly some acceleration in the computation possible, since you know that you only deal with 2D matrices, etc. – M529 Jul 13 '16 at 7:52

I would use a split-and-merge algorithm for segmenting and then simply count the pixel per segment. Details are provided here

Two assumptions are neccessary:

1) you objects do not overlap.

2) the picture does not have any background or further irrelevant objects

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.