2
$\begingroup$

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?

$\endgroup$
3
  • $\begingroup$ Are your objects elliptical? Could you assume this? $\endgroup$ Jul 12 '16 at 11:02
  • $\begingroup$ @TolgaBirdal They are all roughly elliptical $\endgroup$ Jul 13 '16 at 6:50
  • $\begingroup$ 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. $\endgroup$
    – M529
    Jul 13 '16 at 7:52
0
$\begingroup$

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

$\endgroup$
0
$\begingroup$

Even I am not sure of the speed requirements and the target application, you could train a detectron model using your data. It works very well from my own experience with a little amount of new training samples using the pre-trained models.

Detectron provides you very accurate instance segmentation models and easy to use. Take a look to its documentation:

And take a look to this video and link:

Cheers.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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