Hi John,

I figured out similar problems at the beginning, but I finally found a
solution without any problem.

Here my solution, which works also for greyscales ... as an example for
GAUSS operators ...

The method returns a BufferedImage of the same type as you Src Image. Since
you sent over only a part of your program and it seems that you provide a
container for your images, their might be something wrong from this side.



  static public BufferedImage doGaussOp(BufferedImage bSrc, float sigma) {

// create a GaussKernel ... here you can do whatever is fine for your filter
            float f[] = createGaussKernelData(sigma);
            int fsize = (int) Math.sqrt(f.length);
            Kernel kernel = new Kernel (fsize,fsize,f);

            ConvolveOp m = new ConvolveOp(kernel);

//                new
RenderingHints(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF));

            BufferedImage bDest = IPL.createCopy(bSrc);
            WritableRaster ras = bSrc.getRaster();
            WritableRaster aim=  bDest.getRaster();
            m.filter(ras,aim);
            return bDest;


> I have a grayscale image stored in a BufferedImage as TYPE_BYTE_GRAY that
> I
> want to run through a sharpening filter.  However, the results I get when
> doing this in Java is far inferior to what I get when I load the image in
> Paint Shop Pro (PSP) and run it through a sharpen filter in this
> application.  I have a few thoughts on why this might be -
>
> 1.  Before I can sharpen the image in PSP I am forced to increase its
> color
> depth to 24 bits (16 million colors).  So, perhaps there is some way I can
> increase the color depth of my BufferedImage in Java before I do the
> sharpen operation.
>
> 2.  There is something wrong with my sharpen code.  Here it is -
>
>     public void sharpen()
>     {
>          float[] sharpenArray = { 0, -1, 0, -1, 5, -1, 0, -1, 0 };
>
>          Kernel kernel = new Kernel(3, 3, sharpenArray );
>          ConvolveOp cOp = new ConvolveOp(kernel, ConvolveOp.EDGE_NO_OP,
> null);
>          imageToDisplay = cOp.filter(imageToDisplay, null );
>          imagePanel.setImage( imageToDisplay );
>     }
>
>
> 3.  It is not possible to obtain results equal to a professional image
> editing program through the standard Java2D APIs (I hope this is not the
> case).
>
> Any thoughts on how to improve the sharpen results would be greatly
> appreciated...
>
> Thanks.
>
> John
>
>
===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> of the message "signoff JAVA2D-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>

--
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to