Post Reply 

How to fix these photographs

Mar 1, 2014, 21:45
Post: #1
How to fix these photographs
I have thousands of photographs taken with a cheap camera.

The camera had problems with high contrast images. Most photos had clouds and tree shadows.

The problem is that the clouds look wallpaper white, meanwhile the shadows look totally black.

The images have the information hidden in subtle tonalities of white and black, so I need to enhance the contrast of skies and shadows, without ruining the rest of the photo.

I think that I should identify the pixels with high values of R, G, and B. Those are the whitest, and then I should interpolate those pixels into a higher contrast.

I should do the same with the blacks, which should be pixels with low quantity of R, G, and B.

I’m planning to write code with Visual Studio, to process all the images, but I hope that I can do this work with Gimp.

There is a way to do this with Gimp?

Here are examples of my images:

These two are taken exactly with the same procedure, and the camera took two different photgraps. It shows how the clouds had grey tones and contrast, but the sky looks white on one photo, and the building looks too dark on the other:

[Image: 2dl2m8j.jpg]
[Image: rr5pgp.jpg]

This is a typical image: too white clouds, and too dark forest:

[Image: w1agdj.jpg]

This one looks black on the trees. I wish to have better constrast for the trees.

[Image: 14v4f0l.jpg]

This one is too white in the background, and too dark under the trees:

[Image: hsqm4l.jpg]

Here is another pair of photograps taken separated by one second. It shows how the clouds were deleted into an homogeneous white by the camera:

[Image: 9kz5zq.jpg]
[Image: tz252.jpg]

(I do not have pair of photograps for every photo, so I need to rely on the information stored on each single photo).
Find all posts by this user
Quote this message in a reply
Mar 1, 2014, 23:57 (This post was last modified: Mar 2, 2014 00:16 by buxcador.)
Post: #2
RE: How to fix these photographs
(Mar 1, 2014 22:27)ofnuts Wrote:  In most pictures your whites are utterly blown out and there is little to recover. There is indeed some hope for the dark trees with the back light.
¿How you did that?

I do not know Gimp, but I'm a programmer, and I made some image making software (maps), so I know something about pixels.

(Mar 1, 2014 22:27)ofnuts Wrote:  The second and third picture are correctly exposed for me. The whites in the building are blown out in the first.
The last two images show how the clouds were deleted to a white image. The first two images show the same thing: clouds should look as in the penultimate image...

(Mar 1, 2014 22:27)ofnuts Wrote:  As an amateur photographer (who has done his share of photo tweaking) and professional programmer, I seriously doubt that you can come up with a piece of software that will fix all your photos. Each photo is its own problem There are choices to be made that you cannot realistically leave to software.
That's discouraging, but surely I can fix the images at least a bit.

I hope that I can enhance the photos to some degree.

(Mar 1, 2014 22:27)ofnuts Wrote:  You should also reconsider how you work. I don't take thousands of pictures to discover later than they are all worthless. All camera have a "histogram" display, checking it after taking the picture is a minimum. Cameras don't do miracles, despite all the automation, you still have to know when and how to take the pictures.
Oh, this is no "work". Those are the photographs I took on my vacations. And I'm a totally amateur photographer.

The camera was a cheap Nikon Coolpix. A total piece of garbage.
There was little under my control. I could not even control focus. At best I pointed the camera to a dark or white spot, (so it automatically regulated), and rapiddly aimed the camera to my objective and made the shoot.

That's how I achieved the last two images with different light intensity. That's better than what the camera did by itself when I tried to take these shots.

I threw away lots of blurred, overexposed, and underexposed photos.

I do not know what a camera/photo histogram is, and the camera had nothing of that, but I know what a Fourier transform is. So I suposse that an histogram should be a frequency distribution.
Find all posts by this user
Quote this message in a reply
Mar 2, 2014, 00:11
Post: #3
RE: How to fix these photographs
I suposse that I will end making my own code. So I will like advice on that.

To this point I plan to measure "blackness" and "Whiteness" by taking the cube root of the product of R, G, and B. (I think that these file format should be made of a byte for each R, G, and B channels. I do not expect an alpha chanell).

And I think that the non white pixels should have low values for some channel, so the cube root will give a low value.

Actually, instead of R, G, and B I should take (|R-128|.|G-128|.|B-128|)^(1/3)

Based on that parameter, I should apply a correction on the R,G,and B channels using something like this:

[Image: 29m37r7.png]
Find all posts by this user
Quote this message in a reply
Mar 2, 2014, 11:11
Post: #4
RE: How to fix these photographs
I'm willing to bet you have a modern point & shoot camera, even if it is cheap.

Most point & shoots have the ability to lock exposure/auto-focus on a half button press as well as the hovering over your subject.

Preventive (in-camera) measures:
Take more than one instance of your scene, *but first
Hover around the scene and notice how the light changes, when the is darkest, hold the shutter button halfway down for a second, then push it all the way down to take the picture.

Next, hover the camera around a little until you find where the buildings / foreground get brighter or look more normal (not so dark / shadow)
-Then halfway push the shutter button again to lock the exposure,

* when its pressed halfway, you can move the camera around the scene and the lighting shouldn't change much.

Also, In the camera,
check if you can adjust the exposure (how much light comes into the camera)
The range/setting will look something like
[-] -0.2 -0.1 0.0 +1.0 +2.0 [+]

Last, if after trying above, the blown out sky is still unavoidable, you want the curves tool "value" setting similar to the screenshot below.

You'll want to select the sky first if you don't want the rest of the image affected.

In my second screenshot, I found sky data in 2 of your photos (besides the 3rd visible one of the restaurant)
To quickly select the sky;
1.Duplicate your image layer
- Colors > Threshold (to simplify for background(sky) & foreground(brush/buildings) selection)
Adjust the black triangle in the Threshold window until you have the foreground mostly to all black(like silhouette), click ok.
2. Click the white part (sky) on the threshold layer with the select by color tool Bycolorselect
3. Move the threshold layer under all the layers in the layers window.
4. Copy & "Edit > Paste as > New layer...

5. Then you can apply the curves.

"In order to succeed, your desire for success should be greater than fear of failure." BC
[Image: 29uocaf.png]
iFS007 tut vids on YT ~ auto color B&W landscape tut
Visit this user's website Find all posts by this user
Quote this message in a reply
Oct 1, 2014, 19:20
Post: #5
RE: How to fix these photographs
I tried using my procedure from for two images and I came with this:

Photo 1:

Photo 2:

Blur for gaussian blur you calculated from the site which I mention in the post.
When you play with levels be carefull. Don't do Auto Levels. Instead of this, set it to each cannel (red, green, blue) on the value layer (it's important!) and play with the gamma slider until you get correct image in this channel. When you do this, go to Value channel and first - set correct gamma. Finally play with other sliders on Value channel (pick black point and pick white point from output levels).

After do this you end up with the similar images which I presented in my post.

I corected hundreds images in this way and it's working for me. I hope for you too.
Find all posts by this user
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  What method would I use in Gimp to fix this image? alock 2 106 May 30, 2018 14:57
Last Post: alock
Question How can I fix this? blueYOSHI 1 384 Aug 8, 2017 16:35
Last Post: paynekj
  Border less Printing Fix SportsPosterPros 7 1,709 Sep 10, 2014 12:27
Last Post: SportsPosterPros
Exclamation brush size slider FIX IT CaoMengde777 0 503 Jul 24, 2014 18:38
Last Post: CaoMengde777
  I found a bug with moving the layers and docable dialogs. How do I fix it? CopperZirconium 2 527 Jun 21, 2014 17:21
Last Post: CopperZirconium

Forum Jump:

GIMP ForumPortalArchiveContactTermsRSS