Create bounding box annotations in Pascal VOC .xml format using ImageJ/Fiji
There are many open-source softwares/web-tools (e.g. MakeSense, LabelImg) available for making bounding box annotations in images and saving them in Pascal VOC format for the downstream processing in a Deep Learning model for object detection.
I can think of two reasons:
- If you have already drawn and saved your bounding box rectangle ROIs in ImageJ/Fiji, and you don't want to annotate your images all over again, then you can use the macro here to convert those rectangle ROIs to a Pascal VOC .xml file.
- If you are already familiar and confortable with drawing ROIs in ImageJ/Fiji and don't want to learn any other software or web-tool.
Go to step 2 if you have already created bounding box rectangle ROIs around your objects-of-interest.
Otherwise, open you images one-by-one in ImageJ/Fiji and start drawing rectangle ROIs around your objects-of-interest and add them to the ROI Manager. If you have more than one type of objects, then you need to group them together by adding their group numbers (1,2... so one) by selecting Properties... in the ROI Manager (see Step 2, Case 2 for more details on adding the group numbers). If there is only one type of object you are interested in annotating, then there is no need for defining the group number.
Keep all of your images and the corresponding ROIs.zip files in a folder. Open one image and its corresponding ROIs.zip file in ImageJ/Fiji and run the PASCAL VOC xml generator macro
Running the macro will open up a dialog box, where user can enter the class name of the objects. After user hits OK, an .xml file is generated at the same location where the image was opened from.
Running the macro will open up a dialog box, where user can enter the class names of the objects. After user hits OK, an .xml file is generated at the same location where the image was opened from.
In the following example user drew two types of ROIs - Round (shown in blue, group 1) and Elongated (shown in red, group 2)
Image.sc is the best place to ask questions about this macro. Please post your question with @vedsharma tag so I get the notification.