summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorVineeth T M <vineeth.tm@samsung.com>2014-10-27 09:41:51 +0530
committerOlivier CrĂȘte <olivier.crete@collabora.com>2018-05-04 11:50:06 +0200
commit0869c06f9d563bec700f4fcb0f8285306775e5d2 (patch)
treedc31ba38bd008e36aa1a583a64aec45db7eda351 /gst
parentcb1eb650c6826e49ca99965824dd079842c61400 (diff)
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
Diffstat (limited to 'gst')
-rw-r--r--gst/videofilters/gstscenechange.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gst/videofilters/gstscenechange.c b/gst/videofilters/gstscenechange.c
index 4fef2ac2a..c4504c06e 100644
--- a/gst/videofilters/gstscenechange.c
+++ b/gst/videofilters/gstscenechange.c
@@ -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,