I am new to image processing in java .
I was given a task to re-size and scale images image of a web site
Is there a simple Library that will do this task?
a library where i have to download a jar - added to my project ?
I prefer not to be forced to install codecs and files to the windows.
I need the library to support only the basic functions
Lib.cropImage();
Lib.resizImage();
Lib.scaleImage()
I already found a library called JAI but I can't find the jar to download it.
Am I missing something ?
You can use the standard Image class part of Java libraries.
Scaling images should be fairly easy by using Image.getScaledInstance(int width, int height, int hints)
For cropping, use BufferedImage.getSubimage() (see this StackOverflow Q&A for more details). For resizing, use Graphics.drawImage() (see this StackOverflow answer for more details). And for scaling, use Image.getScaledInstance().
Other options are:
JMagick (see this StackOverflow answer).
ImageJ
Use ProcessBuilder to execute ImageMagick commands.
The Java2D library ought to be sufficient enough.
For image processing puroses I would recommend a package from the following list.
In your case JAI would do the job, and you can download it here.
Have you tried imageJ which boasts to be world's fastest pure Java image processing program
Related
I would like to use FFmpeg library on my android app.
I have no C/C++/Make knowledge and all the threads I've been reading about it talk about stuff I completely don't understand.
Is there any pre-compiled library which I can add to my project, then add a simple 'import' statement on my java class and then call it?
Thanks
Is there any particular reason why you need exactly FFmpeg? I guess it could be possible to get prebuilt binaries, but since it is a C library, you would also need a JNI wrapper code - I don't think anyone would generate that for the whole library since it's quite large, so even with a prebuilt library you still need to have some JNI knowledge to wire through the communication between Java and FFmpeg in C. Just for the purpose of demonstration - here is an example.
Apart from that if there is not a special reason to use FFmpeg, why can't you stick with MediaCodec that is a part of the Android API? It wraps the native StageFright library and could provide hardware support on devices where it is available, while FFmpeg would be a CPU only solution. Of course, if some unpopular codecs or muxers that are not available in MediaCodec are needed, then FFmpeg is the way.
You can use Xuggler for encoding and decoding audio and video. Their wesite says "Xuggler extensively uses FFmpeg to compress and uncompress media".
You could use precompiled libs from the JavaCPP Presets along with FFmpegFrameRecorder from JavaCV to compress images as well as audio samples, as shown in the RecordActivity sample, for example.
I'm working on a college project, where I need to handle images in java. Sometime ago I worked in math lab and it was so easy, so I would like to know if exits any java library that could let me play with the pixels values, color(by pixel), RGB model, gray-scale img, etc.
I don't know matlab, but I worked with Java image processing a lot... Java standard library provides tons of methods to work with images on low level. You can access image pixels through BufferedImage. Make sure to read and understand the classes BufferedImageOp, RasterOp and ConvolveOp otherwise you may end up reinventing stuff.
The best examples for java image processing are on http://www.jhlabs.com/ There you can also find open source image editor and the source code for all the image effect demos.
Look at BufferedImages. You can load/save/edit images with it
http://download.oracle.com/javase/6/docs/api/java/awt/image/BufferedImage.html
http://download.oracle.com/javase/tutorial/2d/images/index.html
You might want to take a look at the following classes:
java.awt.image.BufferedImage
java.awt.image.Raster
javax.imageio.ImageIO
Depending on the image formats you might also have to look (I hope not) at JAI and JAI-imageio.
Well, there is a library available in Java which can help to access Matlab code with in Java program. Please check http://code.google.com/p/matlabcontrol/
I tend to use DataBuffer objects for this kind of stuff. It's not very fast, but if you want to get out pixel information easily, it's the easiest way to do it. It's stored in the Raster of the BufferedImage.
I'm developing a project for doing Content Based Image Retrieval where front end will be in java.
The main issue is about choosing tool for performing image processing. Since Matlab provides a lot of functionality for doing CBIR. But the main problem about using Matlab is that you need to have Matlab installed on every computer using the application.
Is there any other way in which I can do my project (Using other tools or driver) so that my application will run without using any other tools ???
Or can I develop entire application in Matlab only and deploy it as a standalone application ???
Thank you..
There are plenty of image processing libraries, for example for Java: ImageJ, there is also one by the Apache Commons project. If you need higher-level computer vision libraries there is OpenCV for C++ that also has bindings for Java, for example.
You can also develop the entire application in Matlab, but to deploy a stand alone application requires this requires licensing Mathworks Builder NE (which can be expensive). Matlab is very good for research and prototyping purposes.
There are other alternatives that are amenable to quick prototyping for example Python and PIL.
I think the bottom line is that there are plenty of options.
Java image utilities library: A Java library for loading, editing, analyzing and saving pixel image files.
It supports various file formats.
Provides demo applications for the command line. It has AWT GUI toolkit too.
Matlab is an excellent tool for prototyping as already pointed out by carlosdc. Matlab offers limited options with regard to UI programming. GUIDE is ok for small projects, but hinders more than it helps on bigger ones.
With MATLAB Builder JA you're able to compile your Matlab code into Java classes.
With regard to plotting time series in real time, libraries like JFreeChart are way slower.
I think OpenCV is one of the best libraries out there for image processing but Java Advanced Imaging is also quite good but doesn't has as much features and examples. Color similarity would be simple in JAI but shape probably would involve more code.
If you choose to use OpenCV I think you have at least two possible binding implementations for Java. The one my group uses is this one. It has some Processing dependencies.
Regardless of what library you choose be prepared for some frustration. Matlab users are used to all the nice features it provides and when they have to port their code to other languages end having to write a lot more code.
Well, after a long search finally I've found the way to deploy Matlab code along with java that too standalone application..
The steps are simple::--
1. Go and get Javabuilder.jar file located at location::
Matlab\toolbox\javabuilder\jar\javabuilder.jar
Next type deploytool in Matlabs command line...
deploytool window will open now create a new java project.
Select Matlab files that you want to use.
The deploytool will now convert the .m file to .jar file.
Now use both of the above mentioned jar files and develop your java compatible matlab code
and thats the way you can create the standalone application of matlab..
I am just wondering what kind of computing/programming language/frameworks are needed to produce images such as the one in http://www.erdas.com/ ?
Programmatically, how does one produce the general spatial analysis images ?
ps: I use java most of the time.
Thanks
First of all, uDIG, OpenJUMP (not sure about this) cannot process images in a way that ERDAS can. These softwares are great, but they do not have extensive raster funcionality.
You need to take a look at GDAL, which covers a bunch of languages and can manipulate imagery.
http://www.gdal.org/
As we speak the PostGIS team is building most of PostGIS WKT Raster funcionality on top of GDAL. It is a fantastic tool and consolidated library.
I'm not sure which image do you mean, but geospatial images can be manipulated by software called GIS. Examples in Java are:
OpenJUMP
uDig
and a spatial manipulation library:
GeoTools
You need to obtain the imagery from a provider and then you analyze it with various tools. For raster you could also look at sextante as a raster analysis library written in Java.
The tools mentioned above are the two best Java Desktop options unless you speak spanish and then I would reccomend gvSIG.
I am on an embedded platform without access to AWT. I was wondering if anyone knew of a standalone library to load images without any AWT involvement.
Thanks,
Braden McDorman
Perhaps AWT headless mode can help?
http://java.sun.com/developer/technicalArticles/J2SE/Desktop/headless/
I took the semi-easy way out and created a tool to convert images to RGB565 raw files. Then I have a custom loader.
Have a look at JIMI.
http://java.sun.com/products/jimi/
Easy to work with, bought by Sun, superceeded by JAI which is not as easy to work with.
(And now the page is Oracle-branded...)
Not a standalone library and not sure what your platform offers, but you can try the javax.imageio.ImageIO (Java SE 1.4 and later).
Just use one of the read methods to get a BufferedImage.