Re: [JAVA2D] Problem with Affine transform

2003-06-26 Thread Carlos Rodriguez
 -Original Message-
 From: Chris Campbell [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, June 24, 2003 8:29 PM
 To: Carlos Rodriguez
 Cc: [EMAIL PROTECTED]
 Subject: Re: [JAVA2D] Problem with Affine transform
 
 
 Hi Carlos,
 
 I'm not entirely sure what you mean when you say the pixels 
 are messed  
 up, but it doesn't look like you're doing anything wrong. 

To be more specific, this is how it looks like: take the original image, reduce it by 
85 percent, mirror it, and then, across the top of the target image, paste both of 
these.  Then draw black pixels across the rest of the image.  The actual target image 
has the right dimensions, but the pixles are displayed as above.
 
 You may be able to work around the problem by copying the resulting  
 INT_ARGB BufferedImage into a BI of the same type as your 
 source when  
 the AffineTransformOp is finished processing.  Then you can use that  
 image with the rest of your image processing routines.

The problem with this approach is that the original image had pixels composed of 
16-bit values.  I expected (I might be wrong) for the scaling/bilinear interpolation 
process to yield another array of 16 bit values.  If I get an array of ARGB values 
instead, I don't think the 16 bit values I needed for subsequent calculations will 
actually be there.  From what I see in the debugger, they look like RGB tuples to me 
(admittedly, the image itself looks grey enough).

I will put together a test case and report it soon.

-Carlos Rodriguez
 
 Thanks,
 Chris
 
 On Tuesday, June 24, 2003, at 04:10  PM, Carlos Rodriguez wrote:
  Hi:
 
  I am encountering a very bizarre problem while trying to 
 scale a 16-bit
  UShort image using the AffineTransformOp class.  Basically 
 what happens
  is that, if I create a compatible destination image with the
  createCompatibleDestImage() method,  when I actually call the filter
  method the resulting image has its pixels messed up.  
 However, if I  
  leave
  it to the filter method (by setting the second arg to 
 null), the pixels
  *look* good, but they are RGB and therefore unusable for 
 any further  
  image
  processing (at least to me).  For some reason the latter method  
  produces a
  TYPE_INT_ARGB image.  Can anyone help me understand this?
 
  Here's the code (where img is being passed in):
 
  double factor   = 0.25;
  AffineTransform at  = new AffineTransform();
  at.setToScale(factor, factor);
  AffineTransformOp op= new  
  AffineTransformOp(at,AffineTransformOp.TYPE_BILINEAR);
  BufferedImage retval= op.createCompatibleDestImage(img,  
  img.getColorModel());
  //
  //this one will produce an image of the correct type, but broken
  //
  BufferedImage result = op.filter(imgs[0], retval );
  //
  //this one will produce an image that looks good but is of 
 the wrong  
  type:
  //
  BufferedImage result2 = op.filter(img, retval );
 
 
  The relevant aspects of the source image are (dumped from the  
  debugger):
 
  colorModel= java.awt.image.ComponentColorModel  (id=46)
  imageType= 11
  raster= sun.awt.image.ShortInterleavedRaster  (id=61)
  dataBuffer= java.awt.image.DataBufferUShort  (id=64)
  height= 2457width= 2048numBands= 1
  sampleModel= java.awt.image.PixelInterleavedSampleModel  (id=67)
   dataType= 1 numBands= 1numBanks= 1 
 pixelStride= 1  
  scanlineStride= 2048
 
  Thanks in advance for your help.
 
  -Carlos Rodriguez
 
  P.S. I can't use JAI.
 
  
 ==
 = 
  
  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.
 
 

==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.


Re: [JAVA2D] Problem with Affine transform

2003-06-25 Thread Michel Ivanovsky
STOP SENDING US MESSAGES !

Dmitri Trembovetski wrote:

   It'd also help if you specify the jdk version you're using, and the
   platform you're running it on.

   Thank you,
 Dmitri

 On Tue, Jun 24, 2003 at 05:28:58PM -0700, Chris Campbell wrote:
   Hi Carlos,
  
   I'm not entirely sure what you mean when you say the pixels are messed
   up, but it doesn't look like you're doing anything wrong.  You may have
   hit a bug in AffineTransformOp.  Please submit a bug report and attach
   a simple testcase that we can run to reproduce the problem.
  
   You may be able to work around the problem by copying the resulting
   INT_ARGB BufferedImage into a BI of the same type as your source when
   the AffineTransformOp is finished processing.  Then you can use that
   image with the rest of your image processing routines.
  
   Thanks,
   Chris
  
   On Tuesday, June 24, 2003, at 04:10  PM, Carlos Rodriguez wrote:
   Hi:
   
   I am encountering a very bizarre problem while trying to scale a 16-bit
   UShort image using the AffineTransformOp class.  Basically what happens
   is that, if I create a compatible destination image with the
   createCompatibleDestImage() method,  when I actually call the filter
   method the resulting image has its pixels messed up.  However, if I
   leave
   it to the filter method (by setting the second arg to null), the pixels
   *look* good, but they are RGB and therefore unusable for any further
   image
   processing (at least to me).  For some reason the latter method
   produces a
   TYPE_INT_ARGB image.  Can anyone help me understand this?
   
   Here's the code (where img is being passed in):
   
   double factor   = 0.25;
   AffineTransform at  = new AffineTransform();
   at.setToScale(factor, factor);
   AffineTransformOp op= new
   AffineTransformOp(at,AffineTransformOp.TYPE_BILINEAR);
   BufferedImage retval= op.createCompatibleDestImage(img,
   img.getColorModel());
   //
   //this one will produce an image of the correct type, but broken
   //
   BufferedImage result = op.filter(imgs[0], retval );
   //
   //this one will produce an image that looks good but is of the wrong
   type:
   //
   BufferedImage result2 = op.filter(img, retval );
   
   
   The relevant aspects of the source image are (dumped from the
   debugger):
   
   colorModel= java.awt.image.ComponentColorModel  (id=46)
   imageType= 11
   raster= sun.awt.image.ShortInterleavedRaster  (id=61)
   dataBuffer= java.awt.image.DataBufferUShort  (id=64)
   height= 2457width= 2048numBands= 1
   sampleModel= java.awt.image.PixelInterleavedSampleModel  (id=67)
dataType= 1 numBands= 1numBanks= 1 pixelStride= 1
   scanlineStride= 2048
   
   Thanks in advance for your help.
   
   -Carlos Rodriguez
   
   P.S. I can't use JAI.
   
   ===
   
   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.
  
   ===
   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.

 ===
 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.

===
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.


Re: [JAVA2D] Problem with Affine transform

2003-06-25 Thread Michel Ivanovsky
STOP SENDING US MESSAGES !

Carlos Rodriguez wrote:

 Hi:

 I am encountering a very bizarre problem while trying to scale a 16-bit
 UShort image using the AffineTransformOp class.  Basically what happens
 is that, if I create a compatible destination image with the
 createCompatibleDestImage() method,  when I actually call the filter
 method the resulting image has its pixels messed up.  However, if I leave
 it to the filter method (by setting the second arg to null), the pixels
 *look* good, but they are RGB and therefore unusable for any further image
 processing (at least to me).  For some reason the latter method produces a
 TYPE_INT_ARGB image.  Can anyone help me understand this?

 Here's the code (where img is being passed in):

 double factor   = 0.25;
 AffineTransform at  = new AffineTransform();
 at.setToScale(factor, factor);
 AffineTransformOp op= new AffineTransformOp(at,AffineTransformOp.TYPE_BILINEAR);
 BufferedImage retval= op.createCompatibleDestImage(img, img.getColorModel());
 //
 //this one will produce an image of the correct type, but broken
 //
 BufferedImage result = op.filter(imgs[0], retval );
 //
 //this one will produce an image that looks good but is of the wrong type:
 //
 BufferedImage result2 = op.filter(img, retval );

 The relevant aspects of the source image are (dumped from the debugger):

 colorModel= java.awt.image.ComponentColorModel  (id=46)
 imageType= 11
 raster= sun.awt.image.ShortInterleavedRaster  (id=61)
 dataBuffer= java.awt.image.DataBufferUShort  (id=64)
 height= 2457width= 2048numBands= 1
 sampleModel= java.awt.image.PixelInterleavedSampleModel  (id=67)
  dataType= 1 numBands= 1numBanks= 1 pixelStride= 1 
 scanlineStride= 2048

 Thanks in advance for your help.

 -Carlos Rodriguez

 P.S. I can't use JAI.

 ===
 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.

===
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.


Re: [JAVA2D] Problem with Affine transform

2003-06-24 Thread Chris Campbell
Hi Carlos,

I'm not entirely sure what you mean when you say the pixels are messed
up, but it doesn't look like you're doing anything wrong.  You may have
hit a bug in AffineTransformOp.  Please submit a bug report and attach
a simple testcase that we can run to reproduce the problem.
You may be able to work around the problem by copying the resulting
INT_ARGB BufferedImage into a BI of the same type as your source when
the AffineTransformOp is finished processing.  Then you can use that
image with the rest of your image processing routines.
Thanks,
Chris
On Tuesday, June 24, 2003, at 04:10  PM, Carlos Rodriguez wrote:
Hi:

I am encountering a very bizarre problem while trying to scale a 16-bit
UShort image using the AffineTransformOp class.  Basically what happens
is that, if I create a compatible destination image with the
createCompatibleDestImage() method,  when I actually call the filter
method the resulting image has its pixels messed up.  However, if I
leave
it to the filter method (by setting the second arg to null), the pixels
*look* good, but they are RGB and therefore unusable for any further
image
processing (at least to me).  For some reason the latter method
produces a
TYPE_INT_ARGB image.  Can anyone help me understand this?
Here's the code (where img is being passed in):

double factor   = 0.25;
AffineTransform at  = new AffineTransform();
at.setToScale(factor, factor);
AffineTransformOp op= new
AffineTransformOp(at,AffineTransformOp.TYPE_BILINEAR);
BufferedImage retval= op.createCompatibleDestImage(img,
img.getColorModel());
//
//this one will produce an image of the correct type, but broken
//
BufferedImage result = op.filter(imgs[0], retval );
//
//this one will produce an image that looks good but is of the wrong
type:
//
BufferedImage result2 = op.filter(img, retval );
The relevant aspects of the source image are (dumped from the
debugger):
colorModel= java.awt.image.ComponentColorModel  (id=46)
imageType= 11
raster= sun.awt.image.ShortInterleavedRaster  (id=61)
dataBuffer= java.awt.image.DataBufferUShort  (id=64)
height= 2457width= 2048numBands= 1
sampleModel= java.awt.image.PixelInterleavedSampleModel  (id=67)
 dataType= 1 numBands= 1numBanks= 1 pixelStride= 1
scanlineStride= 2048
Thanks in advance for your help.

-Carlos Rodriguez

P.S. I can't use JAI.

===

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.
===
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.


Re: [JAVA2D] Problem with Affine transform

2003-06-24 Thread Dmitri Trembovetski
  It'd also help if you specify the jdk version you're using, and the
  platform you're running it on.

  Thank you,
Dmitri

On Tue, Jun 24, 2003 at 05:28:58PM -0700, Chris Campbell wrote:
  Hi Carlos,
 
  I'm not entirely sure what you mean when you say the pixels are messed
  up, but it doesn't look like you're doing anything wrong.  You may have
  hit a bug in AffineTransformOp.  Please submit a bug report and attach
  a simple testcase that we can run to reproduce the problem.
 
  You may be able to work around the problem by copying the resulting
  INT_ARGB BufferedImage into a BI of the same type as your source when
  the AffineTransformOp is finished processing.  Then you can use that
  image with the rest of your image processing routines.
 
  Thanks,
  Chris
 
  On Tuesday, June 24, 2003, at 04:10  PM, Carlos Rodriguez wrote:
  Hi:
  
  I am encountering a very bizarre problem while trying to scale a 16-bit
  UShort image using the AffineTransformOp class.  Basically what happens
  is that, if I create a compatible destination image with the
  createCompatibleDestImage() method,  when I actually call the filter
  method the resulting image has its pixels messed up.  However, if I
  leave
  it to the filter method (by setting the second arg to null), the pixels
  *look* good, but they are RGB and therefore unusable for any further
  image
  processing (at least to me).  For some reason the latter method
  produces a
  TYPE_INT_ARGB image.  Can anyone help me understand this?
  
  Here's the code (where img is being passed in):
  
  double factor   = 0.25;
  AffineTransform at  = new AffineTransform();
  at.setToScale(factor, factor);
  AffineTransformOp op= new
  AffineTransformOp(at,AffineTransformOp.TYPE_BILINEAR);
  BufferedImage retval= op.createCompatibleDestImage(img,
  img.getColorModel());
  //
  //this one will produce an image of the correct type, but broken
  //
  BufferedImage result = op.filter(imgs[0], retval );
  //
  //this one will produce an image that looks good but is of the wrong
  type:
  //
  BufferedImage result2 = op.filter(img, retval );
  
  
  The relevant aspects of the source image are (dumped from the
  debugger):
  
  colorModel= java.awt.image.ComponentColorModel  (id=46)
  imageType= 11
  raster= sun.awt.image.ShortInterleavedRaster  (id=61)
  dataBuffer= java.awt.image.DataBufferUShort  (id=64)
  height= 2457width= 2048numBands= 1
  sampleModel= java.awt.image.PixelInterleavedSampleModel  (id=67)
   dataType= 1 numBands= 1numBanks= 1 pixelStride= 1
  scanlineStride= 2048
  
  Thanks in advance for your help.
  
  -Carlos Rodriguez
  
  P.S. I can't use JAI.
  
  ===
  
  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.
 
  ===
  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.

===
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.