how to apply UnSharpMask to bufferred image?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

how to apply UnSharpMask to bufferred image?

ashishdonvir
Hello all
in my application i required to apply unsharp mask to my 16 bit image. i tried a lot  to do this but dint get success.(confuset in making object of imageprocessor)
now can any any tell me how to use imajeJ's UnsharpMask  class in my application.
one think is that here i am not suppose to open dilog box or any imajeJ window. i just have my buffered image  and i want to apply unsharp mask using imajeJ library.

here is what i had tried so far
  ImagePlus imp = new ImagePlus("newimg", bufferedimage);
         ImageProcessor ip=imp.getProcessor();
       ij.plugin.filter.UnsharpMask up=new UnsharpMask();
       up. sharpenFloat((FloatProcessor)ip, radius, (float)weight);

and got the error
Exception in thread "main" java.lang.ClassCastException: ij.process.ShortProcessor cannot be cast to ij.process.FloatProcessor
        at unsharpmaskfilter.UnsharpMaskFilter.main(UnsharpMaskFilter.java:37)
       
Reply | Threaded
Open this post in threaded view
|

Re: how to apply UnSharpMask to bufferred image?

Barry DeZonia
Hello,

inserting ip = ip.convertToFloat(); after the ip = imp.getProcessor(); line
should get you farther

On Thu, May 31, 2012 at 2:34 PM, ashishdonvir <[hidden email]>wrote:

> Hello all
> in my application i required to apply unsharp mask to my 16 bit image. i
> tried a lot  to do this but dint get success.(confuset in making object of
> imageprocessor)
> now can any any tell me how to use imajeJ's UnsharpMask  class in my
> application.
> one think is that here i am not suppose to open dilog box or any imajeJ
> window. i just have my buffered image  and i want to apply unsharp mask
> using imajeJ library.
>
> here is what i had tried so far
>  ImagePlus imp = new ImagePlus("newimg", bufferedimage);
>         ImageProcessor ip=imp.getProcessor();
>       ij.plugin.filter.UnsharpMask up=new UnsharpMask();
>       up. sharpenFloat((FloatProcessor)ip, radius, (float)weight);
>
> and got the error
> Exception in thread "main" java.lang.ClassCastException:
> ij.process.ShortProcessor cannot be cast to ij.process.FloatProcessor
>        at
> unsharpmaskfilter.UnsharpMaskFilter.main(UnsharpMaskFilter.java:37)
>
>
>
> --
> View this message in context:
> http://imagej.1557.n6.nabble.com/how-to-apply-UnSharpMask-to-bufferred-image-tp4998862.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> _______________________________________________________
>
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

_______________________________________________________

ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: how to apply UnSharpMask to bufferred image?

ashishdonvir
after doing this i got this error
Exception in thread "main" java.lang.NullPointerException
        at ij.plugin.filter.UnsharpMask.sharpenFloat(UnsharpMask.java:56)
        at unsharpmaskfilter.UnsharpMaskFilter.main(UnsharpMaskFilter.java:65)