Login  Register

ImageJ as library

Posted by dashko on Mar 12, 2010; 9:09am
URL: http://imagej.273.s1.nabble.com/ImageJ-as-library-tp3688632.html

Hi,
I am using ImageJ as library and need some help. So i have jPanel1 in my jFrame and i need import brightness/contrast functions and link these functions with my opened image. This is my implementation:

///////////////////////////////////////////////////////////////////////////////////////
        Graphics g = this.jPanel1.getGraphics();
        Point p = new Point(0,0);

        ImagePlus imp = IJ.openImage("/home/dashko/imgs/.obrazok.temp/obrazok4.jpg");
        ColorProcessor cp = (ColorProcessor) imp.getProcessor();
        int[] pixels = (int[]) cp.getPixels();
        BufferedImage bimg = new BufferedImage(cp.getWidth(),cp.getHeight(),BufferedImage.TYPE_INT_RGB);
        bimg.setRGB(0,0,cp.getWidth(),cp.getHeight(),pixels,0,cp.getWidth());

        g.drawImage(bimg, p.x, p.y, this.jPanel1);
///////////////////////////////////////////////////////////////////////////////////////      

So question: How can i change brightness and contrast in my jPanel1 image using ImageJ library?
Is there some doc with examples of using ImageJ as library?

I tried almost everything. Creating new objects of ContrastAdjuster, copying pieces of code in my jFrame. I think something very important is missing me. Please help me!

Or maybe you will tell me about another better library to process images easyli with examples?

Thank you very much.
Mike