9

I'm student in agronomy and the subject of my final year study is to assess the number of bees in pictures. I tried some methods (thresolding, template matching with ciratefi algorithm or with imageJ) but none works fine.

I'm a beginer with matlab and I wonder if it's possible to train cascade detector and use the fonction vision.CascadeObjectDetector to count bees on pictures.

Two pictures examples :
and
http://img4.hostingpics.net/pics/978154DSC0660.jpg

How many positive and negative samples do I need to use ? HOG ? Haar ? LBP ?

Thank you for your help

Community
  • 1
  • 1
Hgwen
  • 91
  • 3
  • I would probably start with LPB,since the stripes on the bees are one of the distinct features that may be used for detection. You might try Haar later, since it take a long time... Sample size is kind of difficult to estimate, you probably have to try it out (something like 100 positive samples will be my guess). Make sure to include bees with different orientation and postures in your positive samples though.Sounds like an interesting project :) – Cici Apr 18 '14 at 15:37
  • Is there any way you could get a set of quickly taken successive pictures or video? – Maurits Apr 25 '14 at 12:45

2 Answers2

2

It may work, but it will be hard. From the images you've provided I think you may have a good chance of detecting isolated bees, but it will be hard to detect the ones that are crowded together. In the latter case it is hard to see the outline of the shape of each bee, and some bees occlude other bees. But you will not know until you try. :)

Also, keep in mind that the cascade object detector does not handle in-plane rotation. That means you would have to train several detectors for different orientations of the bees. You can use the trainCascadeObjectDetector function to train the detectors.

You would need at least several hundred positive samples of each orientation. You can use the Training Image Labeler app, which comes with the latest release of the Computer Vision System Toolbox to label the bees in images.

You would also need lots of images of the honeycomb without any bees on it to use as negative images.

As far as features, I would start with HOG or LBP, because they are much faster than Haar. If you get encouraging results, then you may want to try Haar to see if you can improve your accuracy.

Dima
  • 38,860
  • 14
  • 75
  • 115
  • I'm going to take pictures from honeycombs without bees but it causes a great disturbance for bees to brush them from frames. So I would like to know if it's a good idea to take entire pictures of combs and then divide them into small parts : http://img4.hostingpics.net/pics/416788q27.jpg - http://img4.hostingpics.net/pics/505876t83.jpg Thank you very much for your help! – Hgwen Apr 23 '14 at 08:14
  • To get a "clean" honeycomb, a Photoshop technique called "image stacks" may help you. www.photoshopforphotographers.com/pscs3/download/sample-04.pdf It's basically doing an "average" over several photos, which are taken as a sequence without moving the camera, to remove any moving objects. You can take a "clean" shot of your honeycomb - just flush your bees to another part of their house! – Yvon Aug 09 '14 at 08:19
0

If you can take images of the beehives without the bees, in the same lighting conditions, it would be great! try it, and then subtract the two images (pixel by pixel), and see what you get. This difference image would be much easier to work with.

Also, regarding training a classifier: from looking at the images, you would need a "rotationaly invariant" classifier. This is a fancy way of saying that bees may be at various angles. So you would basically take several dozens of bee images, and rotate them arbitrarily. This would give you several hundred positive examples. Then sample places without bees, I guess several dozens too. Don't rotate these, since places without bees are not rotationaly invariant. Now train a classifier. I don't think it should matter which one you use - just use the simplest one (like Viola-Jones).

So, to recap: there are two major parts: 1) seeing if you could subtract the background 2) training your classifier.

Please tell me if it helps!

zuuz
  • 859
  • 1
  • 12
  • 23