I am trying to run create a codebook from a database of images using colordescriptor.exe. The code comes with an python scirpt which is actually a scirpt to create a codebook. In the usage example it says thath I have to run the following command to console: python exampleCreateCodebook.py trainimages.txt outputFilename, where trainimages.txt a list of dataset images and outputFilename the name of the output codebook. When I tried to run the command (from the dir that the .exe is located) I got the following error:
Traceback (most recent call last):
File "exampleCreateCodebook.py", line 112, in <module>
sys.exit(main())
File "exampleCreateCodebook.py", line 109, in main
return process(options, args)
File "exampleCreateCodebook.py", line 80, in process
raise Exception("Error when executing '%s': command returned error" % cmdLine)
Exception: Error when executing 'colorDescriptor.exe C:\sift\fashion1\00010big.jpg --keepLimited 30 --outputFormat binary --output c:\users\user\appdata\local\temp\tmp9qzldd --detector densesampling --ds_spacing 6 --ds_scales 1.2 --descriptor opponentsift': command returned error
How can I run properly the exampleCreateCodebook? Is there a chance I am gettting problems due to os.system function? The scirpt file is the following. I have noticed that my program fails in line 80 since returnCode is equal to -1. Thus it seems that os.system(cmdLine) doens't run properly. I tried to change the above command with returnCode =subprocess.call(['cmd', '/k', cmdLine] ). When I did so the scirpt was iterate just one time inside the for loop and it stops after the subprocess.call. Is subprocess responsible for stoping the for-loop?
for inputImage in inputImages:
cmdLine = "%s %s --keepLimited %d --outputFormat binary --output %s %s" % (binarySoftware, inputImage, keepLimited, tempFilename, extractionConfig)
print cmdLine
subprocess.call(['cmd', '/k', cmdLine] )
print 'ole'
List inputImages contains 1000 images. However the for loop stops after first iteration, at the first call of subprocess.