openCV in a c++/CLI

asked 2016-09-08 05:43:55 -0600

Hi.

I'm trying using OPENCV in a c++/CLI winform project. (VS2015, OPENCV310 x86)

Classes accesing OPENCV code are with 'No Common Language RunTime Support' switch. Then, I call those classes from managed code as button's events, etc.

I can built the project in x86 debug mode but, when trying executing it in debug I find this like:

Exception thrown at 0x779E0366 (ntdll.dll) in ProjectConCV.exe: 0xC0000005: Access violation reading location 0xFB531FA9.

I'm a bit desperate .When doing opencv win32 projects on the same machine, then no problems.

I've read using this approach(c++/CLI) is feasible, I mean, mixing 'native classes' calling OPENCV code and then, these being called from managed code in the same project.

Please, help me to know what I am doing wrong. Thx.

edit retag flag offensive close merge delete

Comments

I've read using this approach(c++/CLI) is feasible its not because it is feasible, that it is not a pain in the ass. Many have gone there before you, and many quitted before finalizing the application...

StevenPuttemans gravatar imageStevenPuttemans ( 2016-09-09 06:16:21 -0600 )edit
1

Thank you! Your contribution is very interesting.

I begun solving the problem yesterday; I can make it work on release mode but still problems in debug mode with '_crtsetbreakalloc' and related flags.

In short, Making an app where you can 'carefully' mix native OPENCV code with managed classes (Winform, pictureBox....) is 100% feasible.

I'm preparing a short guide for other guys with the same problem.

So, man, be happy ;-)

This is my first question in this forum and I', sure there are lots of people giving much better answers than your. Cheers.

AntonioBejar gravatar imageAntonioBejar ( 2016-09-09 06:27:51 -0600 )edit

You really moderator? Wow!

AntonioBejar gravatar imageAntonioBejar ( 2016-09-09 06:30:10 -0600 )edit

I did not say that it is not feasible. I have created 4 apps using CLI managed code myself before switching away from it. There are just to many things to handle in my opinion. And yes I am a moderator ... I kind of been spending the last 4 years on this software and on this forum helping new people out. That includes telling people when they enter a wasps nest, thats all.

StevenPuttemans gravatar imageStevenPuttemans ( 2016-09-09 06:34:14 -0600 )edit

OK. Agreed regarding mixing managed and unmanaged is a bit more complicated than pure native. I had similar experiences when dealing with directshow some years ago but, finally, all those things can be done. btw, no performance penalties when mixed approach.

But anyway you know, customer is always right, eh? So, if customer wants a mixed approach for a set of reasons....

AntonioBejar gravatar imageAntonioBejar ( 2016-09-09 07:38:47 -0600 )edit
1

Before asking the forum I carefully looked for a related answer but, maybe I'm getting old, couldn't find anything.

What I'll try to do when writting my litle guide on this is putting some tag worlds on CLI#application.

If a guy wants to enter in a wasps nest, hey!, that's freedom!

On my side, instead of saying don't do that, I'll simply show the way to do it and hope someone else can find my answer when looking for help.

Cheers.

AntonioBejar gravatar imageAntonioBejar ( 2016-09-09 07:39:05 -0600 )edit