python - Finding the time of a thumbnail in a video -
i have large set of pre-generated thumbnails , videos. what easiest way figure out specific time in video of associated thumbnail?
i'd imagine have use loop through frames in video find match. libraries should use? opencv maybe? ffmpeg?
python preferred not required.
yes, opencv can trick. e.g.(c++):
mat thumbnail=imread("./mythumb.jpg"); videocapture capture("./myvideo.avi"); mat frame; double max_score=0; int best_matching_frame=-1; int framenum=0; while (true){ if (!capture.read(frame)) break; double score=comparefunction(thumbnail,frame); if (score>max_score) { best_matching_frame=framenum; max_score=score; } framenum++; }
you'll have find implementation comparefunction()
. search stackoverflow how compare images.
Comments
Post a Comment