hi guys i am an infant for image processing technique in java , i have decided to develop one project in image processing so i need what are the algorithms are followed and also which one is easier to develop please some one guide me it may be great for me.....and al开发者_高级运维so which technology is best for image processing java or Matlab? guide me...
For image segmentation in JAVA you can also consider to use open-source IMMI tool (http://spl.utko.feec.vutbr.cz/en/). In comparison to Matlab, it is (in my opinion) more simple to use and simply enables also image mining.
You can use the Java Advanced Imaging (JAI) Library to do image processing in java. You have to decide for yourself whether Java or MATLAB is better for you.
Algorithm for Image segmentation depends upon what type of output you want after segmentation. Each algorithm performs a different segmentation. I think the region growing or Flood Fill is good for this purpose. You can use Java/JAI and JavaCV for this Image processing tasks.
I think the best image processing tool for you depends on the kind of project you're working on.
If you're working on a research project that needs productivity, quick validation and writting reports, Matlab and similar tools are the best option. On the other hand, if you're developing a software product, Java, C++, C, Objective-C, etc is more indicated. Matlab solutions are not easy to deliver and maintain in production.
Since you asked how to do image segmentation in Java, I'll provide an example using Java and Marvin Image Processing Framework. As suggested by @Asif Sharif, FloodFill segmentation is a good strategy and I used it!
INPUT IMAGE:
OUTPUT IMAGE:
HOW IT WORKS:
- Load input image.
- Change green pixels to white pixels.
- Apply intensity thresholding for separating foreground from background.
- Apply morphological closing to group separated parts of the same object
- Use FloodFill segmentation to get the segments.
- Draw the segments coordinates in the original image.
SOURCE:
import static marvin.MarvinPluginCollection.*;
public class SimpleSegmentation {
public SimpleSegmentation(){
// 1. Load image
MarvinImage original = MarvinImageIO.loadImage("./res/robocup.jpg");
MarvinImage image = original.clone();
// 2. Change green pixels to white
filterGreen(image);
// 3. Use threshold to separate foreground and background.
MarvinImage bin = MarvinColorModelConverter.rgbToBinary(image, 127);
// 4. Morphological closing to group separated parts of the same object
morphologicalClosing(bin.clone(), bin, MarvinMath.getTrueMatrix(30, 30));
// 5. Use Floodfill segmention to get image segments
image = MarvinColorModelConverter.binaryToRgb(bin);
MarvinSegment[] segments = floodfillSegmentation(image);
// 6. Show the segments in the original image
for(int i=1; i<segments.length; i++){
MarvinSegment seg = segments[i];
original.drawRect(seg.x1, seg.y1, seg.width, seg.height, Color.yellow);
original.drawRect(seg.x1+1, seg.y1+1, seg.width, seg.height, Color.yellow);
}
MarvinImageIO.saveImage(original, "./res/robocup_segmented.png");
}
private void filterGreen(MarvinImage image){
int r,g,b;
for(int y=0; y<image.getHeight(); y++){
for(int x=0; x<image.getWidth(); x++){
r = image.getIntComponent0(x, y);
g = image.getIntComponent1(x, y);
b = image.getIntComponent2(x, y);
if(g > r*1.5 && g > b*1.5){
image.setIntColor(x, y, 255,255,255);
}}}
}
public static void main(String[] args) { new SimpleSegmentation(); }
}
MATLAB is better for image processing. And the best way is to find special image processing tools (or libraries).
精彩评论