tfaehse / DashcamCleaner

Censor identifiable information in videos, in particular dashcam recordings in Germany.
GNU Affero General Public License v3.0
134 stars 27 forks source link

Merge blurrs #34 #35

Closed joshinils closed 2 years ago

joshinils commented 2 years ago

change applying blurrs to using masks two masks, one with less blurr than the other. each mask contains a union of all detections per frame.

this way all detections which overlap (from this frame or previous frames) will look the same amount of blurred at the end. so no overlaps are blurred twice or more and thus creating visible artifacts.

closes #34

joshinils commented 2 years ago

sorry, this includes the commits from #30 but has nothing to do with it, so i created another branch and pull-request.

there is a slight visible border between the inner and outer blur, but that was there previously aswell. i guess any compression and youtube make that go away completely

joshinils commented 2 years ago

old: image two ellipses image image image image

with my changes and using a Gaussian blur: image image image

image image image

joshinils commented 2 years ago

only problem could be, that now the strength of blurring is different since the gaussian blur works different to a box blur kernel, but in my opinion looks much better. i also had to change how the input parameter is used, since the gaussian blur needs an odd size: https://github.com/tfaehse/DashcamCleaner/blob/7450118fba1159aec17495ee38af74a7da2b9aa4/dashcamcleaner/src/blurrer.py#L44 old: https://github.com/tfaehse/DashcamCleaner/blob/ad3039aeed42b5ba53769282763e844cf8b6f360/dashcamcleaner/src/blurrer.py#L38

so the cli argument of --blur_size is doubled at the moment. but it could be changed to only accept odd values in range [1, 3, 5, ..., 97, 99]

joshinils commented 2 years ago

in theory it is possible to use different blurs for the first and second mask, if you wanted, so a weak box blur for the outer blur, and a nicer looking gaussian for the inner box

joshinils commented 2 years ago
-b 3 4 5 6 7 8 9
gauss size 7 9 11 13 15 17 19
gauss image image image image image image image
old w/ box image image image image image image image

of course the old version still has the off by one error regarding the detections age, so here it also uses the previous detection too, and thus blurs parts of the face multiple times.