infinitesunrise / carsinbikelanes

A browsable geographic database for crowdsourced traffic violation reporting
GNU General Public License v3.0
63 stars 18 forks source link

Blur a zone in a picture #32

Open mathieuruellan opened 8 years ago

mathieuruellan commented 8 years ago

If a user uploads a photo with a face, it's forbidden to publish it in France. And we don't want trials!

mathieuruellan commented 8 years ago

The problem is more important than i though. In France and many country of EU, Plate numbers are personnal data, and that's a big problem. The only way is to blur the plate and to hash the plate number ....

infinitesunrise commented 8 years ago

Haha well I appreciate my French brothers and sisters for being the test cases for progressive legislation. It gives the rest of the world a chance to see what works and doesn't work practically when actually implemented by society :P

However this sounds like a fun problem to work around. I could probably add in blurring and plate hashing support in the near future. Can the plate numbers be stored in the database and simply not shown on the website, or is it illegal to even store them at all?

mathieuruellan commented 8 years ago

2 points:

  1. I already faced that problem in my daily job. Data must be anonymous, so hash is mandatory to be peacefull. That's to answer to CNIL https://en.wikipedia.org/wiki/Commission_nationale_de_l%27informatique_et_des_libert%C3%A9s
  2. Personnal data can't be spread without an agreement (most of time, they disagree ;) ).

And we can't host in another country, moving personnal data a country without agreement with CNIL is even more forbidden.

mathieuruellan commented 8 years ago

I've talked with other geek bikers and nobody agrees if plates are a personnal data . So, i will ask to CNIL. Some says that it has recently changed.

mathieuruellan commented 8 years ago

Well, i've the final word! Plate is not a personnal data, it identifies a vehicle. But with the picture date, we can cross data and have the owner (even if the other data is not public).

So, cibl can't be deployed in France as is.

infinitesunrise commented 8 years ago

Date + plate = identity? Not sure how that works, but if the government thinks that's so then that's the final word I guess. However, I could easily add a configuration option to not require the date field (Or remove it altogether) - As well as one to disable plate searches. Or combine all these changes into one config option and call it CNIL Mode.

...Was CNIL a play on words? Because in English one is inclined to pronounce it "See Nil", as in "See Nothing" :P

infinitesunrise commented 8 years ago

FYI I can probably implement this option next week, I'm away from home this week so I've confined myself to CSS changes only for the next few days.

mathieuruellan commented 8 years ago

Really thank you. It's really great to give free time for side projects! The date is mandatory for our usage. The aim is to have data, to be pain in the ass with local police. We want to give data to show them that the job is not done, and to help them (where they should go and when). The idea is not to denounce or to shame a particular car (they are too many), so the plate is not our priority.

kaheja commented 8 years ago

We are checking out if we could use this in another EU country too, and seems that covering the plate and not even record it as text to database would be the safest way to avoid problems. And of course this should be done quite automatically so that admins don't usually have to do any manual editing before

I was checking how to use the ALPR data coordinates to draw a black box or something to the photo, but it only has the starting coordinates, not the size of the plate in photo. To be continued.

infinitesunrise commented 8 years ago

It returns the four corner coordinates of every plate it finds in the photo, in plate['results']['coordinates'] as four [x,y] arrays. It's not a rectangle, since the a photograph warps the shape due to perspective, but those four coordinates do form a polygon wrapping the plate. With that data you can have an image editing library like imagemagick blur or black out the region. Check out lines 200-236 in index_actual.php, that's my listener for the request to OpenALPR's cloud API. Within that block I actually use the four coordinates of every plate returned to determine their centers, so that if there are multiple plates identified in the photo the submit form fills in the plate field with the one closest to center of image, and not the plate of the poor bystander who might be parked legally at edge of photo :) You can probably adapt that code to instead use the corner coordinates to inform a blur/blackout function.

mathieuruellan commented 8 years ago

And people faces, or anything that can identify someone.

infinitesunrise commented 8 years ago

I'm looking at FaceRect to provide face locations for blurring: http://apicloud.me/apis/facerect/demo/ It's simple and free.

I haven't started coding anything yet though, if you'd like to take a crack at it please do.