服务器端图像处理

发布于 2024-08-27 05:52:41 字数 485 浏览 7 评论 0原文

我正在设计一个实时进行服务器端图像处理的 Web 应用程序。处理任务包括对各种格式的图像应用不同的效果,如灰度、模糊、油画、铅笔素描等。我想使用我已经熟悉的 java/servlet 来构建它。我发现了 3 个选项,

1)使用纯 java 成像库,如 java.awt 或 http://www .jhlabs.com/ip/index.html 2)使用Gimp/ImageMagick等命令行工具 3) 使用具有 java 绑定的 c、c++ 图像库。

考虑到性能,我不知道上述哪个选项更好。看起来选项 2) 和 3) 的性能良好,但在排除 1) 之前我想确定一下。我还听说 gimp 无法使用命令行运行,除非服务器上已经安装了 gtk 或 xwindows。在服务器端运行 2) 或 3) 时会出现此类问题吗?

另请为此目的推荐任何好的图像处理库。

I am designing a web application that does server side image processing in real time. Processing tasks include applying different effects like grayscale, blur, oil paint, pencil sketch etc on images in various formats. I want to build it using java/servlets which I am already familiar with. I found 3 options,

1) Use pure java imaging libraries like java.awt or http://www.jhlabs.com/ip/index.html
2) Use command line tools like Gimp/ImageMagick
3) Use c,c++ image libraries that have java bindings.

I don't know which of the above options is good keeping the performance in mind. It looks like option 2) and 3) are good performance wise, but I want to be sure before I rule out 1). I have also heard gimp cannot be run using command line unless gtk or xwindows is already installed on the server. Will there be any such problems with 2) or 3) while running them server side?

Also please suggest any good image processing libraries for this purpose.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(11

过度放纵 2024-09-03 05:52:41

Imagemagick 或graphicsmagick 非常好,您可以在大多数语言中找到它们的包装。

也有很多使用这些库进行图像处理的在线示例和教程

Imagemagick or graphicsmagick are pretty good, you can find wrappers for them in most languages.

There are quite a few online examples and tutorials for image manipulation using these libraries too

|煩躁 2024-09-03 05:52:41

让事情变得更复杂的是,GIMP 有一个 API,带有一个 Java 包装器:JGIMP

Just to complicate things, the GIMP has an API, with a Java wrapper: JGIMP.

孤君无依 2024-09-03 05:52:41

我建议使用 C++ 库以及 Java 的接口。
例如,一种选择是英特尔性能基元,它针对 SSE 指令和多核进行了优化。对于某些操作,这可能会快几个数量级。
IPP 包括针对大多数基本操作的高度优化的功能,例如:模糊、颜色转换、不同的滤镜等。

I can recommend to use C++ libraries and interface from Java with them.
One option for example is Intel Performance Primitives, that are optimized for SSE instructions and multicore. For some operations this can be in order of magnitude faster.
IPP include highly optimized functions for most of the basic operations like: blur, color conversion, different filters, etc.

痴意少年 2024-09-03 05:52:41

我认为最好的办法是尝试选项 1),如果不够快,请尝试选项 2)。
我正在一些应用程序中进行服务器端图像处理,我发现性能非常好。

I think the best thing to do is try option 1), and if it is not fast enough, try option 2).
I am doing server-side image processing in some of my applications and I have found the performances to be quiet good.

宣告ˉ结束 2024-09-03 05:52:41

您应该研究 Java2D 包中的图像处理,如果可能的话,可以在具有合适显卡的 Windows 机器上运行,因为 Java 可以使用它来加速 Java2D 操作。

You should look into the image processing in the Java2D package and if at all possible run on a Windows box with a suitable graphics card as Java can use it to accelerate the Java2D operations.

笔落惊风雨 2024-09-03 05:52:41

Java 在无头环境中也会遇到类似的问题 在Java SE 平台不可用。

Java would have similar problems in a headless environment were Using Headless Mode in the Java SE Platform not available.

放手` 2024-09-03 05:52:41

@WizardOfOdds:如果我理解正确的话,我们需要 xvnc 来运行不应该无头运行的软件。但关键是,除非我们在托管环境上已经有 xvnc 或者我们有足够的权限来安装 xvnc,否则我们仍然无法在计算机上运行需要完整图形环境的软件。我认为大多数托管环境都是这种情况(除了它们提供的专用服务器,您可以完全控制)。如果我错了请纠正我。

@WizardOfOdds: If I understand you right, we need to have xvnc to run softwares that aren't supposed to run headless. But the point is unless we have xvnc already on the hosted env or we have enough rights to install xvnc, we still can't run softwares that require full graphical environment on the machine. I thought this was the case with most hosted environments (except the dedicated server they provide where you have full control). Correct me if I am wrong.

心碎无痕… 2024-09-03 05:52:41

如果您拥有服务器,最好的选择是安装一两个大型 GPU 并使用一些 GPU 加速库来进行图像处理。
在我自己的 CUDA(图像旋转)中的简单图像处理代码中,我使用 Geforce GTX-285(240 核 GPU)获得了超过 CPU 100 倍的加速

If you own the servers, the best possible option is to install a big fat GPU or two and use some GPU accelerated libraries to do your image processing.
In my own simple image processing code in CUDA (image rotation), I get more than 100x speedup over the CPU with a Geforce GTX-285 (240 core GPU)

夏末 2024-09-03 05:52:41

我不会拥有自己的服务器。我将不得不选择托管提供商。这使得安装可能需要 root 权限的软件变得有点复杂。

我使用 jhlabs 库在托管环境上部署了 java servlet,用于简单的图像处理操作(例如灰度缩放),并观察到两件事

  1. 尚未遇到无头环境的问题。当我稍后尝试进行更复杂的图像处理操作时,可能会遇到这个问题。
  2. 表现还不错。但我必须进行负载测试,以确保在实际负载下性能是可以接受的。

I wont be having my own servers. I will have to go with a hosting provider. This makes it a bit complicated when it comes to installing softwares that might require root permissions.

I deployed java servlet on a hosted environment using jhlabs library for simple image processing operations like gray scaling and observed 2 things

  1. Haven't run into problems with headless environment yet. Might hit this issue at a later point when I try to do more complicated image processing operations.
  2. The performance was not bad. But I have to do load testing to make sure that performance is acceptable under realistic load.
沉鱼一梦 2024-09-03 05:52:41

我正在开发一个用于在线图像创建和处理的网络应用程序,称为 rastaq (首次预览 http://rq-online .deesceha.de)。它是一个 Java Web 应用程序,所有图形都基于 Java 2D。它可以通过新的运算符和类型进行扩展。尝试一下,看看使用新参数重新计算图像需要多长时间。

硬件平台是 Intel 四核、8GB RAM 机器。

I am developing a web applicaton for online image creation and processing, called rastaq (first preview on http://rq-online.deesceha.de). It is a Java Web Application and all graphics are based on Java 2D. It is extensible by new Operators and Types. Play around and see, how long it takes to recompute an image with new parameters.

The hardware platform is an Intel Quad-Core, 8GB RAM machine.

古镇旧梦 2024-09-03 05:52:41

有许多图像处理框架可以在 Java 服务器端应用程序 (J2EE) 中使用。

看看 Marvin。您可以在 J2SE 应用程序中以相同的方式设置项目。如果您使用的是 Tomcat,请将 Marvin 文件夹复制到 tomcat 根目录中,并将 marvin_version.jar 添加到项目库中。您可以使用许多算法在服务器端处理任何图像。

如果遇到任何问题,请使用项目讨论组或 Google 了解如何在 J2EE 应用程序中使用 Marvin。

关于在服务器端运行 Marvin 的 stackoverflow 帖子:
将 MarvinFramework 添加到 Tomcat7 上的 Web 应用程序

There are many image processing frameworks that you can use in a Java server side applications (J2EE).

Take a look at Marvin. You can setup the project in the same way in a J2SE application. If you are using Tomcat, copy the Marvin folder into the tomcat root and add marvin_version.jar in your project libraries. You can process any image in server side using many algorithms.

In the case of having any problem, use the project Discussion Group or Google about how to use Marvin in a J2EE application.

An stackoverflow post about running Marvin on server side:
Adding MarvinFramework to a WebApp on Tomcat7

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文