C++ 图像处理库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2982711/
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
C++ Image Processing Libraries
提问by user123668
I am looking for a C++ library for image processing. I need the library to threshold a PPM photo (color photo). Should I write my own code? what do you guys think?
我正在寻找用于图像处理的 C++ 库。我需要库来阈值 PPM 照片(彩色照片)。我应该编写自己的代码吗?你们有什么感想?
回答by Brendan Long
回答by M. Williams
回答by Charl Botha
All of the above options should be able to do what you required.
以上所有选项都应该能够满足您的要求。
I would like to add OpenCVto the list. It's a fast cross-platform computer vision library with extensive image loading, saving and processing support. It's written in C, but it has a solid C++ interface, which I have used in the past.
我想将OpenCV添加到列表中。它是一个快速的跨平台计算机视觉库,具有广泛的图像加载、保存和处理支持。它是用 C 编写的,但它有一个可靠的 C++ 接口,我过去使用过。
That being said: Reading / writing PPMs is straight-forward, so if all you need is to read and threshold, you should definitely consider doing it yourself. It would come down to reading the PPM bytes into memory, greyscaling by averaging the RGB color channels (note that averaging the RGB channels is one, very simple, method to greyscale; there are more), then thresholding and writing away.
话虽如此:读/写 PPM 很简单,所以如果你只需要阅读和阈值,你绝对应该考虑自己做。这将归结为将 PPM 字节读入内存,通过平均 RGB 颜色通道进行灰度缩放(请注意,对 RGB 通道进行平均是一种非常简单的灰度方法;还有更多),然后进行阈值处理并写入。
回答by ErmIg
The Simd LibraryThe is a free open source image processing library, designed for C and C++ programmers. It provides many useful high performance algorithms for image processing such as: pixel format conversion, image scaling and filtration, extraction of statistic information from images, motion detection, object detection (HAAR and LBP classifier cascades) and classification, neural network.
的SIMD库的是一个免费的开源图像处理库,设计用于C和C ++程序员。它为图像处理提供了许多有用的高性能算法,例如:像素格式转换、图像缩放和过滤、从图像中提取统计信息、运动检测、对象检测(HAAR 和 LBP 分类器级联)和分类、神经网络。
The algorithms are optimized with using of different SIMD CPU extensions. In particular the library supports following CPU extensions: SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX-512 for x86/x64, VMX(Altivec) and VSX(Power7) for PowerPC, NEON for ARM.
这些算法通过使用不同的 SIMD CPU 扩展进行了优化。特别是该库支持以下 CPU 扩展:SSE、SSE2、SSE3、SSSE3、SSE4.1、SSE4.2、AVX、AVX2 和 AVX-512 for x86/x64、VMX(Altivec) 和 VSX(Power7) for PowerPC、NEON对于 ARM。
The Simd Library has C API and also contains useful C++ classes and functions to facilitate access to C API. The library supports dynamic and static linking, 32-bit and 64-bit Windows and Linux, MSVS, G++ and Clang compilers, MSVS project and CMake build systems.
Simd 库具有 C API,还包含有用的 C++ 类和函数以方便访问 C API。该库支持动态和静态链接、32 位和 64 位 Windows 和 Linux、MSVS、G++ 和 Clang 编译器、MSVS 项目和 CMake 构建系统。
P.S. I participate in the development of this project.
PS我参与了这个项目的开发。
回答by bvalabas
The CImg Libraryis a popular choice too. It is really simple to use, lightweight and already have a lot of basic and advanced image processing operators implemented.
CImg 库也是一个流行的选择。它使用起来非常简单,重量轻,并且已经实现了许多基本和高级的图像处理操作符。
回答by Rafay
回答by Vitalii
Very good library is GD2
非常好的库是GD2
This library has multiple languages bindings, including C (which is compatible with C++ of course). It is easy to build GD as a static or dynamic library with actually any C++ compiler, including GCC and Visual C++, also pre-built binaries are available over Internet. Unlike Boost image library, it allows to load/save images from/to memory and not hard drive only.
该库具有多种语言绑定,包括 C(当然与 C++ 兼容)。使用任何 C++ 编译器,包括 GCC 和 Visual C++,都可以轻松地将 GD 构建为静态或动态库,也可以通过 Internet 获得预构建的二进制文件。与 Boost 图像库不同,它允许从/向内存加载/保存图像,而不仅仅是硬盘驱动器。