-
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. Once the download has completed, we need to decide which parameter values to use when detecting the bCodes.
The bCodes in the example image are small and 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 account for uneven lighting, we use the min.intensity.threshold, max.intensity.threshold, and intensity.step.size parameters to integrate bCode detections across 8 equally spaced brightness thresholds between 40 and 110. Finally, we use the min.template.conservation parameter to tell the bCode detector to only report a bCode if at least 85% of its template are preserved, and we set the conserve.margin parameter to 0 exclude the bCode border from this estimate.
Putting it all together, the complete commmand line for detecting bCodes in the example image is
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.jpgRunning this command line will result in a file named 2013-07-18-13-57-25-600.txt that contains raw bCode detections in the format described here. For converting these raw detections to a more user-friendly format, please see the Hints.
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 has a frame rate of 10 frames per second, run
java -jar bcode_detector.jar frame.rate=10 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 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.
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.