kallyani1989 / javacv

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

Error calling cvCvtColor #109

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a new project as described on QuickStart for Opencv 
http://code.google.com/p/javacv/
2. Use Android Emulator and upload a image to SD card.

What is the expected output? What do you see instead?
Gray image. Error:
Caused by: java.lang.RuntimeException:
/home/saudet/workspace/android/OpenCV-2.3.1/modules/imgproc/src/color.cpp:3175: 
error: (-215) dst.data == dst0.data in function void cvCvtColor(const CvArr*, 
CvArr*, int)

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

Windows 7 - 64 bit
javacv-bin-20110820
OpenCV 2.3.1

Please provide any additional information below.

I'm starting working with OpenCV and Java language.
The following line works well in Visual Studio 2010:

Mat src;
char* window_name = "Demo"; 
src = imread("c:\\temp\\images\\myImage.bmp");
cvtColor( src, src, CV_RGB2GRAY );
imshow( window_name, src );

-------------------------------------------------------
On Eclipse I tried this:

CvMat imageSrc = cvLoadImageM("/sdcard/myImage.bmp");
cvCvtColor( imageSrc, imageSrc, CV_RGB2GRAY );

When calling the cvCvtColor I received the error described above.
I'm able to save the image using cvSaveImage (so, the image is loading 
properly).

I appreciate any help.
Thanks,
Rafael.

Original issue reported on code.google.com by rkrind...@gmail.com on 20 Sep 2011 at 3:41

GoogleCodeExporter commented 8 years ago
Hi,
I was able to "workaround" using:

CvMat imageDst = CvMat.create(imageSrc.rows(), imageSrc.cols(),CV_8U,1);
cvCvtColor( imageSrc, imageDst, CV_RGB2GRAY );

I found these on the readme file...
Thanks!

Original comment by rkrind...@gmail.com on 20 Sep 2011 at 4:30

GoogleCodeExporter commented 8 years ago
Great to hear it's working!

Original comment by samuel.a...@gmail.com on 30 Sep 2011 at 1:23