Error using the 'find' command to generate a collection file on opencv

一个人想着一个人 提交于 2020-06-28 14:36:07

问题


I am facing a problem generating a collection file of the positive images to train the Haar Cascade in OpenCV to detect a car. On every tutorial I found on the internet, it is the same command, however i am unable to execute it. I am using Command Prompt and Windows Power Shell to execute this command. find ./positive_images/ -iname '.*pgm' > positives.txt the screenshot of the output I am running this command from root of my directory. The positive images are stored in positive_images folder.

OUTPUT:

File not found - '*pgm'

However, the positive_images directory contains 550 files with .pgm extension.


回答1:


Error File not found - '*pgm'

I am using Command Prompt and Windows Power Shell to execute this command:

find ./positive_images/ -iname '.*pgm' > positives.txt

The above command is using the syntax of a Unix version of find, but you are running it under Windows. PowerShell does not have a built in find command so you are running C:\Windows\System32\find.exe.

Notes:

  • Unix find is used to search for files.

  • Windows find is used to search for string in files.

As you are running on Windows you need to use dir instead of find:

dir /b /s positive_images\*.pgm > positives.txt

Further Reading

  • An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.
  • dir - Display a list of files and subfolders.
  • find - Search for a text string in a file & display all the lines where it is found.


来源:https://stackoverflow.com/questions/38422177/error-using-the-find-command-to-generate-a-collection-file-on-opencv

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!