rindarith / javacv

Automatically exported from code.google.com/p/javacv
GNU General Public License v2.0
0 stars 0 forks source link

IplImage.create error: java.awt.image.SinglePixelPackedSampleModel cannot be cast to java.awt.image.ComponentSampleModel #102

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Obtain a bufferedimage with SinglePixelPackedSampleModel, such as one 
obtained via Robot.captureScreen
2. Try to convert this bufferedimage to IplImage using IplImage.create

What is the expected output? What do you see instead?
Should not have any error. It was working fine before in 0705 version. But it 
is now throwing typecast error at (opencv_core.java:860)

What version of the product are you using? On what operating system?
0820, all operating system

Please provide any additional information below.
860: pixelSize = ((ComponentSampleModel)sm).getPixelStride();
should probably be replaced with pixelSize=1

Original issue reported on code.google.com by doubles...@gmail.com on 27 Aug 2011 at 6:47

GoogleCodeExporter commented 9 years ago
Yes, thanks for reporting

Original comment by samuel.a...@gmail.com on 28 Aug 2011 at 1:54

GoogleCodeExporter commented 9 years ago
Need this too

Original comment by josse.br...@gmail.com on 24 Sep 2011 at 2:11

GoogleCodeExporter commented 9 years ago
Fixed in latest release

Original comment by samuel.a...@gmail.com on 1 Oct 2011 at 1:44

GoogleCodeExporter commented 9 years ago
I'm using version 2.3.1a. Was the problem fixed in which version?

image.toString():
BufferedImage@c62c8: type = 1 DirectColorModel: rmask=ff0000 gmask=ff00 
bmask=ff amask=0 IntegerInterleavedRaster: width = 320 height = 240 #Bands = 3 
xOff = 0 yOff = 0 dataOffset[0] 0

Error:
java.lang.ClassCastException: java.awt.image.SinglePixelPackedSampleModel 
cannot be cast to java.awt.image.ComponentSampleModel
Can't open input Streamjava.io.IOException: Stream closed at 
com.googlecode.javacv.cpp.opencv_core$IplImage.copyFrom(opencv_core.java:860)
Can't open input Streamjava.io.IOException: Stream closed at 
com.googlecode.javacv.cpp.opencv_core$IplImage.createFrom(opencv_core.java:485)

Original comment by alepe....@gmail.com on 16 Nov 2011 at 9:23

GoogleCodeExporter commented 9 years ago
Nevermind... I just updated the svn version and it seems to work! Thanks!

Original comment by alepe....@gmail.com on 16 Nov 2011 at 9:29