타임라인 비디오의 자동 속도 조정 시도(후편)

전편


타임라인 비디오의 자동 속도 조정 시도(전편)
위의 보도를 계속하다.
수사력이 너무 떨어져서 먼저 손을 댔어요.

phash(전편부터)


이 타임라인 영상의 프레임 사이의 해시 거리는 이런 느낌이다.
clip = moviepy.editor.VideoFileClip("path to video file")
phashs = [imagehash.phash(PIL.Image.fromarray(frame)) for frame in clip.iter_frames()]
distances = [phashs[i+1] - phashs[i] for i in range(len(phashs)-1)]

z score


어쨌든, 먼저 zscore를 시험해 봅시다.
z_scores = scipy.stats.zscore(distances)

gaussian blur


zscore에서 절대값의 평균 마이너스를 한도값으로 설정해 보십시오.
blured = cv2.GaussianBlur(z_scores, (49, 49), 0)
threshold = numpy.average(numpy.sqrt(numpy.power(z_scores, 2)))

위 그림의 한도값보다 낮은 서열을 이벤트로 합니다
애니메이션의 재생 속도를 바꾼 것은 다음과 같다.

과제.


생각한 거랑 비슷한 것 같지만.
활동으로 검출되는 부분의 앞뒤도 서서히 속도가 느려지고 속도가 빨라지는데 경계점을 조금만 나누면 더 좋을 것 같다.
이번엔python이라는 프로그램 라이브러리를 사용했습니다
그 사용법을 알면 도전해보고 싶어요.
사용한 프로그램 라이브러리를 배치합니다.
# requirements.txt
ImageHash==3.1
matplotlib==1.3.1
moviepy==0.2.2.11
numpy==1.7.1
Pillow==3.4.2
progressbar2==3.11.0
scipy==0.13.2
seaborn==0.7.1
코드 여기 있습니다.
https://github.com/sosuke-k/timelapse-optimizer

좋은 웹페이지 즐겨찾기