kyamagu / mexopencv

Collection and a development kit of matlab mex functions for OpenCV library
http://kyamagu.github.io/mexopencv
Other
664 stars 319 forks source link

error testing mexopencv from matlab #369

Closed shicaiwei123 closed 6 years ago

shicaiwei123 commented 6 years ago

hi

I am having trouble running the test code when I finished the compilation of mexopencv on Windows 10 and matlab2015a

this is the error

 UnitTest
== TestANN_MLP ======
-- test_1 ------

------------------------------------------------------------------------
          Access violation detected at Thu Nov 09 20:03:21 2017
------------------------------------------------------------------------

Configuration:
  Crash Decoding      : Disabled
  Crash Mode          : continue (default)
  Current Graphics Driver: ATI Technologies Inc. AMD Radeon R5 M230 Version 4.5.13447 Compatibility Profile Context 0
  Default Encoding    : GBK
  Graphics card 1     : Intel Corporation ( 0x8086 ) Intel(R) HD Graphics Family Version 20.19.15.4642
  Graphics card 2     : Advanced Micro Devices, Inc. ( 0x1002 ) AMD Radeon R5 M230 Version 16.300.2101.0
  Host Name           : AFAAW-704030720
  MATLAB Architecture : win64
  MATLAB Root         : D:\MATLAB
  MATLAB Version      : 8.5.0.197613 (R2015a)
  OpenGL              : hardware
  Operating System    : Microsoft Windows 10 专业版
  Processor ID        : x86 Family 6 Model 69 Stepping 1, GenuineIntel
  Virtual Machine     : Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
  Window System       : Version 10.0 (Build 14393)

Fault Count: 1

Abnormal termination:
Access violation

Register State (from fault):
  RAX = 0000000e0000000b  RBX = 0000000000000005
  RCX = 0000000000010420  RDX = de37e90623c90d82
  RSP = 00000000043ebe00  RBP = 0000000000000000
  RSI = 000000009ca1c620  RDI = 000000003c3f65a8

   R8 = 000000009ca1c630   R9 = 0000000000008000
  R10 = 0000000000000000  R11 = 00000000043ebeb0
  R12 = 0000000000000000  R13 = 000000430000003f
  R14 = 0000000013ae0000  R15 = 000000000000008c

  RIP = 00007ff9f7a5cacf  EFL = 00010a02

   CS = 0033   FS = 0053   GS = 002b

Stack Trace (from fault):
[  0] 0x00007ff9f7a5cacf                      C:\windows\SYSTEM32\ntdll.dll+00248527 RtlFreeHeap+00000863
[  1] 0x0000000067d18d94                   D:\MATLAB\bin\win64\MSVCR100.dll+00429460 free+00000028
[  2] 0x00007ff9e93ba1ae       D:\mexopencv-2.4\+cv\private\ANN_MLP_.mexw64+00041390 mexFunction+00020638
[  3] 0x00007ff9e93b5fd9       D:\mexopencv-2.4\+cv\private\ANN_MLP_.mexw64+00024537 mexFunction+00003785
[  4] 0x00000000fc5f3751                     D:\MATLAB\bin\win64\libmex.dll+00079697 mexRunMexFile+00000129
[  5] 0x00000000fc5f2a72                     D:\MATLAB\bin\win64\libmex.dll+00076402 inSwapMexfileReader+00000594
[  6] 0x00000000fc5f25c8                     D:\MATLAB\bin\win64\libmex.dll+00075208 mexUnlock+00002840
[  7] 0x0000000010cc2694               D:\MATLAB\bin\win64\m_dispatcher.dll+00075412 Mfh_file::dispatch_fh+00000548
[  8] 0x0000000010cc2a7e               D:\MATLAB\bin\win64\m_dispatcher.dll+00076414 Mfunction_handle::dispatch+00000766
[  9] 0x0000000010e36ca6              D:\MATLAB\bin\win64\m_interpreter.dll+00355494 inGetCurrentWS+00127158
[ 10] 0x0000000010e36414              D:\MATLAB\bin\win64\m_interpreter.dll+00353300 inGetCurrentWS+00124964
[ 11] 0x0000000010e3c64c              D:\MATLAB\bin\win64\m_interpreter.dll+00378444 inGetCurrentWS+00150108
[ 12] 0x0000000010e3bcd5              D:\MATLAB\bin\win64\m_interpreter.dll+00376021 inGetCurrentWS+00147685
[ 13] 0x0000000010dff19c              D:\MATLAB\bin\win64\m_interpreter.dll+00127388 in_is_matlab_function+00072012
[ 14] 0x0000000010e3d9aa              D:\MATLAB\bin\win64\m_interpreter.dll+00383402 inGetCurrentWS+00155066
[ 15] 0x0000000010e3ce8c              D:\MATLAB\bin\win64\m_interpreter.dll+00380556 inGetCurrentWS+00152220
[ 16] 0x0000000010e3b6e9              D:\MATLAB\bin\win64\m_interpreter.dll+00374505 inGetCurrentWS+00146169
[ 17] 0x0000000010cc2694               D:\MATLAB\bin\win64\m_dispatcher.dll+00075412 Mfh_file::dispatch_fh+00000548
[ 18] 0x0000000010cc2a7e               D:\MATLAB\bin\win64\m_dispatcher.dll+00076414 Mfunction_handle::dispatch+00000766
[ 19] 0x000000001aeb3a94                  D:\MATLAB\bin\win64\mcos_impl.dll+00146068
[ 20] 0x000000001aeb2a1c                  D:\MATLAB\bin\win64\mcos_impl.dll+00141852
[ 21] 0x000000001aeb1356                  D:\MATLAB\bin\win64\mcos_impl.dll+00136022
[ 22] 0x000000001aebf047                  D:\MATLAB\bin\win64\mcos_impl.dll+00192583
[ 23] 0x000000001aea79b4                  D:\MATLAB\bin\win64\mcos_impl.dll+00096692
[ 24] 0x0000000010cc2ce4               D:\MATLAB\bin\win64\m_dispatcher.dll+00077028 Mfh_MATLAB_fn::dispatch_fh+00000452
[ 25] 0x000000001aed6dd0                  D:\MATLAB\bin\win64\mcos_impl.dll+00290256
[ 26] 0x0000000010cc2a7e               D:\MATLAB\bin\win64\m_dispatcher.dll+00076414 Mfunction_handle::dispatch+00000766
[ 27] 0x0000000010df4569              D:\MATLAB\bin\win64\m_interpreter.dll+00083305 in_is_matlab_function+00027929
[ 28] 0x0000000010df3d52              D:\MATLAB\bin\win64\m_interpreter.dll+00081234 in_is_matlab_function+00025858
[ 29] 0x0000000010df333f              D:\MATLAB\bin\win64\m_interpreter.dll+00078655 in_is_matlab_function+00023279
[ 30] 0x0000000010df2eef              D:\MATLAB\bin\win64\m_interpreter.dll+00077551 in_is_matlab_function+00022175
[ 31] 0x0000000010dfbdcb              D:\MATLAB\bin\win64\m_interpreter.dll+00114123 in_is_matlab_function+00058747
[ 32] 0x0000000010dfa09c              D:\MATLAB\bin\win64\m_interpreter.dll+00106652 in_is_matlab_function+00051276
[ 33] 0x0000000010ec684f              D:\MATLAB\bin\win64\m_interpreter.dll+00944207 MathWorks::MException::MExceptionEnvelope::MCOSClassID+00000991
[ 34] 0x0000000010ec67b1              D:\MATLAB\bin\win64\m_interpreter.dll+00944049 MathWorks::MException::MExceptionEnvelope::MCOSClassID+00000833
[ 35] 0x0000000010e3da75              D:\MATLAB\bin\win64\m_interpreter.dll+00383605 inGetCurrentWS+00155269
[ 36] 0x0000000010e3ce8c              D:\MATLAB\bin\win64\m_interpreter.dll+00380556 inGetCurrentWS+00152220
[ 37] 0x0000000010e3b6e9              D:\MATLAB\bin\win64\m_interpreter.dll+00374505 inGetCurrentWS+00146169
[ 38] 0x0000000010cc2694               D:\MATLAB\bin\win64\m_dispatcher.dll+00075412 Mfh_file::dispatch_fh+00000548
[ 39] 0x0000000010cc2a7e               D:\MATLAB\bin\win64\m_dispatcher.dll+00076414 Mfunction_handle::dispatch+00000766
[ 40] 0x000000001aeb3a94                  D:\MATLAB\bin\win64\mcos_impl.dll+00146068
[ 41] 0x000000001aeb2a1c                  D:\MATLAB\bin\win64\mcos_impl.dll+00141852
[ 42] 0x000000001aeb1356                  D:\MATLAB\bin\win64\mcos_impl.dll+00136022
[ 43] 0x000000001aebe882                  D:\MATLAB\bin\win64\mcos_impl.dll+00190594
[ 44] 0x000000001aebe746                  D:\MATLAB\bin\win64\mcos_impl.dll+00190278
[ 45] 0x0000000010cc2ce4               D:\MATLAB\bin\win64\m_dispatcher.dll+00077028 Mfh_MATLAB_fn::dispatch_fh+00000452
[ 46] 0x000000001aed6dd0                  D:\MATLAB\bin\win64\mcos_impl.dll+00290256
[ 47] 0x0000000010cc2a7e               D:\MATLAB\bin\win64\m_dispatcher.dll+00076414 Mfunction_handle::dispatch+00000766
[ 48] 0x0000000010debe56              D:\MATLAB\bin\win64\m_interpreter.dll+00048726 inCallFcn+00000230
[ 49] 0x0000000010debdb7              D:\MATLAB\bin\win64\m_interpreter.dll+00048567 inCallFcn+00000071
[ 50] 0x0000000010ed8194              D:\MATLAB\bin\win64\m_interpreter.dll+01016212 inFullFevalFcn+00000244
[ 51] 0x0000000010cc2f5e               D:\MATLAB\bin\win64\m_dispatcher.dll+00077662 mdLogging::log_function_exit+00000110
[ 52] 0x0000000010cc295c               D:\MATLAB\bin\win64\m_dispatcher.dll+00076124 Mfunction_handle::dispatch+00000476
[ 53] 0x0000000010df9597              D:\MATLAB\bin\win64\m_interpreter.dll+00103831 in_is_matlab_function+00048455
[ 54] 0x0000000010dfa1ab              D:\MATLAB\bin\win64\m_interpreter.dll+00106923 in_is_matlab_function+00051547
[ 55] 0x0000000010ec684f              D:\MATLAB\bin\win64\m_interpreter.dll+00944207 MathWorks::MException::MExceptionEnvelope::MCOSClassID+00000991
[ 56] 0x0000000010ec67b1              D:\MATLAB\bin\win64\m_interpreter.dll+00944049 MathWorks::MException::MExceptionEnvelope::MCOSClassID+00000833
[ 57] 0x0000000010e3da75              D:\MATLAB\bin\win64\m_interpreter.dll+00383605 inGetCurrentWS+00155269
[ 58] 0x0000000010e3ce8c              D:\MATLAB\bin\win64\m_interpreter.dll+00380556 inGetCurrentWS+00152220
[ 59] 0x0000000010e3b6e9              D:\MATLAB\bin\win64\m_interpreter.dll+00374505 inGetCurrentWS+00146169
[ 60] 0x0000000010cc2694               D:\MATLAB\bin\win64\m_dispatcher.dll+00075412 Mfh_file::dispatch_fh+00000548
[ 61] 0x0000000010cc2a7e               D:\MATLAB\bin\win64\m_dispatcher.dll+00076414 Mfunction_handle::dispatch+00000766
[ 62] 0x000000001aeb3a94                  D:\MATLAB\bin\win64\mcos_impl.dll+00146068
[ 63] 0x000000001aeb2a1c                  D:\MATLAB\bin\win64\mcos_impl.dll+00141852
[ 64] 0x000000001aeb1356                  D:\MATLAB\bin\win64\mcos_impl.dll+00136022
[ 65] 0x000000001aebe882                  D:\MATLAB\bin\win64\mcos_impl.dll+00190594
[ 66] 0x0000000010e81867              D:\MATLAB\bin\win64\m_interpreter.dll+00661607 inGetValueFromWorkspace+00002935
[ 67] 0x0000000010cc2f5e               D:\MATLAB\bin\win64\m_dispatcher.dll+00077662 mdLogging::log_function_exit+00000110
[ 68] 0x0000000010cc295c               D:\MATLAB\bin\win64\m_dispatcher.dll+00076124 Mfunction_handle::dispatch+00000476
[ 69] 0x0000000010df9597              D:\MATLAB\bin\win64\m_interpreter.dll+00103831 in_is_matlab_function+00048455
[ 70] 0x0000000010dfa1ab              D:\MATLAB\bin\win64\m_interpreter.dll+00106923 in_is_matlab_function+00051547
[ 71] 0x0000000010ec684f              D:\MATLAB\bin\win64\m_interpreter.dll+00944207 MathWorks::MException::MExceptionEnvelope::MCOSClassID+00000991
[ 72] 0x0000000010ec67b1              D:\MATLAB\bin\win64\m_interpreter.dll+00944049 MathWorks::MException::MExceptionEnvelope::MCOSClassID+00000833
[ 73] 0x0000000010e3da75              D:\MATLAB\bin\win64\m_interpreter.dll+00383605 inGetCurrentWS+00155269
[ 74] 0x0000000010e3ce8c              D:\MATLAB\bin\win64\m_interpreter.dll+00380556 inGetCurrentWS+00152220
[ 75] 0x0000000010e3b6e9              D:\MATLAB\bin\win64\m_interpreter.dll+00374505 inGetCurrentWS+00146169
[ 76] 0x0000000010cc2694               D:\MATLAB\bin\win64\m_dispatcher.dll+00075412 Mfh_file::dispatch_fh+00000548
[ 77] 0x0000000010cc2a7e               D:\MATLAB\bin\win64\m_dispatcher.dll+00076414 Mfunction_handle::dispatch+00000766
[ 78] 0x000000001aeb3a94                  D:\MATLAB\bin\win64\mcos_impl.dll+00146068
[ 79] 0x000000001aeb8a7a                  D:\MATLAB\bin\win64\mcos_impl.dll+00166522
[ 80] 0x000000001aeb5740                  D:\MATLAB\bin\win64\mcos_impl.dll+00153408
[ 81] 0x000000001aeb2bee                  D:\MATLAB\bin\win64\mcos_impl.dll+00142318
[ 82] 0x000000001aeb1356                  D:\MATLAB\bin\win64\mcos_impl.dll+00136022
[ 83] 0x000000001aeb6f4f                  D:\MATLAB\bin\win64\mcos_impl.dll+00159567
[ 84] 0x000000001aeb37b5                  D:\MATLAB\bin\win64\mcos_impl.dll+00145333
[ 85] 0x000000001aebe66a                  D:\MATLAB\bin\win64\mcos_impl.dll+00190058
[ 86] 0x0000000010cc2ce4               D:\MATLAB\bin\win64\m_dispatcher.dll+00077028 Mfh_MATLAB_fn::dispatch_fh+00000452
[ 87] 0x000000001aed6dd0                  D:\MATLAB\bin\win64\mcos_impl.dll+00290256
[ 88] 0x0000000010cc2a7e               D:\MATLAB\bin\win64\m_dispatcher.dll+00076414 Mfunction_handle::dispatch+00000766
[ 89] 0x0000000010df9597              D:\MATLAB\bin\win64\m_interpreter.dll+00103831 in_is_matlab_function+00048455
[ 90] 0x0000000010f131a7              D:\MATLAB\bin\win64\m_interpreter.dll+01257895 inIsKeyword+00027799
[ 91] 0x0000000010dfb69a              D:\MATLAB\bin\win64\m_interpreter.dll+00112282 in_is_matlab_function+00056906
[ 92] 0x0000000010ec684f              D:\MATLAB\bin\win64\m_interpreter.dll+00944207 MathWorks::MException::MExceptionEnvelope::MCOSClassID+00000991
[ 93] 0x0000000010ec67b1              D:\MATLAB\bin\win64\m_interpreter.dll+00944049 MathWorks::MException::MExceptionEnvelope::MCOSClassID+00000833
[ 94] 0x0000000010e3da75              D:\MATLAB\bin\win64\m_interpreter.dll+00383605 inGetCurrentWS+00155269
[ 95] 0x0000000010e3ce8c              D:\MATLAB\bin\win64\m_interpreter.dll+00380556 inGetCurrentWS+00152220
[ 96] 0x0000000010e3b6e9              D:\MATLAB\bin\win64\m_interpreter.dll+00374505 inGetCurrentWS+00146169
[ 97] 0x0000000010cc2757               D:\MATLAB\bin\win64\m_dispatcher.dll+00075607 Mfh_file::dispatch_fh+00000743
[ 98] 0x0000000010cc2a7e               D:\MATLAB\bin\win64\m_dispatcher.dll+00076414 Mfunction_handle::dispatch+00000766
[ 99] 0x0000000010ecb268              D:\MATLAB\bin\win64\m_interpreter.dll+00963176 inAnonymousFunction+00000360
[100] 0x0000000010ecb864              D:\MATLAB\bin\win64\m_interpreter.dll+00964708 inAnonymousFunction+00001892
[101] 0x0000000010ecba25              D:\MATLAB\bin\win64\m_interpreter.dll+00965157 inAnonymousFunction+00002341
[102] 0x0000000010ecb9f2              D:\MATLAB\bin\win64\m_interpreter.dll+00965106 inAnonymousFunction+00002290
[103] 0x0000000010ecb9a7              D:\MATLAB\bin\win64\m_interpreter.dll+00965031 inAnonymousFunction+00002215
[104] 0x0000000010e7f6bd              D:\MATLAB\bin\win64\m_interpreter.dll+00652989 inGetCallersWorkSpace+00001805
[105] 0x0000000010e7854d              D:\MATLAB\bin\win64\m_interpreter.dll+00623949 inEvalCmdWithLocalReturn+00000285
[106] 0x0000000010e78471              D:\MATLAB\bin\win64\m_interpreter.dll+00623729 inEvalCmdWithLocalReturn+00000065
[107] 0x00000000fb5fe82d                D:\MATLAB\bin\win64\libmwbridge.dll+00059437 mnGetPrompt+00002717
[108] 0x00000000fb5ff2a9                D:\MATLAB\bin\win64\libmwbridge.dll+00062121 mnParser+00000745
[109] 0x00000000fd0e13d4                        D:\MATLAB\bin\win64\mcr.dll+00398292 mcrInstance::mnParser_on_interpreter_thread+00000036
[110] 0x00000000fd0a9757                        D:\MATLAB\bin\win64\mcr.dll+00169815 mcr::runtime::setInterpreterThreadToCurrent+00019751
[111] 0x00000000fd0a9793                        D:\MATLAB\bin\win64\mcr.dll+00169875 mcr::runtime::setInterpreterThreadToCurrent+00019811
[112] 0x00000000fd0a9f91                        D:\MATLAB\bin\win64\mcr.dll+00171921 mcr::runtime::setInterpreterThreadToCurrent+00021857
[113] 0x00000000fab5d216                        D:\MATLAB\bin\win64\uiw.dll+00512534 UIW_AttachThreadInput+00001270
[114] 0x00000000fab5caa5                        D:\MATLAB\bin\win64\uiw.dll+00510629 wsd_to_MSW+00004373
[115] 0x00000000fab5cb29                        D:\MATLAB\bin\win64\uiw.dll+00510761 wsd_to_MSW+00004505
[116] 0x00007ff9f4fe28cf                     C:\windows\System32\USER32.dll+00207055 EmptyClipboard+00000751
[117] 0x00007ff9f4fcf339                     C:\windows\System32\USER32.dll+00127801 GetPropW+00000697
[118] 0x00007ff9f4fcf2b6                     C:\windows\System32\USER32.dll+00127670 GetPropW+00000566
[119] 0x00007ff9f7ac9c64                      C:\windows\SYSTEM32\ntdll.dll+00695396 KiUserCallbackDispatcher+00000036
[120] 0x00007ff9f47510c4                     C:\windows\System32\win32u.dll+00004292 NtUserPeekMessage+00000020
[121] 0x00007ff9f4fce5bd                     C:\windows\System32\USER32.dll+00124349 PeekMessageW+00000397
[122] 0x00007ff9f4fce3a3                     C:\windows\System32\USER32.dll+00123811 PeekMessageA+00000163
[123] 0x00000000fab09bdb                        D:\MATLAB\bin\win64\uiw.dll+00170971 UIW_ShowMenuItem+00005179
[124] 0x00000000fab5db52                        D:\MATLAB\bin\win64\uiw.dll+00514898 UIW_SuspendAttachThreadInput+00000466
[125] 0x0000000010602c83              D:\MATLAB\bin\win64\libmwservices.dll+01256579 services::system_events::PpeDispatchHook::dispatchOne+00032291
[126] 0x000000001060e6f5              D:\MATLAB\bin\win64\libmwservices.dll+01304309 sysq::addProcessPendingEventsUnitTestHook+00005813
[127] 0x000000001060e7a0              D:\MATLAB\bin\win64\libmwservices.dll+01304480 sysq::addProcessPendingEventsUnitTestHook+00005984

This error was detected while a MEX-file was running. If the MEX-file
is not an official MathWorks function, please examine its source code
for errors. Please consult the External Interfaces Guide for information
on debugging MEX-files.

If this problem is reproducible, please submit a Service Request via:
    http://www.mathworks.com/support/contact_us/

A technical support engineer might contact you with further information.

Thank you for your help.** This crash report has been saved to disk as C:\Users\Administrator\AppData\Local\Temp\matlab_crash_dump.18856-1 **

Caught MathWorks::System::FatalException

thanks

shicaiwei123 commented 6 years ago

what I use is mexopencv2.4 and opencv2.4.9

amroamroamro commented 6 years ago

Here is a list of things to check. When specified, please run the commands in MATLAB and post the output here:

Don't forget to consult the readme file and the wiki, although our focus these days is on OpenCV 3.x

shicaiwei123 commented 6 years ago

Sorry for not giving you the answer about the OpenCV2.4.9 info and the last one because I change OpenCV2.4.9 to OpenCV2.4.10 finally. Surprisingly ,I pass the test when I do exactly the same operation as I use the OpenCV2.4.9 ,the same MATLAB ,the same mexopencv,even the same commands. Then I see the answer when I want to tell you what happened. I‘m I am confused if there is anything wrong in the code

amroamroamro commented 6 years ago

If I understood correctly, you switched to OpenCV 2.4.10 and it's working fine now. Is that right?

If not, try to provide the rest of the info requested in my previous post...

shicaiwei123 commented 6 years ago

Yes,I switch to OpenCV2.4.10 and it's working fine now.But I don't konw why it doesn't work on the OoenCV2.4.9.

amroamroamro commented 6 years ago

It's probably because the wrong OpenCV DLLs are being loaded; MATLAB R2015a comes with opencv 2.4.9 binaries for its own use (the CVST toolbox), which are incompatible with the ones mexopencv was built against:

C:\> dir "C:\Program Files\MATLAB\R2015a\bin\win64\opencv*.dll"

By switching to 2.4.10, the correct dlls are now loaded (they have different names so there is no conflict).

(Note that different MATLAB versions come with different opencv versions. For instance R2017a has updated to opencv 3.1.0)

You would have detected this if you ran Dependency Walker like I suggested above.

See this thread for details:

https://github.com/kyamagu/mexopencv/issues/218#issuecomment-161690377

shicaiwei123 commented 6 years ago

Yeah,I got it. I detect the opencv_*249.dll file in my matlab2015a and understand why it doens't work on Opencv2.4.9.

Thanks a lot.