Page 1 of 2

Video Analytics Plugin Architecture

Posted: Fri Sep 16, 2011 12:18 am
by stagecoach
Hi,

We've just finished porting the Cvision Labs ZoneMinder Plugin architecture to the 1.25.0 release. This architecture allows you to load 3rd party plugins into ZoneMinder to do various analytics on captured images. This patch (attached) for the 1.25.0 release will also load in a sample face detection plugin.


Installation:
1) Download the 1.25.0 release and extract it
2) Download and put the patch in the folder Zoneminder is in. Then patch it.

Code: Select all

cd ZoneMinder-1.25.0
patch -p1 -i ../plugin-1.25.0-0.2.patch
3) Install Zoneminder normally.

To install/use plugins (instructions from CVision labs)

1) Install opencv 2.1 (from sources). Haven't tested newer.
2) Install scons,
3) Go into zoneminder/plugins/ folder and run scons.
4) Create folders /usr/share/zm/, /usr/share/zm/haarcascades.Move Zoneminder/plugins/data/haarcascade_frontalface_alt2.xml into /usr/share/zm/haarcascades and move zoneminder/plugins/data/plugins.conf into /usr/share/zm/. Also, move libzm_plugin_face_haar.so into /usr/share/zm/ and rename to libzm_plugin_face_haar.zmpl.
5) Open zoneminder in browser, open the Monitor for which you want to use this plugin. In General tab, add "Used Plugins": libzm_plugin_face_haar and set "Do native motion detection" to no. Open options, Config tag. Set flags: Loag plugins and Turn native analysis possibility off.
6) Restart zoneminder.

Let me know how it works!

Re: Video Analytics Plugin Architecture

Posted: Mon Sep 26, 2011 6:22 pm
by Normando
Thanks stagecoach! I will test ASAP.

Re: Video Analytics Plugin Architecture

Posted: Mon Oct 10, 2011 9:45 pm
by dimiz
Hi stagecoach
thanks for great and most wanted plugin!!
I have tested your patch on my test installation using:
Ubuntu server 11.04
Zoneminder 1.25.0
(from apt-get install)
scons 2.0.1-1
opencv 2.1.0-3ubuntu1

I have compiled without problem i also modify the zm parameter as you suggest, but using "modect" i dont have any alarm, from my syslog i can read:
-----
Oct 10 23:41:06 video zma_m1[14769]: FACEDET PLUGIN : No objects found. Exit.
Oct 10 23:41:06 video zma_m1[14769]: FACEDET PLUGIN : Checking active zone All
-----
What do you think?
I need to configure some special Zone?
Thank so much for your help?
Sincerely Dimitri

Re: Video Analytics Plugin Architecture

Posted: Mon Oct 10, 2011 10:36 pm
by stagecoach
Hi Dimiz,

Are you certain that it's 1.25.0 you got from the repos? I've only tested this patch against the source directly from the website, and built with ./configure, make, make install.

If that's fine, which could be, what is your resolution of the monitor? This sample plugin seems to work best at at least 640x480.

Let me know.

Re: Video Analytics Plugin Architecture

Posted: Wed Oct 12, 2011 7:11 am
by dimiz
Hi stagecoach
Thanks for your fast reply!!
I must specify better my system installation:

- Zoneminder 1.25.0 - compiled from source
- scons 2.0.1-1 - from from apt-get install
- opencv 2.1.0-3ubuntu1 - from from apt-get install

Also after some test i see some grab from "Face detection" plugin but very small compare the real image. I have set my v4l capture card to 320x240 because at 640x480 the "zma" process stay at very high percentage.
I need some tweak at ZM filter zone?
There are some setting for "Face detection" plugin for better recognize?
Many thanks for your help

Re: Video Analytics Plugin Architecture

Posted: Wed Oct 12, 2011 9:10 pm
by r0ck3t
Hi,

I installed twice following your instructions, without success.

After installation the monitors are not working any more, the log is full of errors like that:

Code: Select all

zmwatch	9367	ERR	Can't open memory map file '/dev/shm/zm.mmap.6': No such file or directory	zmwatch.pl	
zmwatch	9367	ERR	Can't open memory map file '/dev/shm/zm.mmap.6': No such file or directory	zmwatch.pl	
zmdc	9334	ERR	'zma -m 6' exited abnormally, exit status 30	zmdc.pl	
zma_m6	10031	ERR	Can't run query: Unknown column 'UsedPl' in 'field list'	zm_monitor.cpp	2434
Also the plugin settings for the monitors are not stored, they are empty every time I open the monitor config page.

Cheers,
Sebastian

Re: Video Analytics Plugin Architecture

Posted: Tue Oct 18, 2011 11:03 pm
by stagecoach
Hi,

Dimiz, I have only tested the plugin with Opencv from source. Please try those and let me know how it goes. As for the plugin settings, they are in the 'plugins.conf' file; but since we didn't write the plugin itself I really don't know those settings enough to help you. That plugin is from the CVision Lab. I did ask one of the developers, and she said
As regards plugins, all setting should be stored in config file (there was a sample config plugins.conf in the bitbucket). Minimal face size is defined there (but not less than 24x24). Image resolution can be arbitrary, only note that too big can slow down processing and too small can have faces with size not enough.


Hopefully this helps.

As for you R0ck3t,

What is your zoneminder build procedure?
Your config line?
Was this installed on a fresh system/New database? or did you try to upgrade?

Let me know!

Re: Video Analytics Plugin Architecture

Posted: Wed Oct 19, 2011 8:58 pm
by r0ck3t
What is your zoneminder build procedure?
Your config line?

Code: Select all

cd /usr/src 
wget http://www.zoneminder.com/downloads/ZoneMinder-1.25.0.tar.gz
tar -xzvf ZoneMinder-1.25.0.tar.gz
mv ZoneMinder-1.25.0 zm
cd /usr/src/zm && \ 
./configure --with-webdir=/var/www/zm --with-cgidir=/usr/lib/cgi-bin \
ZM_DB_HOST=localhost ZM_DB_NAME=zm ZM_DB_USER=zmuser \
ZM_DB_PASS=zmpass ZM_SSL_LIB=openssl --enable-debug=no \
--with-webgroup=www-data --with-webuser=www-data --enable-mmap=yes CPPFLAGS="-D__STDC_CONSTANT_MACROS ${CPPFLAGS}"
autoconf
aclocal
automake
make
make install
Was this installed on a fresh system/New database? or did you try to upgrade?
I purged my installation of 1.24 and installed 1.25, made sure that everything is running, stopped the service, uninstalled unmodified 1.25 and installed the modified version. Does your procedure assume I would install on a fresh system?

Re: Video Analytics Plugin Architecture

Posted: Thu Oct 20, 2011 6:05 am
by dimi
Hi stagecoach
can you give me some tips to compile opencv from source As i can see is not so simple (configure;make:make install)..
I understood about plugin setting but my recognition is not so good a lot of bad or missing frame captured as alarm, you r installation working very well? Without problem?
Many thanks for your help

Re: Video Analytics Plugin Architecture

Posted: Fri Oct 21, 2011 11:35 pm
by r0ck3t
Ok the previous error was caused by the database not being deleted before installing your version. I think I'm one step further, but still get errors:

Code: Select all

zmc_dvideo0	7957	FAT	Failed to set video format: Input/output error	zm_local_camera.cpp	410
Could somebody that got it running post the settings that were changed from standard installation?

Re: Video Analytics Plugin Architecture

Posted: Sun Oct 23, 2011 5:20 pm
by r0ck3t
After playing arround with zm's config and several reboots, the setup works now.

Thanks for posting the patch!

Is it possible to include other opencv plugins to detect objects (e.g. pedestrians)?

Re: Video Analytics Plugin Architecture

Posted: Thu Oct 27, 2011 6:30 pm
by stagecoach
r0ck3t wrote:After playing arround with zm's config and several reboots, the setup works now.

Thanks for posting the patch!

Is it possible to include other opencv plugins to detect objects (e.g. pedestrians)?
That's great to hear! We have not produced any other plugins yet, but are currently developing a license plate recognition plugin. This is a fairly large undertaking, so it'll be a decent chunk of time+money until it's complete (contributions always welcome!).

There is documentation on how plugins are made though: https://bitbucket.org/gorban/zoneminder/wiki/Home (this is the 1.24.2 fork, but plugin docs are still relevant).

I'm really hoping we can get some people interested enough to try to make plugins of their own.

Dimi:

I built opencv using their wiki cmake instructions (#3 here: http://opencv.willowgarage.com/wiki/InstallGuide)
I hope this helps!
My installations have been working great with the face detection module. Just be sure your resolution is high enough.

Re: Video Analytics Plugin Architecture

Posted: Fri Oct 28, 2011 4:16 pm
by mastertheknife
Impressive work! Looking forward to this.

Re: Video Analytics Plugin Architecture

Posted: Sun Oct 30, 2011 4:46 pm
by dimi
Hi stagecoach
i have follow you suggest to compile from source OpenCV (URL OpenCV install) and seems work much better using the OpenCV 2.3.1a, the cpu usage seems much better (around 35% for Camera).
Please go on with other plugin and much better integration with ZoneMinder!! Zoneminder is great software and i like to see much improvement, i know that is developed with the effort of the community so no one have to say "I want new feature soon" but if is possible... :-)
Thanks very much

PS: If i can contribute with your new project of plate recognition or other idea please say me. i'm at begging to create a possible business on security camera the best idea about OpenSource is free software with payed hardware. As you ca see Ubiquity have create AirCam very nice solution!! With Server/client for linux and very low cost IP Cam (i have order one unit to test) i think this bussiness model is very good.

Re: Video Analytics Plugin Architecture

Posted: Thu Apr 07, 2016 7:21 am
by sudheer
Hi All,

Thanks for procedure of face detection plug-in on zoneminder.
I followed all the steps Zoneminder installation with plug-in patch, Opencv build, run scons ( SConstruct file ) .
I configured all the paths properly on zoneminder "Options" . But Motion detection is not happening i.e it is not creating any alarms for events .
In log file also its not showing any errors. It simple displays " Runtime error: Could not load '/usr/share/zm/libzm_plugin_face_haar.so " .

Working on CentOS 6 version 32-bit :

Please do suggestions for face detection working.

regards,
Sudheer