- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在从事一个测量和可视化图像相似性的项目。我数据集中的图像来自书籍中图像的照片,其中一些具有非常高或低的曝光率。例如,下面的图片来自两本不同的书;上图是下图的过度曝光重印,曝光看起来不错:
我想用 Python 规范化每张图像的曝光。我想我可以使用以下天真的方法来做到这一点,它试图将每个像素值居中在 0 到 255 之间:
from scipy.ndimage import imread
import sys
def normalize(img):
'''
Normalize the exposure of an image.
@args:
{numpy.ndarray} img: an array of image pixels with shape:
(height, width)
@returns:
{numpy.ndarray} an image with shape of `img` wherein
all values are normalized such that the min=0 and max=255
'''
_min = img.min()
_max = img.max()
return img - _min * 255 / (_max - _min)
img = imread(sys.argv[1])
normalized = normalize(img)
只有在运行之后我才意识到这种归一化只会帮助最亮值小于 255 或最暗值大于 0 的图像。
是否有一种直接的方法来标准化图像的曝光,例如上面的顶部图像?如果其他人可以就此问题提供任何想法,我将不胜感激。
最佳答案
Histogram equalisation对于这种事情,效果出奇的好。它通常更适合摄影图像,但它甚至对艺术线条也有帮助,只要有一些非黑/白像素。
它也适用于彩色图像:拆分波段,分别均衡每个波段,然后重新组合。
我试过你的示例图片:
使用 libvips :
$ vips hist_equal sample.jpg x.jpg
或从 Python 使用 pyvips :
x = pyvips.Image.new_from_file("sample.jpg")
x = x.hist_equal()
x.write_to_file("x.jpg")
关于Python:标准化图像曝光,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49546179/
我正在使用navigator.getUserMedia限制访问用户的网络摄像头,使用提要作为 HTML 的源 然后将其流复制到 drawImage一个语境。我这样做是为了每隔一段时间就拍一张快照。 我
我有一个数据层(包含与 MongoDB 的连接)、一个域层(包含存储库和实体)和一个服务层(包含服务和模型) 现在因为我的实体使用 ObjectId,它们需要 MongoDB 的知识(这样可以吗?)
现在在我的相机应用程序中,我允许用户触摸任意位置来设置焦点和曝光,但我如何才能像 Apple 的相机应用程序一样获得两全其美的效果? 例如,用户可能希望通过触摸来聚焦前景中的某物,但如果场景变化足够大
我想实现标准的用户体验,在预览中点击一个点,以将自动对焦和自动曝光点调整到他们点击的位置。我找到了 Preview.focus() 函数,但是它说它需要“传感器坐标系”中的尺寸,我假设它与 Textu
我需要对大量照片进行排序,去除模糊图像(由于相机抖动)、曝光过度/不足的图像,并检测图像是横向还是纵向拍摄。这些事情可以使用图像处理库在图像上完成吗?或者它们仍然超出算法解决方案的范围吗? 最佳答案
我正在尝试调整网络摄像头的亮度。我需要 3 张不同亮度设置的不同照片。我不想让它成为手动的,所以如果想在程序中包含设置。 下面是我正在使用的代码。使用方法 GetFrame() 可以从网络摄像头获取下
我目前被困在图片视频项目上。 问题: 我正在从 UE4 中提取图片,由于一个错误,在屏幕截图的渲染过程中并未考虑所有灯光。输出是 HDR 图像。我想获得更好的亮度,因为导出的图片很暗,就像第一次曝光一
在过去的两天里,我遇到了 docker 问题,但我可以得到它。按照 docker 文档,您可以使用 EXPOSE 公开容器将监听连接的端口。到目前为止,一切都很好! 如果我的应用程序在端口 8080
自一周以来,我一直在尝试为我的 IOS 应用实现一些图像处理滤镜,如白平衡、曝光和分割色调(如在 Photoshop 中),但我没有获得实现其中任何一个的标准实现。 我通过ImageMagick找到了
据外媒 LOGGER 消息,小米手环 6 的信息在另一款智能手环应用Zepp中泄露。这款应用的固件代码中,出现了 “MI Smart Band 6”字样,还展现了其通过中国无线电认证的 CMIIT
据外媒Samsung Mobile报道,消息人士称,三星即将推出的Galaxy Watch智能手表将具有物理表圈。我们暂时将其称为Galaxy Watch 2。 去年,三星在八个月的时间内发布了两
我正在快速开发一个 MAC 应用程序,我现在可以在 NSView 上预览相机,我想更改亮度/对比度/白平衡和所有与相机相关的设置。 我正在使用 AVFoundation 框架来预览相机,我有 slid
据外媒 gsmarena 报道,realme Watch 2 已经通过了FCC 认证,并且被曝光了完整的设计规格。 realme Watch 2 代号为 RMW2008,屏幕方面与上一代相同,采用
我是一名优秀的程序员,十分优秀!