What are some cross platform and high performance image libraries for image processing (resizing and finding the color/hue histograms). No gui needed. This is for C/C++.
So far I have looked in to
OpenCV
GIL as part of Boost
DevIL
CImg
My questions
How's the performance of the ones I have listed above
What are some other libraries
Your input much appreciated.
OpenCV has quite good performance. It should be sufficient for most cases.
To improve performance, you can also use OpenCV together with Intel IPP, which is however a non-free commercial product. If OpenCV detects that IPP is installed it will use it where possible.
As a third option you can use IPP directly. IPP was designed with high performance (on Intel architectures) as a goal. It is optimized to use the intel SIMD instructions.
imagemagick is quite popular.
I don't think I've seen anything better in features and performance than HALCON from MVTec. It provides all sort computer vision and image processing algorithms out-of-the-box and plenty of real life examples. The library uses multithreading as much as algorithms could possibly allow and GPU when available. It's very cross-platform and provides a fantastic IDE that will allow you to export your prototype code (algorithm) to many languages including C, C++, C# and more.
One of the best features of this library is how they treat region objects. It is just incredibly smart and efficient both for storage and mask processing. Unfortunately OpenCV has a lot to learn from it.
The main problem with this package is the price (stupidly high) but if you are working on a project where you don't need to deploy runtime licenses (e.g. SaaS) then this is the way to go, look no further if you require serious image processing and computer vision.
Don't forget to look at CxImage - I've used it professionally in globally deployed graphics intensive mobile phone applications, where it performed perfectly and it's so full of features. Do check it out!
I help maintain libvips, a free, cross-platform C/C++ scientific image-processing library. It is fast and works well on very large images.
I did a very simple benchmark: load a 10,000 x 10,000 pixel RGB tif, crop 100 pixels off every edge, shrink 10%, sharpen, and save again. On this trivial test at least, vips is more than twice as fast as anything else I've tried.
The C++ API is documented here. For example:
#include <vips/vips8>
using namespace vips;
int
main( int argc, char **argv )
{
// startup, load plugins, init support libraries, etc.
if (VIPS_INIT(argv[0]))
vips_error_exit(NULL);
// the "sequential" access hint means we plan to only read this image
// top-to-bottom (eg. no 90 degree rotates) ... this means libvips can
// stream the image and run decode and processing in
// parallel on separate threads
VImage image = VImage::new_from_file(argv[1],
VImage::option()->set("access", "sequential"));
// shrink to 20% and find the histogram
VImage hist = image.resize(0.2).hist_find();
hist.write_to_file(argv[2]);
return 0;
}
You can run this program with any input and output image format, for example:
$ g++ -g -Wall resize.cpp `pkg-config vips-cpp --cflags --libs`
$ ./a.out ~/pics/wtc.jpg x.csv
And it'll read the JPG input and write the histogram to the CSV file.
There is a simple and free open source cross-platform image processing library Simd. As follows from its description:
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.
The algorithms are optimized with using of different SIMD CPU extensions: SSE, SSE2, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX-512 for x86/x64, VMX(Altivec) and VSX(Power7) for PowerPC, NEON for ARM.
You might want to look at IM. It builds on several platforms, and has support for (modular) image file formats, a variety of image representations, and a wide array of transformations and operators. A GUI tool, IMLab, for demonstrating image processing operators based on the IM library is also available.
There are also VTK and ITK, with a huge amount of manifold image processing algorithms.
There are also:
Framewave based on AMD Performance Library which provides signal and image processing features
GraphicsMagick multi-threaded derivative from ImageMagick
ExactImage is a fast C++ image processing library. Unlike many other library
frameworks it allows operation in several color spaces and bit depths
natively, resulting in low memory and computational requirements.
We used Accusoft for quite a while, but for very specific reasons we switched to LeadTools, which exists for windows only.
Accusoft has a very clear and much more well defined interface than leadtools. Both libraries are very robust and both claim to read more or less all existing file types. Both also have quite responsive support.
Related
I have tested a lot of different C++ library's(SIGL, PLplot, libharu and some other randoms) for plotting but i have not found anyone that suites my need or is working properly.
My need is to create a histogram and a dot diagram using 100 000 - 1000 000 values from a 2 dimensional matrix. Save it to a picture png or jpeg format preferred.
I use Visual studio 2010 and have a Windows XP operating system.
I need to be able to use C++ and I would prefer if there was some good documentation on the library too.
Note is that I do not want to use Matlab, since that is what I am replacing.
Love
Pewdut
I definitely sympathize with not wanting to use Matlab. If it's just the non-free aspect you don't like, then Octave is a good alternative, it is a fairly complete Matlab clone escept for the gui-building facilities.
I use the GSL (very highly recommended) for creating histograms, it has library functions for doing this (1- and 2-D), and its data structures (matrix, vector) can handle at least 300,000 x 64 doubles (This is as high as I've gone on a 2GB RAM machine, naturally more RAM = more capacity, probably). It is very fast. For graphing, I use Qt, and the Qwt toolbox within it has specific functions for making histograms. The example doesn't show it but axis labels and legends are straightforward. Qt is relatively heavyweight, but superb imo.
Edit: The author of Qwt gives a list of the classes/functions that support exporting plots, here.
I have a simple question, which I want to know, what kind of libraries are available and can give good results for implementing SIFT, HOG(Histogram Oriented Gradient) and SURF in c++ or opencv?
Hence: 1- Give me the link for the code if you can, which I will be so appreciated.
2- If you know one of them or any kind of information to lead me to what I want, I will be so appreciated as well.
Thanks
check these:
surf
- great article
http://people.csail.mit.edu/kapu/papers/mar_mir08.pdf
sift
- great source, I tried it on the iPhone
http://blogs.oregonstate.edu/hess/
- fast - fast corner detection library
http://svr-www.eng.cam.ac.uk/~er258/work/fast.html
Example of surf code in openCV
https://code.ros.org/trac/opencv/browser/trunk/opencv/samples/cpp/matching_to_many_images.cpp
Not sure if this is still relevant, but you also get two implementations of computing HOG descriptors in opencv i.e. both GPU and CPU versions of the HOG code.
for the CPU version you can check this blog post
however in the CPU version you would need to write your own logic for sliding windows.
and the GPU version is fairly straightforward you can read the documentation here
Might help you to know that SIFT and SURF implementations are already integrated into OpenCV.
http://opencv.willowgarage.com/documentation/cpp/features2d__feature_detection_and_descriptor_extraction.html
Be careful about OpenCV implementations, because latest versions of OpenCV have classified SIFT and SURF implementations as nonfree http://docs.opencv.org/modules/nonfree/doc/nonfree.html.
Now you can use them, but probably they are subject to licensing and cannot be used for commercial solutions.
This one uses descriptors based on HoG, Sobel and Lab channels for detection Class-Specific Hough Forests for Object Detection (opencv/c source code).
Rather then performing detection at every possible location this approach calculates a vote for each descriptor, then when putted together they produce a voting cloud where maximum will correspond to most probable location of the target. When combined with cvGoodFeaturesToTrack can produce very good results, even with a small training database.
I am a little overwhelmed by my task at hand. We have a toolkit which we use for TWAIN scanning. Some of our customers are complaining about slower scan speeds when the deskew option is set. This is because if their scanner does not support a hardware deskew, it is done in post-processing on the CPU. I was wondering if anyone knows of a good (i.e. fast) algorithm to achieve this. It is hard for me to say what algorithm we are using now. What algorithms are out there for this, and how do they rank as far as speed/accuracy? If I knew the names of the algorithms, it could be easier for me to do a google search on them.
Thank You.
-Tom
Are you scanning in Color or B/W ?
Deskew is processor intensive. A Group4 tiff or JPEG must be decompressed, skew angle determined, deskewed and then compressed.
There are many image processing algorithms out there with deskew and I have evaluated many over the years. There are some huge differences in processing speed between the different libraries and a lot of it comes down to how well it is coded rather than the algorithm used. There is a huge difference in commercial libraries just reading and writing images.
The fastest commerical deskew I have used by far comes from Unisoft Imaging (www.unisoftimaging.com). I assume much of it is written in assembler. Unisoft has been around for many years and is very fast and efficient. It supports different many different deskew options including black border removal, color and B/W deskew. The Group4 routines are very solid and very fast. The library comes with many other image processing options as well as TWAIN and native SCSI scanner support. It also supports Unix.
If you want a free deskew then you might want to have a look at Leptonica. It does not come with too much documentation but is very stable and well written. http://www.leptonica.com/
Developing code from scratch could be quite time consuming and may be quite buggy and prone to errors.
The other option is to process the document in a separate process so that scanning can run at the speed of the scanner. At the moment you are probably processing everything in a parallel fashion, one task after another, hence the slowdown.
Consider doing it as post-processing, because deskew cannot be done at real-time (unless it's hardware accelerated).
Deskew consists of two steps: skew detection and rotation. Detecting the skew angle can usually be done on a B&W (1-bit) image faster. Rotation speed depends on the quality of the interpolation. A good quality deskew will take a lot of time to run, much more than scanning pages.
A good high speed scanner can do 120 double-sided pages per minute, if it has hardware JPEG or TIFF Group 4 compression, and your TWAIN library takes advantage of it (hint: do not use native mode). You barely have enough time to save the file to the hard drive at that speed, let alone decompress, skew detect, rotate, re-compress. Quality deskew takes several seconds per page, unless you can use the video card's hardware accelerator to rotate and compress.
Do I correctly understand you already have such algorithm implemented? If so, are you sure there is no space for optimization? I'd start with profiling existing solution.
Anyway, I guess you should look for fast digital Radon transform algorithm.
Take a look at http://pagetools.sourceforge.net. They have deskew algorithm implementation.
I'm currently using MFC/GDI and Stingray to display bitmaps in my application and am looking for a better solution. Specifically;
Faster drawing speed - My current solution is slow, based on StretchDIBits
Better rendering quality - StretchDIBits rendering quality is awful when scaling a bitmap
Support for rotated bitmaps
Support for loading / saving in all popular formats
Support for large bitmaps - I'm regularly using aerial photographs that are ~64mb as 12,000x12,000 jpegs. GeoTIFF support would also be useful
Compatible with MFC document/view, including printing (e.g. must be able render to a CDC)
Access to source code is good but not necessary
Easy to use / port existing GDI code
While free is always nice, I don't mind spending a reasonable amount on a decent library, though no run time royalty costs. Googling suggests the following;
CImg
Graphics Magick
Lead Tools imaging SDK
Anyone got experience of these or can recommend an good alternative?
GDI+ is available on any Windows machine since early XP. It has codecs for all popular image formats, JPEG is included. Very nice filters for high-quality image rescaling. Unrestricted image rotation. Draws to a CDC through the Graphics class. Source code for the C++ wrappers are available in the SDK gdiplusXxx.h header files. Speed is likely to be equivalent however, rendering is software based to ensure compatibility.
You can #include <gdiplus.h> and use the C++ wrappers directly. The SDK docs are here. The CImage class is available in MFC, it doesn't expose all capabilities however.
I think it's unlikely you'll find something that performs faster than GDI on windows since it has kernel-level support which is something open source solutions will not have.
You might want to also look into OpenGL or Direct2D/Direct3D since these too have direct access to the frame buffer. With 3D APIs, texture size would probably be an issue since most standards limit to something like 4096x4096.
I have used CxImage in the past which is one to add to your evaluation list.
In the past I've saved RGB images (generated from physical simulations) as 8-bits/channel PPM or PNG or JPEG.
Now I want to preserve the dynamic range of the simulation output, which means saving a floating point image and then treating conversion to 8-bits/channel as a post-processing step (so I can tweak the conversion to 8-bit without running the lengthy simulation again).
Has a "standard" floating point image format emerged ?
Good free supporting libraries/viewers/manipulation tools, preferably available in Debian, would be a bonus.
Have you looked into Radiance RGBE (.hdr) and OpenEXR (.exr). RGBE has some source code here. NVIDIA and ATI both support EXR data in their graphics cards. There are source code and binaries from the OpenEXR download page. ILM created OpenEXR and it has wide support. OpenEXR has support for 16 and 32 bit floating point per channel, and is what most people use these days, unless they've written their own format.
The Pixel Image Editor for linux has EXR support for editing, too.
pfstools is also necessary if you're going to work with HDR on linux. Its a set of command line programs for reading, writing and manipulating HDR and has Qt and OpenGL viewers.
Theres also jpeg2exr for linux
Heres some other debian packages for OpenEXR viewers.
Based on this, it looks like theres also a Gimp plugin somewhere.
It looks like the modern incarnation of FITS would fit your stated needs, but I would also suggest you consider using a 2D histogram structure from one of the good analysis packages in wide use by the physics community: ROOT or AIDA are the modern ones that I am familiar with.
NB: It's been more than a decade since I used FITS for anything, but I recall it begin a nice and flexible way to store fairly raw data.
For future reference, also rather widespread is the TIFF format. You can use the free and open-source LibTIFF for I/O.