- Create a binary mask of the same size as the original image.
- Randomly choose size and location of patches (rectangular are the easiest, would just need to select the indexes in a matrix)
- Assign some value (say 75 for over exposed) and add the binary mask to the original image.
- This can be done in a loop and the randomness would help in creating different distortions for each image if need be.
Programmatically generating over/under exposed pictures
2 views (last 30 days)
Show older comments
Is there a simple way to introduce realistic over-exposure / under-exposure distortion in images? That is, synthetically over/under expose images such that the resulting distorted pictures are very close to what a camera would generate.
I could think of shifting the mean of the entire image in all three color channels. For example: if we consider a test image (I),
OE = I+75;
UE = I-50;
OE will be globally much brighter with certain regions white-washed. But this is a global operator. I am wondering if there is a way to locally introduce these distortions in the images, such that the distortion appears realistic. Is there something in MATLAB / Python that achieves this?
0 Comments
Answers (1)
Kushagr Gupta
on 19 Dec 2016
There are various ways in which local exposure distortions can be introduced to an image.
One of the ways would be:
In terms of code, taking an example, it would look like:
I=(imread('coins.png'))
Imask = zeros(size(I));
Imask = uint8(zeros(size(I)));
Imask(20:40,60:90)=75;
imshow(I+Imask)
This is just an illustrative example and should serve as a starting point.
0 Comments
See Also
Categories
Find more on Read, Write, and Modify Image in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!