Programmatically generating over/under exposed pictures

2 ビュー (過去 30 日間)
Deepti Ghadiyaram
Deepti Ghadiyaram 2016 年 11 月 29 日
回答済み: Kushagr Gupta 2016 年 12 月 19 日
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?

回答 (1 件)

Kushagr Gupta
Kushagr Gupta 2016 年 12 月 19 日
There are various ways in which local exposure distortions can be introduced to an image.
One of the ways would be:
  1. Create a binary mask of the same size as the original image.
  2. Randomly choose size and location of patches (rectangular are the easiest, would just need to select the indexes in a matrix)
  3. Assign some value (say 75 for over exposed) and add the binary mask to the original image.
  4. This can be done in a loop and the randomness would help in creating different distortions for each image if need 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.

カテゴリ

Help Center および File ExchangeRead, Write, and Modify Image についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by