-
Notifications
You must be signed in to change notification settings - Fork 0
/
cvrt_jpg_to_mpeg.py
33 lines (28 loc) · 877 Bytes
/
cvrt_jpg_to_mpeg.py
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
28
29
30
31
32
import os
from os.path import join
import sys
import cv2
from skvideo.io import vwrite, vread
import numpy as np
from skimage.io import imread
import rawpy as rp
FOLDER = '/mnt/dataset_HDD/smitd/0001'
SAVE = './001.mp4'
filenames = sorted(os.listdir(FOLDER))
video = []
for filename in filenames:
with rp.imread(join(FOLDER,filename)) as raw:
img = raw.postprocess(demosaic_algorithm=False,half_size=True,output_color=rp.ColorSpace.raw,four_color_rgb=True)
#img = raw.raw_image
shape = (int(img.shape[1]/2.0),int(img.shape[0]/2.0))
img = cv2.resize(img,dsize=shape)
video.append(img)
# print(img.shape,type(img))
'''for filename in filenames :
image = imread(join(FOLDER,filename))
video.append(image)'''
video = np.asarray(video)
#vwrite(SAVE,video)
np.save('./0_data/DRV/0001.npy',video)
'''video = np.load('0_data/Cam1/gain10.npy')
print(video.shape)'''