mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 11:55:39 +00:00
scenechange: improve detection algorithm
Scene detection determines, how many scenes have changed in a video. It compared the previous frame with present frame to find out the score and a threshold is calculated for the same. I have added an intermediate condition which helps in improving the positive detections. https://bugzilla.gnome.org/show_bug.cgi?id=735094
This commit is contained in:
parent
cb1eb650c6
commit
0869c06f9d
1 changed files with 9 additions and 2 deletions
|
@ -218,12 +218,15 @@ gst_scene_change_transform_frame_ip (GstVideoFilter * filter,
|
|||
|
||||
threshold = 1.8 * score_max - 0.8 * score_min;
|
||||
|
||||
if (scenechange->n_diffs > 2) {
|
||||
if (scenechange->n_diffs > (SC_N_DIFFS - 1)) {
|
||||
if (score < 5) {
|
||||
change = FALSE;
|
||||
} else if (score / threshold < 1.0) {
|
||||
change = FALSE;
|
||||
} else if (score / threshold > 2.5) {
|
||||
} else if ((score > 30)
|
||||
&& (score / scenechange->diffs[SC_N_DIFFS - 2] > 1.4)) {
|
||||
change = TRUE;
|
||||
} else if (score / threshold > 2.3) {
|
||||
change = TRUE;
|
||||
} else if (score > 50) {
|
||||
change = TRUE;
|
||||
|
@ -234,6 +237,10 @@ gst_scene_change_transform_frame_ip (GstVideoFilter * filter,
|
|||
change = FALSE;
|
||||
}
|
||||
|
||||
if (change == TRUE) {
|
||||
memset (scenechange->diffs, 0, sizeof (double) * SC_N_DIFFS);
|
||||
scenechange->n_diffs = 0;
|
||||
}
|
||||
#ifdef TESTING
|
||||
if (change != is_shot_change (scenechange->n_diffs)) {
|
||||
g_print ("%d %g %g %g %d\n", scenechange->n_diffs, score / threshold,
|
||||
|
|
Loading…
Reference in a new issue