javascript NodeJS 图像处理/分析是否可行?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17606451/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 08:56:51  来源:igfitidea点击:

Is NodeJS Image Processing/Analysis Possible?

javascriptimagenode.jsimage-processing

提问by JVG

I'm running NodeJSon the server-side, and I'm trying to do a bit of automated image processing to determine the 'base colour' of an image.

NodeJS在服务器端运行,我正在尝试进行一些自动图像处理来确定图像的“基色”。

Here are the steps of what I want to do:

以下是我想做的步骤:

  1. Take an image (on a remote server, so passed through with a URL) and get its dimensions
  2. Use dimensions to calculate the centre of the image
  3. Take a 10px x 50px (WxL) rectangle around the centre-point
  4. Get the RGB value for each of these pixels (500 per image)
  5. Output the average value of the pixels
  1. 拍摄图像(在远程服务器上,因此通过 URL 传递)并获取其尺寸
  2. 使用尺寸计算图像的中心
  3. 在中心点周围取一个 10px x 50px (WxL) 的矩形
  4. 获取每个像素的 RGB 值(每个图像 500)
  5. 输出像素的平均值

I know such things are possible in PHP, but I'd like to use Node is possible. I've seen tutorials on using Node-imagickfor basic processing (like resizing and cropping) but don't know where to start with more advanced analysis like this.

我知道这样的事情在 PHP 中是可能的,但我想使用 Node 是可能的。我看过有关Node-imagick用于基本处理(如调整大小和裁剪)的教程,但不知道从哪里开始进行更高级的分析。

Questions

问题

(a) Is this possible with Node?

(a) 这可以用 Node 实现吗?

(b) What libraries will allow me to do this?

(b) 哪些图书馆允许我这样做?

回答by Peter Lyons

A: yes

答:是的

B: gm

乙:通用

here are some more characters to make this long enough for stackoverflow...

这里有更多的字符可以使它足够长以便计算器溢出......

回答by summit chiu

node-itk may be helpful to you.

node-itk 可能对你有帮助。

Node-ITK is a node.js wrapper, which is built on top of ITK. It was built to facilitate noe.js' use in rapid prototyping, education, and web services for Medical Image Processing.

Node-ITK 是一个 node.js 包装器,它构建在 ITK 之上。它旨在促进 noe.js 在医学图像处理的快速原型设计、教育和 Web 服务中的使用。

https://npmjs.org/package/node-itk

https://npmjs.org/package/node-itk