Opencv_annotation.exe not displaying images using absolute path files

So I have been following this YouTube tutorial and referencing the officail OpenCV documentation. I am using Python 3.8.8, with VSC and OpenCV version 4.5.3 on my machine, although I have installed OpenCV 3.4 within my device to access the opencv_annotations, opencv_createsamples, and opencv_traincascade .exe files.

To use the annotations.exe file, I have specified this command line to run the application:

C:/Users/username/Documents/opencv/build/x64/vc15/bin/opencv_annotation.exe --annotations= tree_images/cabbage_tree/pos.txt --images= tree_images/cabbage_tree/positive/

I have tried using absolute paths in place of the current ones, but it returns the same result, which is listing the opencv_annotation.exe help settings within the terminal, but not showing the window box that is supposed to show, as seen below:


I also have tried removing the whitespace after the = sign, but returns with the error:

OpenCV(3.4.15) Error: Requested object was not found (could not open directory: /tree_images/cabbage_tree/positive) in glob_rec, file C:\build\3_4_winpack-build-win64-vc15\opencv\modules\core\src\glob.cpp, line 267

Any help would be greatly appreciated.

Thank you!


I tried changing directory to the cabbage_tree folder, attempting to remove long paths, but still just returns with the help options of opencv_annotations.exe.

please try again,

  • using absolute paths
  • no blanks around the =
  • when in doubt, add a -h to the cmdline, to see the values

however, before going “in depth” about how to use those tools,
please tell us: what are you trying to detect ?
(unfortunately, 95% of the folks trying to train cascades come up with unfeasible ideas / objects here)

1 Like

I found the solution, which ended up being:

C:/Users/username/Documents/opencv/build/x64/vc15/bin/opencv_annotation.exe --annotations=/tree_images/cabbage_tree/pos.txt --images=C:/Users/username/Documents/VSC/SDLV6/Tree_Classification/tree_images/cabbage_tree/positive/

I came to this conclusion by revisiting the last error message in my original post and entering the absolute path for the --images key.

I realise that this is most likely not the best or ideal way to train an object detection software to detect trees, but as I am still relatively new to programming and machine learning, OpenCV’s built-in commands along with the comprehensive tutorials that community members have posted, has made it easy to learn and implement into my project (for study purposes). I would love to dive deeper into DNN and other training modules, but at the moment, this solution is what is what was most comprehensive and understandable to me.

I am unsure about how to close a topic on this forum so, topic closed?

1 Like

yea, closed, and no, shame, no way to “close” topics on this discord forum

good luck with your trees ! if it is this it might even work, but due to the high variance, you will need tons of positives

1 Like

Thanks for those comments and the link!

I’ve gone out and got a fair amount of samples over the last couple of days,

Hope this post can help someone in the future!