Ask Your Question

Detect flying hornets

asked 2015-10-27 06:41:10 -0600

emeraud44 gravatar image

updated 2015-10-27 08:54:21 -0600

Hi, With a camera, I want to film the Asian hornets (Vespa velutina) hovering in front of the hives. They expect the bees returning or leaving to catch and eat them. I do not want to track them but only detect and count them. So I filmed hornets and took many pictures from different angles. There are many detection methods with openCV and I'm a little confused. Secondly, I want to run the program on a Raspberry Pi 2. Can you advise me? Thank you

I tested with a Sony NEX-5N HD 1920X1080 camera. I have not yet worked with the Raspberry camera that is also full HD 1080p

Photos with zoom :C:\fakepath\DSC00675.JPG C:\fakepath\DSC00695.JPG

Photos without zoom : C:\fakepath\DSC00734.JPG Photo o f a flying bee : C:\fakepath\DSC00749.JPG

edit retag flag offensive close merge delete


Yes: it depends on what you have: frames resolution, data (data resolution). Can you post one or 2 frames (one with the hornets and one without, preferring having bees) and one or 2 images you have with the from different angles? It will be helpful for us to give you the right approach for your case.

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-10-27 07:29:28 -0600 )edit

How did you create the photo with zoom? Do you have also some photos with zoom on honeybees flying?

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-10-27 08:25:56 -0600 )edit

Hornets make stationary flight so we take good photos. Most of the time, bees are flying too fast for a snapshot.

emeraud44 gravatar imageemeraud44 ( 2015-10-27 08:41:02 -0600 )edit

Hi trhdrk, Sony NEX-5N has zoom X 10 Do you think it is possible to detect hornets without the zoom ? Raymond

emeraud44 gravatar imageemeraud44 ( 2015-10-27 13:02:54 -0600 )edit

1 answer

Sort by ┬╗ oldest newest most voted

answered 2015-10-28 01:11:02 -0600

arjo129 gravatar image

One can use background subtraction if your camera is stationary. Subsequently one can count blobs. For background subtraction take a look at this:

Binarize the image, then detect and count blobs. You might need to track the hornets and add extra logic to determine if its the same hornet in order to extract the count.

edit flag offensive delete link more


I just started reading a very good book "OpenCV Essentials" speaking detection and tracking (including background subtraction). It is not necessary to track because hornets remain hovering few seconds. So just count at time t. Over time, then averages the counts. In addition, the camera being directed towards one hive, it can not track a particular hornet as he flies from one hive to another.

Can you tell me if the detection by "blobs" is approximately an average per color detection?  There are black bees in my hives but there are also yellow bee races. There is a risk of confusion. In fact, the Asian hornet is distinguished from the bee in morphology (size, oranges rings, large yellow legs) and behavior (hovering in front of the hive) Another question: is it necessary to use a zoom lens?

emeraud44 gravatar imageemeraud44 ( 2015-10-28 02:27:15 -0600 )edit

I think you shall start with the simple solution of blobs detection, then see what it is doing, if there is a problem of counting bees. Try to use a SVM classifier if you think that you can distinguish between the bees and the hovering (or by tracking to see the behaviour of the blob). The idea is start simple, then improve solution. ;)

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-10-28 03:25:50 -0600 )edit

Thanks I'll follow this method :

emeraud44 gravatar imageemeraud44 ( 2015-10-28 06:12:36 -0600 )edit

Follow it , but do not use the cvblobslib, it is linked to c-api and it is deprecated...

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-10-28 07:31:53 -0600 )edit

Question Tools

1 follower


Asked: 2015-10-27 06:38:35 -0600

Seen: 1,778 times

Last updated: Oct 27 '15