OpenCV for ZGE

Use of external libraries (DLLs) from ZGE.

Moderator: Moderators

StevenM
Posts: 149
Joined: Thu Jan 20, 2011 10:03 am

Memory Leaks

Post by StevenM »

The problem is that both versions of OpenCV have memory leaks in very basic functions such as cvtColor(). Running of such a program results in many page faults and memory consumption is increasing. StevenM do you have the same experience?
No, I haven't had this issue with Python, but memory management is a lot more complicated in c++. I've seen this issue pop up for a lot of c++ users, and some furious about it - but it does look like these problems have solutions. OpenCV is used in a lot of serious applications and is updated quite a bit. A memory leak like that should certainly not exist.
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Re: Memory Leaks

Post by Rado1 »

StevenM wrote:A memory leak like that should certainly not exist.
Hmmm, all C++ source code examples to detect objects I downloaded had identical problems and some of them crashed after some minutes of working. Anyway, I started to debug the dll and to identify memory leaks with VLD tool.
StevenM
Posts: 149
Joined: Thu Jan 20, 2011 10:03 am

Post by StevenM »

Rado1 wrote:
StevenM wrote:A memory leak like that should certainly not exist.
Hmmm, all C++ source code examples to detect objects I downloaded had identical problems and some of them crashed after some minutes of working. Anyway, I started to debug the dll and to identify memory leaks with VLD tool.
crashed in minutes...Oh, thats bad, especially when the code looks fine.

If you haven't already - Do check out the OpenCV Question and Answers too. Someone else should have had a similar or identical problem.
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Re: OpenCV for ZGE

Post by Rado1 »

Latest updates: I updated the ZgeCV library to have better performance and more straightforward API - it uses pointers (xptr) instead of original integer handles for internal OpenCV objects. It is build on OpenCV 2.4.12, because it produces much smaller DLL than OpenCV 3.1.0. When testing, there are no (or very little ???) memory leaks as previously. It can run for long time without memory allocation problems or crashes. Also I updated all demo projects and added a new one:

[youtube]https://www.youtube.com/watch?v=zmsOj8G7UzQ[/youtube]

Please note that the video was captured during normal daylight when contrast between my hands and the wall behind me was not so big and also only one side of fingers was illuminated. During nights, when there is dark around and my hands are illuminated by lamp, I can achieve much better results and faster hand detection.

You can download DLL and demo projects from here.

Have fun! ... comments are welcome.
StevenM
Posts: 149
Joined: Thu Jan 20, 2011 10:03 am

Re: OpenCV for ZGE

Post by StevenM »

Thank you! Downloading now. cool demo video - btw.
User avatar
13r4nd0m
Posts: 3
Joined: Wed Jul 26, 2017 4:43 pm

Re: OpenCV for ZGE

Post by 13r4nd0m »

Nicely done, OpenCV can be a pain to to get up and running on some platforms. The demo's are spot on :D I was wondering if other sources of images besides webcams could be used as input? Ideally, I would like to get some OpenCV functionality to work together with FL Studio/Visualizer. I'm pretty new to working with ZGE and OpenGL so any tips or tricks would be appreciated.
User avatar
Rado1
Posts: 775
Joined: Wed May 05, 2010 12:16 pm

Re: OpenCV for ZGE

Post by Rado1 »

Hi, any image can be taken as a source to OpenCV; camera/video is the most complex input. Which platform you want to target? And what functionality you would like to achieve with OpenCV? If you are more precise I could maybe help you.
User avatar
13r4nd0m
Posts: 3
Joined: Wed Jul 26, 2017 4:43 pm

Re: OpenCV for ZGE

Post by 13r4nd0m »

Thanks for replying. I'm away from my desktop right now but I will be back with a more specific example.
User avatar
13r4nd0m
Posts: 3
Joined: Wed Jul 26, 2017 4:43 pm

Re: OpenCV for ZGE

Post by 13r4nd0m »

I want to target windows platforms, specifically I want to develop effect plugins for fl studio's zgameeditor visualizer. The facial/object detection functionality found in your demo3 project is exactly what I need. Attached is demo3 but with an additional component called tgtBitmap. Could you show me how to use the tgtBitmap as input instead of the camera?
Attachments
demo3bitmapExample.zgeproj
(311.43 KiB) Downloaded 1140 times
Post Reply