什么是最好的 Java 图像处理库/方法?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/603283/
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
What is the best java image processing library/approach?
提问by Daniel Honig
I am using both the JAI media apis and ImageMagick?
我同时使用 JAI 媒体 API 和 ImageMagick?
ImageMagick has some scalability issues and the JNI based JMagick isn't attractive either. JAI has poor quality results when doing resizing operations compared to ImageMagick.
ImageMagick 有一些可扩展性问题,基于 JNI 的 JMagick 也没有吸引力。与 ImageMagick 相比,JAI 在执行调整大小操作时的结果质量较差。
Does anyone know of any excellent tools either open source or commercial that are native java and deliver high quality results?
有没有人知道任何优秀的开源或商业原生 Java 工具并提供高质量的结果?
采纳答案by Ivan
回答by fmsf
Processingis new but very, very good.
处理是新的,但非常非常好。
回答by Clayton
For commercial tools, you might want to try Snowbound.
对于商业工具,您可能想尝试 Snowbound。
My experience with them is somewhat dated, but I found their Java Imaging API to be a lot easier to use than JAI and a lot faster.
我对他们的体验有些过时,但我发现他们的 Java Imaging API 比 JAI 更容易使用,而且速度也更快。
Their customer support and code samples were very good too.
他们的客户支持和代码示例也非常好。
回答by kenny
I'm not a Java guy, but OpenCV is great for my needs. Not sure if it fits yours. Here's a Java port, I think: http://docs.opencv.org/2.4/doc/tutorials/introduction/desktop_java/java_dev_intro.html
我不是 Java 人,但 OpenCV 非常适合我的需求。不确定它是否适合你。这是一个 Java 端口,我认为:http: //docs.opencv.org/2.4/doc/tutorials/introduction/desktop_java/java_dev_intro.html
回答by rics
RoboRealm vision software listmentions JHLabsand NeatVisionamong lots of other non-Java based libraries.
RoboRealm 视觉软件列表在许多其他非基于 Java 的库中提到了JHLabs和NeatVision。
回答by Amanjit Gill
http://im4java.sourceforge.net/- if you're running linux forking a new process isn't expensive.
http://im4java.sourceforge.net/- 如果您运行 linux,分叉一个新进程并不昂贵。
回答by kajo
imo the best approach is using GraphicsMagick Image Processing Systemwith im4javaas a comand-line interface for Java.
imo 最好的方法是使用带有im4java 的GraphicsMagick 图像处理系统作为 Java 的命令行界面。
There are a lot of advantages of GraphicsMagick, but one for all:
GraphicsMagick 有很多优点,但只有一个:
- GM is used to process billions of files at the world's largest photo sites (e.g. Flickr and Etsy).
- GM 用于处理世界上最大的图片网站(例如 Flickr 和 Etsy)上的数十亿个文件。
回答by Riyad Kalla
I know this question is quite old, but as new software comes out it does help to get some new links to projects that might be interesting for folks.
我知道这个问题已经很老了,但是随着新软件的出现,它确实有助于获得一些可能对人们感兴趣的项目的新链接。
imgscalris pure-Java image resizing (and simple ops like padding, cropping, rotating, brighten/dimming, etc.) library that is painfully simple to use - a single class consists of a set of simple graphics operations all defined as staticmethods that you pass an image and get back a result.
imgscalr是纯 Java 图像大小调整(以及简单的操作,如填充、裁剪、旋转、变亮/变暗等)库,使用起来非常简单 - 单个类由一组简单的图形操作组成,所有这些操作都定义为静态方法您传递图像并返回结果。
The most basic example of using the library would look like this:
使用库的最基本示例如下所示:
BufferedImage thumbnail = Scalr.resize(image, 150);
And a more typical usage to generate image thumbnails using a few quality tweaks and the like might look like this:
使用一些质量调整等生成图像缩略图的更典型用法可能如下所示:
import static org.imgscalr.Scalr.*;
public static BufferedImage createThumbnail(BufferedImage img) {
// Create quickly, then smooth and brighten it.
img = resize(img, Method.SPEED, 125, OP_ANTIALIAS, OP_BRIGHTER);
// Let's add a little border before we return result.
return pad(img, 4);
}
All image-processing operations use the raw Java2D pipeline (which is hardware accelerated on major platforms) and won't introduce the pain of calling out via JNI like library contention in your code.
所有图像处理操作都使用原始 Java2D 管道(在主要平台上是硬件加速的),并且不会像代码中的库争用一样引入通过 JNI 调用的痛苦。
imgscalr has also been deployed in large-scale productions in quite a few places - the inclusion of the AsyncScalr class makes it a perfect drop-in for any server-side image processing.
imgscalr 也已部署在很多地方的大规模生产中 - 包含 AsyncScalr 类使其成为任何服务器端图像处理的完美替代品。
There are numerous tweaks to image-quality you can use to trade off between speed and quality with the highest ULTRA_QUALITY mode providing a scaled result that looks better than GIMP's Lancoz3 implementation.
对图像质量进行了大量调整,您可以使用最高 ULTRA_QUALITY 模式在速度和质量之间进行权衡,从而提供看起来比 GIMP 的 Lancoz3 实现更好的缩放结果。
回答by Diego Catalano
Try to use Catalano Framework.
尝试使用Catalano 框架。
Keypoints:
关键点:
- Architecture like AForge.NET/Accord.NET.
- Run in the both environments with the same code, desktop and Android.
- Contains several filters in parallel.
- Development is on full steam.
- 像 AForge.NET/Accord.NET 这样的架构。
- 在两种环境中运行,代码相同,桌面和Android。
- 包含多个并行过滤器。
- 发展如火如荼。
The Catalano Framework is a framework for scientific computing for Java and Android. The project started as an initial port of the many features of the AForge.NET and Accord.NET frameworks for .NET, but is steadily growing with more advanced features which are now being shared between those projects.
Catalano 框架是用于 Java 和 Android 的科学计算框架。该项目最初是 AForge.NET 和 Accord.NET 框架的许多功能的初始端口,用于 .NET,但随着更高级的功能正在稳步增长,这些功能现在正在这些项目之间共享。
Example:
例子:
FastBitmap fb = new FastBitmap(bitmap);
Grayscale g = new Grayscale();
g.applyInPlace(fb);
Threshold t = new Threshold(120);
t.applyInPlace(fb);
bitmap = fb.toBitmap();
//Show the result