JaggerYoung / C3D-mxnet

5 stars 0 forks source link

Input frame sequences is not continuous? #4

Open Jessespace opened 5 years ago

Jessespace commented 5 years ago

If you have 160frames in video. Following the code,It extracted the 1 frame, 10frame ...160frame. It is not continuous, but the paper said extracted continuous frame.In my understanding, it should be 1~16frames,17~32frames,....Am I wrong? Hope replying!

` pic = []

print dirName

for filename in glob.glob(dirName+'/*.jpg'):
    pic.append(filename)
pic.sort()
#print len(pic)
ret = []
len_pic = len(pic)
tmp = len_pic/num
for i in range(num):
    ret.append(pic[i * tmp])
r_1 = []
g_1 = []
b_1 = []
mat = []

for i in range(len(ret)):
    img = cv2.imread(ret[i], cv2.IMREAD_COLOR)
#img = img.resize(data_shape[2],data_shape[3])
    b,g,r = cv2.split(img)
r = cv2.resize(r, (data_shape[3], data_shape[2]))
g = cv2.resize(g, (data_shape[3], data_shape[2]))
b = cv2.resize(b, (data_shape[3], data_shape[2]))
r = np.multiply(r, 1/255.0)
g = np.multiply(g, 1/255.0)
b = np.multiply(b, 1/255.0)
r_1.append(r)
g_1.append(g)
b_1.append(b)
#mat.append(img)
mat.append(r_1)
mat.append(g_1)
mat.append(b_1)
#print len(mat),len(mat[0][0])
return mat`