# Scripts to detect blurriness, adjust exposure before uploading?

**URL:** <https://forum.mapillary.com/t/scripts-to-detect-blurriness-adjust-exposure-before-uploading/343>\
**Category:** Contributing and equipment\
**Created:** [January 14, 2016, 12:08am UTC](https://forum.mapillary.com/t/scripts-to-detect-blurriness-adjust-exposure-before-uploading/343 "2016-01-14T00:08:28Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![skorasaurus](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.mapillary.com/skorasaurus/32/68287_2.png) [@skorasaurus](https://forum.mapillary.com/u/skorasaurus)\
**Post date:** [January 14, 2016, 12:08am UTC](https://forum.mapillary.com/t/scripts-to-detect-blurriness-adjust-exposure-before-uploading/343/1 "2016-01-14T00:08:28Z")

</div>

Hi,

I was wondering if anyone else does any editing of their photos before uploading besides what’s available at [GitHub - mapillary/mapillary\_tools: Command line tools for processing and uploading Mapillary imagery](https://github.com/mapillary/mapillary_tools)

I occasionally still have about 5% or so of my photos that are blurry and figured someone may already have a script to detect blurriness and delete those before uploading.

I also occasionally still have some photos that would benefit from increased exposure before uploading, even after using the new mapillary app’s exposure quick setting (which I find useful)

Regards,  
Will

---

<div class="post-metadata">

**Author:** ![moenk](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.mapillary.com/moenk/32/68240_2.png) [@moenk](https://forum.mapillary.com/u/moenk)\
**Post date:** [January 14, 2016, 11:58am UTC](https://forum.mapillary.com/t/scripts-to-detect-blurriness-adjust-exposure-before-uploading/343/2 "2016-01-14T11:58:24Z")

</div>

I use a slightly adapted version of this [https://gist.github.com/shahriman/3289170](https://gist.github.com/shahriman/3289170) in my upload script to delete all images with a blur of 30% and above.

---

<div class="post-metadata">

**Author:** ![moenk](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.mapillary.com/moenk/32/68240_2.png) [@moenk](https://forum.mapillary.com/u/moenk)\
**Post date:** [January 14, 2016, 12:15pm UTC](https://forum.mapillary.com/t/scripts-to-detect-blurriness-adjust-exposure-before-uploading/343/3 "2016-01-14T12:15:09Z")

</div>

Regarding the white balance (colors/exposure) I considered using this in my toolchain [Fred's ImageMagick Scripts: AUTOWHITE](http://www.fmwconcepts.com/imagemagick/autowhite/index.php) but I don’t think it is the right way to do any image processing on client side. From my point of view pictures should be authentic right from the camera without modifcations when uploaded to the Mapillary server.

---

<div class="post-metadata">

**Author:** ![eneerhut](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.mapillary.com/eneerhut/32/1011_2.png) [@eneerhut](https://forum.mapillary.com/u/eneerhut)\
**Post date:** [January 14, 2016, 12:17pm UTC](https://forum.mapillary.com/t/scripts-to-detect-blurriness-adjust-exposure-before-uploading/343/4 "2016-01-14T12:17:13Z")

</div>

Hi @skorasaurus,

Detecting blurriness automatically to a high degree of accuracy is difficult to achieve. We’re working towards doing this on our backend so that you don’t have to worry about it.

---

<div class="post-metadata">

**Author:** ![tryl](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.mapillary.com/tryl/32/62_2.png) [@tryl](https://forum.mapillary.com/u/tryl)\
**Post date:** [January 15, 2016, 1:15pm UTC](https://forum.mapillary.com/t/scripts-to-detect-blurriness-adjust-exposure-before-uploading/343/5 "2016-01-15T13:15:29Z")

</div>

I agree with @moenk, that all processing should be done by Mapillary on the server. Then they can redo it when they make it better. I manually delete blurry photos, some times all with a shutter speed below 1/50 as well as pictures taken close together. But the latter would probably be useful some times and I definitely doesn’t get all bad pictures.

---

<div class="post-metadata">

**Author:** ![jaakkoh](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.mapillary.com/jaakkoh/32/235_2.png) [@jaakkoh](https://forum.mapillary.com/u/jaakkoh)\
**Post date:** [January 15, 2016, 5:26pm UTC](https://forum.mapillary.com/t/scripts-to-detect-blurriness-adjust-exposure-before-uploading/343/6 "2016-01-15T17:26:20Z")

</div>

The additional twist that I think is really important here is that for some purposes even a quite high level of blurryness doesn’t really matter. e.g. you can quite easily detect if a road is paved or not from even a heavily blurry picture. Same goes for various landuse issues, existence of a bridge or not (i.e. just a ford) crossing a waterway, etc.

Of course in a perfectly saturatedly mapillaried world blurry is worse than sharp. But when the option is a blurry photo over none in a given place then blurry is _much_ better for many uses.

What this brings us to is that I too think that essentially all quality control and adjustments to photos should happen on the server side. And the threshold to totally delete or hide should be high over simply prioritizing what is shown over something else. There could also be a toggle for “typical user” vs. “heavy user”/“mapper”/what\_not that would have different filters/priorities.

EDIT=Addition of some examples:

- [https://www.mapillary.com/map/im/c3keICPg6ZiQPLv74CVDVg/photo](https://www.mapillary.com/map/im/c3keICPg6ZiQPLv74CVDVg/photo) - this photo tells a lot even though it’s blurry: asphalt paved two way street, no proper side walk on the right, clearly residential landuse
- [https://www.mapillary.com/map/im/fEKEScjnwmmWgZ8xTvTjEQ/photo](https://www.mapillary.com/map/im/fEKEScjnwmmWgZ8xTvTjEQ/photo) - clearly not a shart / technically good photo BUT also shows very clearly that there is a passable unpaved road and also that there’s a Y-junctioning side road/track. Note also here that as this is from rainy season it’s good information to have this photo even if there was sharp photo from dry season.
- [https://www.mapillary.com/map/im/urHs1AHWLm8XLz8fy8qOZA/photo](https://www.mapillary.com/map/im/urHs1AHWLm8XLz8fy8qOZA/photo) shows a somewhat typical situation in the road scene of crappy/off-road: the photo shows details such as that the paving stones continue in this bit without a break. The shaky photos also imply that the road is really bouncy (on top of the fact that light is limited).

Having noted the above I too have done some vetting of my photos some times before uploading. What I try to do is evaluate if a photo adds _anything_ valuable to photos before or after it. If not, then I delete it. But if it adds even quite a little (like the above noted implication that e.g. pavement continues without breaks) then I don’t.

Just my 2 cents.

---

<div class="post-metadata">

**Author:** ![skorasaurus](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.mapillary.com/skorasaurus/32/68287_2.png) [@skorasaurus](https://forum.mapillary.com/u/skorasaurus)\
**Post date:** [January 16, 2016, 4:16pm UTC](https://forum.mapillary.com/t/scripts-to-detect-blurriness-adjust-exposure-before-uploading/343/7 "2016-01-16T16:16:22Z")

</div>

Jaakoh,

Very good points. In many contexts, you can still can gain valuable information and knowledge from blurry photos.  
In lesser developed places like in Nicaragua that have limited spatial resources (current and high-resolution aerial imagery, shapefiles of road geometry from the govt, etc) (nor is google streetview), mapillary photos, even blurry ones, provide knowledge that hadn’t been there at all.

My use cases for mapillary are a bit different than yours (often extracting information from POIs on the side of the road that wouldn’t be legible in blurry photos), and have convinced me that, when in doubt, users should generally upload the blurry photos and let the server do the determination of blurriness. Perhaps in the future, even let the users set the parameters of how blurry they wish to view the photos (a big wish from me 🙂 )

This sequence that I just had taken yesterday afternoon of Cleveland has some great examples of photos (particularly the latter half like [here](https://www.mapillary.com/map/im/8JAKtPFAbfwew7PZ2fjdvA/photo)) - that would benefit from some increased exposure to gain a bit more poi information.

If you’re curious, I’d recommend watching the entire sequence where it starts - [here in downtown Cleveland](http://www.mapillary.com/map/im/pXuu7U1ybkobc5vWmMtF-g/photo) and hit the play button (it takes 3-5 minutes to watch). begins because it shows the (Rock and Roll Hall of Fame in the background of a few photos, some of downtown Cleveland, and some varied housing styles here in Cleveland.

Regards,  
Will

---

<div class="post-metadata">

**Author:** ![lto](https://avatars.discourse-cdn.com/v4/letter/l/ac8455/32.png) [@lto](https://forum.mapillary.com/u/lto)\
**Post date:** [January 18, 2016, 6:50pm UTC](https://forum.mapillary.com/t/scripts-to-detect-blurriness-adjust-exposure-before-uploading/343/8 "2016-01-18T18:50:59Z")

</div>

@skorasaurus: What type of camera do you use? Smartphone with the Mapillary app or a conventional camera? What kind of blur do you experience (caused by shaking or by wrong focus distance)?

I use a Canon S100 compact camera that I can program using a CHDK script ( [https://github.com/ltog/mapillary\_utils/blob/master/mpllry.lua](https://github.com/ltog/mapillary_utils/blob/master/mpllry.lua) ).

To prevent blur due to shaking I use short exposure times (around 1/500 to 1/1000 depending on context). To prevent blur due to wrong focus distance (often caused by the camera focussing on the car’s windshield) I filtered on EXIF data (exiftool, value “Focus Distance Upper”) in the past. Later I was able to adjust the script to not take the picture in the first place if the focus distance is too short. The camera then tries to refocus instead.

---

<div class="post-metadata">

**Author:** ![jaakkoh](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.mapillary.com/jaakkoh/32/235_2.png) [@jaakkoh](https://forum.mapillary.com/u/jaakkoh)\
**Post date:** [January 24, 2016, 3:04am UTC](https://forum.mapillary.com/t/scripts-to-detect-blurriness-adjust-exposure-before-uploading/343/9 "2016-01-24T03:04:54Z")

</div>

I can definitely see the need for exposure adjustment in your linked sequence, Will. The single posted photo is a prime example of that but the sequence is a good example – and one that I would assume to be decently reasonably simple to identify as a potential candidate to adjust for both the technical characteristics of the photos as well as the reality of when they where taken and where (latitude + time/date of year + time of day).

The workaround/hack I try to do (until there are such tools/algorithms on the server) is to point the camera a bit more towards the ground. This makes the hood of the car visible in the photos but when the (visible) horizon is above the center line (so that the more bright sky covers less than half of the photo) it helps the camera app to adjust the exposure level of the photos. Surely also with the expense of over exposed sky but there’s not much we’re interested, is there?
