84648488
Chunk
reverted.
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
'''
Call external C program to extract feature.
@author: chunk
chunkplus@gmail.com
2014 Dec
'''
import sys, os
import subprocess
root = "/home/chunk/workspace/dip/chunk/hog/"
path = os.path.join(root, "data/train")
imgpath = ''
hogpath = ''
for dirs in os.listdir(path):
for _r, _d, _f in os.walk(os.path.join(path, dirs)):
for f in _f:
imgpath = os.path.join(path, dirs, f)
hogpath = os.path.join(root, "hog", dirs)
if not os.path.exists(hogpath):
os.makedirs(hogpath)
hogpath = os.path.join(hogpath,f.replace("jpg", "hog"))
print hogpath
cmd = ["/home/chunk/workspace/dip/chunk/hog/extract/extract_hog", imgpath, hogpath]
# process = subprocess.Popen(cmd, stderr=subprocess.STDOUT, stdout=subprocess.PIPE)
subprocess.call(cmd,stderr=subprocess.STDOUT, stdout=subprocess.PIPE)
|