MiaoRong / javacv

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

Problem using CvMat #174

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.The problem appears when I try to translate a c++ code to java, specifically 
in a method which uses a Mat data type.
2.I can´t find the Mat data type in javaCV so I try to translate this c++ 
method using CvMat.
3.After some iterations calling this method in the main class, it crash.

What is the expected output? What do you see instead?
The For loop in the main class should finish completely without produce any 
problem instead of this, it crashed throwing this error:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x032d4aa0, pid=2120, tid=2132
#
# JRE version: 7.0_03-b05
# Java VM: Java HotSpot(TM) Client VM (22.1-b02 mixed mode, sharing windows-x86 
)
# Problematic frame:
# C  [jniopencv_core7943748563839231264.dll+0x4aa0]
#
# Failed to write core dump. Minidumps are not enabled by default on client 
versions of Windows
#
# An error report file with more information is saved as:
# C:\Documents and Settings\Miguel\Desktop\MRF_java\PruebaMRF\hs_err_pid2120.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Java Result: 1

What version of the product are you using? On what operating system?
Opencv 2.3.1
xp sp3 operating system

Please provide any additional information below.
I attach the c++ method and it´s translation in java as well as the main java 
class where I call this method. I hope that you can help me, It´s the first 
time that I work with javaCV but I think that the problem is the change between 
Mat and CvMat in c++ and java code respectively. 

Thank you!

Original issue reported on code.google.com by migu...@gmail.com on 26 Mar 2012 at 10:01

Attachments:

GoogleCodeExporter commented 9 years ago
cvLoadImageM() never creates a CvMat with double data type. Instead, try to use 
a Pointer or a Buffer of the right type, or simply use CvMat.get()/put() as 
shown in the README.txt file. Let me know if this fixes your issue

Original comment by samuel.a...@gmail.com on 26 Mar 2012 at 10:43

GoogleCodeExporter commented 9 years ago
Hi Samuel! First of all thank you for your answer.
I was trying to use CvMat.get() as you advised me yesterday, the code doesn´t 
throw any error now but I´m not sure if I´m doing the same as in c++ code. I 
attached the new java code for you to take a look. My problem is that I don´t 
understand very well how work Mat.data() and Mat.step() in c++ versus 
CvMat.get() and CvMat.step() in java. I hope you can help me and solve my 
doubts.

Thank you again!

Original comment by migu...@gmail.com on 27 Mar 2012 at 10:52

Attachments:

GoogleCodeExporter commented 9 years ago
Mat.data is just a uchar pointer to the data. In the CvMat struct, this is 
data.ptr or .data_ptr()

Original comment by samuel.a...@gmail.com on 27 Mar 2012 at 11:00

GoogleCodeExporter commented 9 years ago
Would this answer your query by any chance?
http://stackoverflow.com/questions/9920449/converting-opencv-matrix-looping-to-j
avacv/10159783

Original comment by samuel.a...@gmail.com on 15 Apr 2012 at 10:20

GoogleCodeExporter commented 9 years ago
Thank you so much, Samuel! I think that this could answer my query.

Original comment by migu...@gmail.com on 16 Apr 2012 at 10:10

GoogleCodeExporter commented 9 years ago
Great, please ask your questions on the mailing list next time if possible! 
thank you

Original comment by samuel.a...@gmail.com on 12 May 2012 at 12:02

GoogleCodeExporter commented 9 years ago
A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x08cdacf0, pid=22164, tid=4972
#
# JRE version: 7.0_05-b05
# Java VM: Java HotSpot(TM) Client VM (23.1-b03 mixed mode, sharing windows-x86 
)
# Problematic frame:
# C  [opencv_ffmpeg240.dll+0x5acf0]  cvWriteFrame_FFMPEG+0x57a30
#
# Failed to write core dump. Minidumps are not enabled by default on client 
versions of Windows
#
# An error report file with more information is saved as:
# C:\Users\Achal\Desktop\Masters Project\DVSSv2\hs_err_pid22164.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
[h264 @ 09e256a0] no frame!
Java Result: 1

Hi i got this error and i am using IP camera can't fix the error, any help?

Original comment by acha...@gmail.com on 29 Jul 2012 at 11:50

GoogleCodeExporter commented 9 years ago
Please try follow these instructions:
Common issues with OpenCV under Windows 7 
http://code.google.com/p/javacv/wiki/Windows7AndOpenCV

Original comment by samuel.a...@gmail.com on 30 Jul 2012 at 1:12