I kind of missed this topic so I would be glad to help you out with the annotation tool since it is of my making.
The following steps could be used to annotate images using the tool provided. I will examples how to run it from command line in Ubuntu, Linux, but it can generalize to other systems also.
Make sure that you have the option BUILD_opencv_apps
selected during the built process of OpenCV and that you have performed a sudo make install
so that your installation knows the tools! Then the following steps will do the trick.
- Create a folder with images that need to be annotated.
- Call the application on your data
opencv_annotation -images /data/image_folder/ -annotations /data/annotations.txt
. Keep in mind that the tool loves absolute paths, since relative paths can screw up the processing. - The tool will open up the first image from the folder. However, since listing files inside a folder is system specific, it might be possible that it is not the first image you see. Since we need to process each and every image in the foldder, this is no problem at all.
- Use your mouse to select a region of interest, keeping the borders as close as possible to the actual object your want to train a model for. When you are okay with the annotation, press the
c key
on your keypad to confirm. You will see the red annotation turn to green. - Continue untill all objects in the image are annotated.
- Press the
n key
on your keyboard to load the next image. - If you want to shut down the annotation tool, press the
ESC key
.
Your results will be stored in the text file as follows image_location number_annotations x0 y0 w0 h0 x1 y1 w1 h1 ... xN yN wN hN
with N+1
being the amount of annotations, since we start calculating at 0 index.
UPDATE:
Due to a recent PR, the command line parser interface of OpenCV has been integrated into OpenCV annotation, and now one would need to use the new improved command for passing arguments, which is:
opencv_annotation --images=/data/image_folder/ --annotations=/data/annotations.txt
BTW, we have a tutorial for all objdetectrelated tools: http://docs.opencv.org/master/dc/d88/...