Ask Your Question

Revision history [back]

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.

  1. Create a folder with images that need to be annotated.
  2. 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.
  3. 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.
  4. 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.
  5. Continue untill all objects in the image are annotated.
  6. Press the n key on your keyboard to load the next image.
  7. 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.

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.

  1. Create a folder with images that need to be annotated.
  2. 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.
  3. 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.
  4. 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.
  5. Continue untill all objects in the image are annotated.
  6. Press the n key on your keyboard to load the next image.
  7. 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