I am trying to read files from folder and to run the colorDescriptor.exe
which is in the same directory with .py
file. Actually I want, every time that it reads a file to calculate the colorDescriptor.
My code is the below:
import os
from os import listdir
from os.path import isfile, join
mypath1 = "/clothes/"
mypath2 = "/i386-win-vc/"
onlyfiles = [ f for f in listdir(mypath1) if isfile(join(mypath1,f)) ]
image = mypath1+f
os.popen("colorDescriptor image --detector harrislaplace --descriptor sift --output
onlyfiles.txt ")
print image
From the terminal, the syntax to use colorDescriptor.exe is for example:
colorDescriptor image.jpg --detector harrislaplace --descriptor sift --output onlyfiles.txt
I am receiving as an error:
Tue04 10:53:30,248 - [Impala.Persistency.FileSystem ] Unable to find image in path
Tue04 10:53:30,248 - [Impala.Core.Array.ReadFile ] Don't know how to read
Tue04 10:53:30,248 - [Sandbox.koen.mainColorDescriptor ] [ERROR] Could not read input
file: is it really a valid image? image
After change it with the proposed code:
import os
from os import listdir
from os.path import isfile, join
mypath1 = "C:/Documents and Settings/Desktop/clothes/"
mypath2 = "C:/Documents and Settings/My
Documents/colordescriptors40/i386-win-vc/"
onlyfiles = [ f for f in listdir(mypath1) if isfile(join(mypath1,f)) ]
image = mypath1+f
print image
pattern = "colorDescriptor %s --detector harrislaplace --descriptor sift --output
onlyfiles.txt"
os.system(pattern % image)
I am receiving now the below:
Tue04 11:06:45,091 ERROR [Impala.Persistency.FileSystem ] Unable to find C:/Documents
in
path
Tue04 11:06:45,091 INFO [Impala.Persistency.FileSystem ]
Tue04 11:06:45,091 ERROR [Impala.Core.Array.ReadFile ] Don't know how to read
Tue04 11:06:45,091 ERROR [Sandbox.koen.mainColorDescriptor ] [ERROR] Could not read input
file: is it really a valid image? C:/Documents [Finished in 0.1s]