简体   繁体   English

如何使用 image-js 和 JavaScript 规范化图像(直方图拉伸)?

[英]How do you normalize an image (histogram stretching) using image-js and JavaScript?

I am using image-js .我正在使用image-js

I have looked at the documentation and I do not see a function called normalize or histogram stretching.我查看了文档,但没有看到称为归一化或直方图拉伸的 function。 However I do see some histogram functions.但是我确实看到了一些直方图函数。 Can I use the histogram functions to do a normalization on a grayscale PNG array of height values?我可以使用直方图函数对高度值的灰度 PNG 数组进行归一化吗?

The image array is values of heights from range 0 - 255 black being lowest height white highest.图像数组是 0 - 255 范围内的高度值,黑色是最低高度,白色最高。 I am using this array to create a grayscale heightmap image.我正在使用此数组创建灰度高度图图像。

Clarify:阐明:

By normalize I mean normalizing an image colors in this case the grayscale.归一化是指对图像 colors 进行归一化,在本例中为灰度。 Like this project but using image-js https://www.npmjs.com/package/@jimp/plugin-normalize喜欢这个项目,但使用 image-js https://www.npmjs.com/package/@jimp/plugin-normalize

The normalization I want to accomplished is described in this GIMP doc and listed below这个 GIMP 文档中描述了我想要完成的规范化并在下面列出

From GIMP: 8.10.来自 GIMP: 8.10。 Normalize归一化

The Normalize command scales the brightness values of the active layer so that the darkest point becomes black and the brightest point becomes as bright as possible, without altering its hue.标准化命令缩放活动图层的亮度值,使最暗的点变黑,最亮的点变得尽可能亮,而不改变其色调。 This is often a “magic fix” for images that are dim or washed out.对于暗淡或褪色的图像,这通常是一种“神奇修复”。 “Normalize” works on layers from RGB, Grayscale, and Indexed images. “规范化”适用于 RGB、灰度和索引图像的图层。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM