Create overlay mask to correct exposure
Posted: 2013-05-03T17:58:58-07:00
I'm working with a project [1] where I want to take photographs of something covered by glass. My problem is that the lighting is uneven and I get various reflections from the glass. It also doesn't help that the glass platen is angled in relation to the light source, so that the light intensity is higher at the part of the glass platen close to the light and lower at the parts further away from the light source. This gives me very uneven exposure of the photographed item. I have done my very best to fix the uneven lighting conditions, but because of the geometries and the placement of the camera I have not been able to get a satisfactory solution.
I would therefore try do compensate for the uneven exposure in software. Because of the large amount of pictures where the exposure will need to be corrected, it's crucial that I can make a progam that can be executed via the command line, preferably in linux, and imagemagick seems like the best place to start. A search of similar situations and discussions mostly turned up subjects where this sort of correcting is done on a picture-to-picture basis, which is impossible in my case. I would like to develop a method where this can be done "automagically". The closest thing I have found to a solution is a discussion implying that this is something I really shouldn't be doing:
viewtopic.php?f=1&t=14267
But I would very much like to get something like this working, and am willing to invest quite some time in doing it. My problem is that I'm out on very deep waters here, as I'm not familiar with photo editing or the techniques. That's why I turn to you for hints and tips to what I need to do or for handy references to other tools that might help me in achieving the goal.
My theory is that I can take a photograph of a black piece of cardboard positioned directly underneath the glass. The areas that reflects too much light will be brighter than the areas where the light intensity is correct. And I think it should be possible to use this to calculate the amount of exposure correction needed for each pixel. The camera operates in manual mode, so the f-stop and the exposure time is the same from picture to picture. The lighing, the glass platen and the camera is fixed, and doesn't move, so it should be possible to create a mask to correct the exposure.
But I don't know how to calculate the amount of correction needed for each pixel. Has anyone here been in a similar situation? I could really need some starting ideas and hints on how to solve this problem.
In advance, thanks for your help
Regards,
royeven
[1] I'm building a book scanner. A video of the design can be found here: http://www.youtube.com/watch?v=a4-qMc2QSOw
Edit:
Oh, I forgot to mention that I would love to work with raw image files, preferably *.ppm
I would therefore try do compensate for the uneven exposure in software. Because of the large amount of pictures where the exposure will need to be corrected, it's crucial that I can make a progam that can be executed via the command line, preferably in linux, and imagemagick seems like the best place to start. A search of similar situations and discussions mostly turned up subjects where this sort of correcting is done on a picture-to-picture basis, which is impossible in my case. I would like to develop a method where this can be done "automagically". The closest thing I have found to a solution is a discussion implying that this is something I really shouldn't be doing:
viewtopic.php?f=1&t=14267
But I would very much like to get something like this working, and am willing to invest quite some time in doing it. My problem is that I'm out on very deep waters here, as I'm not familiar with photo editing or the techniques. That's why I turn to you for hints and tips to what I need to do or for handy references to other tools that might help me in achieving the goal.
My theory is that I can take a photograph of a black piece of cardboard positioned directly underneath the glass. The areas that reflects too much light will be brighter than the areas where the light intensity is correct. And I think it should be possible to use this to calculate the amount of exposure correction needed for each pixel. The camera operates in manual mode, so the f-stop and the exposure time is the same from picture to picture. The lighing, the glass platen and the camera is fixed, and doesn't move, so it should be possible to create a mask to correct the exposure.
But I don't know how to calculate the amount of correction needed for each pixel. Has anyone here been in a similar situation? I could really need some starting ideas and hints on how to solve this problem.
In advance, thanks for your help
Regards,
royeven
[1] I'm building a book scanner. A video of the design can be found here: http://www.youtube.com/watch?v=a4-qMc2QSOw
Edit:
Oh, I forgot to mention that I would love to work with raw image files, preferably *.ppm