I have the following issue, and I believe ImageMagick is the right tool for this job, but it's taking a little more time than I hoped.
I have a number of pictures of wine bottles (about fifty). They were taken in a small improvised worse-than-amateur studio (meaning a white table and canvas background), but we forgot to turn off the auto contrast/brightness/stuff on the digital camera. So now, when flipping through these images, they swap from light to dark. They're all good quality, and look fine individually, but when viewed as a whole (which is their main purpose) they're fugly.
So what I'm trying to explain here is: I need a way to get an average of brightness and contrast of each picture and then make every picture comply to this, so that the color of the backdrop is hopefully less distorted. Of course the problem is that the wine bottles have different colors, so there will always be a little distortion, but they only take up like 20/30% of the image.
Is this at all feasible? Or will taking the pictures again be faster than solving this with my very limited unix and convert/mogrify skillz...
Thanks for your help in advance.
If it is helpful, here is a sample of two very distorted images (you might need to copy paste the links because hotlinking is disabled).
The Distortion:
http://img.waffleimages.com/e6c240110f7 ... ortion.jpg
The originals:
http://img.waffleimages.com/ec18374ae7e ... /out-0.jpg
http://img.waffleimages.com/e242f33c752 ... /out-1.jpg
Normalizing/leveling multiple images
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Normalizing/leveling multiple images
Not an easy problem to measure a meaningful (average) contrast and brightness for a color image.
You could try my script - redist. It redistributes the histogram to some common gaussian distribution or to a uniform distribution. The latter is similar to IM -equalize, but IM's version does this separately on each channel so the colors get distorted. My redist does all channels in concert. However, the script is not fast and you may have to play some with the parameters on a number of images to get the effect you want.
So you may be better off retaking the pictures.
my scripts are available at:
http://www.fmwconcepts.com/imagemagick/index.html
You could try my script - redist. It redistributes the histogram to some common gaussian distribution or to a uniform distribution. The latter is similar to IM -equalize, but IM's version does this separately on each channel so the colors get distorted. My redist does all channels in concert. However, the script is not fast and you may have to play some with the parameters on a number of images to get the effect you want.
So you may be better off retaking the pictures.
my scripts are available at:
http://www.fmwconcepts.com/imagemagick/index.html
Re: Normalizing/leveling multiple images
Hi, and thanks
I think I more or less understand what the script does, and how it could be useful. But will I have to adjust the settings for each and every picture individually? Or how do I make it "redist" all of the images to some calculated/arbitrary value?
I think I more or less understand what the script does, and how it could be useful. But will I have to adjust the settings for each and every picture individually? Or how do I make it "redist" all of the images to some calculated/arbitrary value?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Normalizing/leveling multiple images
The point of the technique is to force each image to a common mean and std, ie. histogram (gaussian) shape. The mean (similar to brightness) will end up the same for all images and the std (similar to contrast) will try to be the same for all images. So test using a variety of images and try to get the mean, lo and hi values to what looks good. Then use that setting for all images. It is fairly robust, but not perfect for all images.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Normalizing/leveling multiple images
The only other method I can think of is to use some common area that is present within each image (part of the background). if you can then find out how this needs to be adjusted on each image, then the whole image should be able to be adjusted to the same level.
I however have not done this or seen any examples of doing this at this point, though I do know that many of the panorama tools also have to do such adjustments when generating larger images from collections of smaller photos.
If you do fond something, or figure out some solution, even if it is just Fred's script, then please respond and let everyone else know what the solution was.
I however have not done this or seen any examples of doing this at this point, though I do know that many of the panorama tools also have to do such adjustments when generating larger images from collections of smaller photos.
If you do fond something, or figure out some solution, even if it is just Fred's script, then please respond and let everyone else know what the solution was.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/