---
title: "生成一张曝光图片的算法"
description: "StackOverflow上看到的一个简单图像处理算法，产生的图像与PS结果类似。"
canonical_url: "https://yangqiuyi.com/blog/suan-fa/sheng-cheng-yi-zhang-pu-guang-tu-pian-de-suan-fa"
---

> Index of every page on this site: [llms.txt](https://yangqiuyi.com/llms.txt)

StackOverflow上看到的一个简单图像处理算法，产生的图像与PS结果类似。

```cpp
int row = inputImg.rows;
int step = inputImg.step;
uchar* pInputImg = inputImg.data;
uchar* pOutputImg = outputImg.data;
for (int i = 0; i < row * step; i++)
{
    pOutputImg[i] = (uchar)min_uchar(255, max_uchar(0, pInputImg[i] * pow(2, strength)));
}
```

![](https://yangqiuyi.com/content-assets/e1339364e4cba6cc6617.png)

## Sitemap

See the full [sitemap](https://yangqiuyi.com/sitemap.md) for all pages.
