-
Notifications
You must be signed in to change notification settings - Fork 0
Detecting bCodes
Lets begin by downloading an example image that shows a lot of bees with a bCode attached to their thorax. The bCodes in this image are fairly small and are therefore difficult to detect. To improve their detection rate, we will use the scaling.factor parameter to magnify the image and the sharpening.sigma and sharpening.amount parameters to sharpen it. To detect bCodes in the magnified and sharpened image at 8 equally spaced intensity thresholds between 40 and 110, and to only report a detected bCode if at least 85% of its template (excluding the border) are preserved, run
java -jar bcode_detector.jar scaling.factor=1.2 sharpening.sigma=1.6 sharpening.amount=0.9 min.intensity.threshold=40 max.intensity.threshold=110 intensity.step.size=10 min.template.conservation=0.85 conserve.margin=0 input.file=2013-07-18-13-57-25-600.jpgThis will result in a file named 2013-07-18-13-57-25-600.txt that contains the raw bCode detection results in the format described here.
Detecting bCodes in a video is very similar to detecting bCodes in an image. The main difference is that in addition to the parameters we have used for the image, the frame rate of the video needs to be specified with the frame.rate parameter. To detect all bCodes in this example video, which shows a bee passing through an entrance monitor, run
java -jar bcode_detector.jar scaling.factor=0.8 sharpening.sigma=1.4 sharpening.amount=0.9 min.intensity.threshold=50 max.intensity.threshold=100 intensity.step.size=10 min.template.conservation=0.85 conserve.margin=0 frame.rate=10 input.file=2018-08-03-09-03-18-039.mp4This will result in a file named 2018-08-03-09-03-18-039.txt that contains the raw bCode detection results in the same format as for images. Note that each video frame in which a bCode was detected is identified with a unique timestamp.
Note that the bCode detector expects filenames to encode the date and time when the image or video capture started. A valid file name has the format yyyy-MM-dd-HH-mm-ss-SSS, like in the examples above. If you don't know what these letters mean, please look here.
To process more than one image or video file, you can create a plain text file that lists one image or video file on each line and then use this file as the input.file. For example, this plain text file tells the bCode detector to first process the example image and then the example video.
Before examining bCode detection results or processing them with a 3rd party program, you should probably convert them to a more convenient format. For example, to convert the file that contains the bCodes detected in the example image, run
java -jar converter.jar raw.bCode.file=2013-07-18-13-57-25-600.txt human.readable.file=converted_bcode_detections.txtThis will produce a file named converted_bcode_detections.txt in the format described here.