tnc-ca-geo / video-importer

Traverses directories to import video as segmented events with correct timestamps and metadata
MIT License
4 stars 0 forks source link

Add option to mask regions of video & snapshots prior to submitting to labeling service #1

Open jcmaslan opened 7 years ago

jcmaslan commented 7 years ago

The recorded video sometimes has sensitive information watermarked on it (e.g. name of a vessel, its lat/lng, time, etc.), so add the option to the importer scripts to specify the masked_regions at the level of each camera_id so that they may vary by camera even though many users may have the same watermarking across all cameras associated with their account.

Per discussion with @mmerrifield these masks may also be helpful to encourage labeling research by making it simple to contribute sample data anonymously.

For example:

import_video --masked_regions myregions.json

Where myregions.json is a description of the masking polygons similar to:

[
    {
        "name": "watermark-location",
        "polygons": [
            {
                "points": [
                    {
                        "x": 1.0025475543478262,
                        "y": 0.2984098228663446
                    },
                    {
                        "x": 0.8835699314718551,
                        "y": 0.30807165861513686
                    },
                    {
                        "x": 0.8029488968951427,
                        "y": 0.3257850241545894
                    },
                    {
                        "x": 1.0025475543478262,
                        "y": 0.2984098228663446
                    }
                ]
            }
        ]
    },
    {
        "name": "watermark-logo",
        "polygons": [
            {
                "points": [
                    {
                        "x": 0.38056687801932365,
                        "y": 0.528683574879227
                    },
                    {
                        "x": 0.4391954854523669,
                        "y": 0.5703070246669671
                    },
                    {
                        "x": 0.49889282475885205,
                        "y": 0.6124054663984592
                    },
                    {
                        "x": 0.38056687801932365,
                        "y": 0.528683574879227
                    }
                ]
            }
        ]
    }
]
jhallard commented 7 years ago

I can do this with ffmpeg, it'll require recoding the video prior to upload but it can be done relatively easily.

jcmaslan commented 7 years ago

@postfalk created https://github.com/tnc-ca-geo/extract for people to use if they decide to re-encode during import and they can still use this json file for the specification of the masked regions. However to reduce the compute load for v1 end-to-end, we've concluded that it's better that the segmenter hook preform the masking to avoid decoding the video twice.