Skip to content

Commit

Permalink
#1. 간단한 메뉴 및 프레임 추출 기능 구현
Browse files Browse the repository at this point in the history
일단 기능만 빠르게 구현했습니다.
  • Loading branch information
VDoring authored Jul 19, 2021
1 parent df22bdc commit ab32c2c
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions python ver/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import cv2
import time
import os

vid_name = ''

def mainTitle():
os.system('mode con cols=45 lines=10')
os.system('title VFrame Image v0.1')
print('Video Frame Image Converter')
print('by VDoring\n\n')
os.system('pause')


def fileNameSet():
global vid_name

os.system('cls')
print('Input video file name.')
vid_name = input('> ')


def convertFrameImage():
global vid_name

os.system('mode con cols=50 lines=10')
os.system('title Converting..')

try:
capture = cv2.VideoCapture('inputVideo/%s.mp4'% vid_name)
ret,image = capture.read()

video_frame_all = capture.get(cv2.CAP_PROP_FRAME_COUNT)

ret = True

while ret:
ret, image = capture.read()
cv2.imwrite("outputImage/%d.jpg" %int(capture.get(cv2.CAP_PROP_POS_FRAMES)), image)
print('Running.. [' + str(int(capture.get(cv2.CAP_PROP_POS_FRAMES))) + '/' + str(int(video_frame_all)) + ']')
print('Done!')
os.system('pause')

except:
print('ERR-Done!')
os.system('pause')


# 메인코드
while True:
mainTitle()
fileNameSet()
convertFrameImage()

0 comments on commit ab32c2c

Please sign in to comment.