Commit Graph
72 Commits
Author SHA1 Message Date
Pliable PixelsandClaude Opus 5.5 4284ac9b18 feat: try zone settings on a past event from the zone editor refs #6140
zma gets --dry-run, --json, --zone and --set. With them it re-analyses an
event without changing anything, analyses only the chosen zone as an
Active zone, replaces its detection settings for the run, and prints each
frame's alarmed/filtered/blob counts and boxes as JSON lines. The zone is
rebuilt through Zone::LoadRow, pulled out of Zone::Load, so percentages
convert exactly as at capture time. CheckAlarms records the boxes in a
ZoneDiagnostics member on Zone, kept off ZoneStats since that is copied
into every packet.

The zone editor gets a test panel under the image. It runs zma on a picked
or typed event with the form's unsaved settings (web/ajax/zone.php checks
permissions, validates every value and allows one run per monitor), then
replays the event - mp4 or its JPEG frames - with zma's outlines, min vs
got for each check up to the first that fails, and a timeline of which
frames alarm. Min/Max, MinBlobs, OverloadFrames and the alarm frame count
are judged in the browser, so changing them needs no re-run.

The object box is saved with the zone in a new Zones.ObjectCoords column
(zm_update-1.39.53.sql) and drawn again when the zone is reopened.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 16:27:40 -05:00
Isaac Connor e5b0ab6779 Merge pull request #5673 from AJ0070/zma-create-events-links
fix: create Deep/Shallow id markers and name the video after the new event in zma --create-events
2026-11-14 23:58:30 -05:00
Jash 58617b1b43 fix: create Deep/Shallow id markers and name the video after the new event in zma --create-events fixes #5672 2026-11-13 12:36:26 +05:30
Jash 7fad589153 fix: set StateId on events created by zma --create-events fixes #5670 2026-11-13 12:36:18 +05:30
Isaac Connor 7e74e6ec50 fix: use only the filename part of event DefaultVideo in zms and zma
EventStream::loadEventData and zma both joined the DefaultVideo column
onto the event path and opened the result, so a DefaultVideo containing
../ made zms stream, or zma read and hard link, files outside the event
directory. Reduce it to std::filesystem::path::filename() when loading.

zma also wrote the value back into a new event's row with plain
string formatting; escape it with zmDbEscapeString.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 18f48f8bc95f53d0b21110f2f5e5a2c9d22c9a9b)
2026-09-24 23:16:11 -04:00
Isaac ConnorandClaude Opus 4.8 eb83ca1e78 fix: return the insert id as uint64_t so event ids past 2^31 survive
mysql_insert_id() returns my_ulonglong, but zmDbDoInsert() returned int.
Once Events.Id passed INT32_MAX the id was truncated, then sign-extended
when stored in Event::id (uint64_t), so 3502167073 became
18446744072916751373. The Events_Hour/Day/Week/Month inserts were given
the negative value and rejected, and every later UPDATE of the event
matched no row.

Also widen the callers that re-truncated the result: the re-analysis
event id in zma, Tag::Id() when building an Event_Tag, and
Event_Tag::save(). The Events_* insert format specifiers become PRIu64
to match the unsigned id.

fixes #4974

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BV1gDc9T6D6H8gtTcxwLvk
2026-07-21 18:01:05 -04:00
Isaac ConnorandClaude Opus 4.6 f9085b7ae0 fix: add missing unistd.h include in zma.cpp for FreeBSD build
getpid() requires explicit inclusion of <unistd.h> on FreeBSD where
transitive includes from other headers are not guaranteed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 09:23:38 -05:00
Isaac ConnorandClaude Opus 4.6 635439eb5b feat: add zma utility for offline event re-analysis
Add a new zma binary that re-analyses recorded events using current zone
settings. It decodes frames from stored video (FFmpeg) or JPEG files and
runs the full motion detection pipeline (DetectMotion + ref_image blending
+ state machine).

Two modes of operation:
- Default: updates the original event's motion stats (AlarmFrames,
  TotScore, AvgScore, MaxScore) in the database
- --create-events (-c): creates new events from detected motion regions,
  with video files hard linked (copy fallback) to the new event directory

Additional features:
- --save-analysis (-a): writes analysis JPEGs with zone alarm overlays
  to the event directory for visual inspection
- --monitor (-m): override which monitor's zone config to use
- --verbose (-v): increase debug verbosity

Adds Monitor::AnalyseFrame() public methods that encapsulate DetectMotion
+ ref_image initialization and blending, with an optional analysis_image
output parameter for zone overlay rendering. Also guards shared_data
access in DetectMotion to allow offline use without shared memory.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 18:19:20 -05:00
Peter Keresztes Schmidt 687ba03eb4 Drop relicts of zma 2021-02-10 13:26:25 +01:00
Isaac Connor 08a8155b47 Implement a Monitor::disconnect function. Fix Fatals during connect and cleanup Analysis Monitor code to wait around for zmc. Handle zmc going away gracefully. Fixes a slow zma startup due to zmc not being setup yet. 2020-11-13 12:27:51 -05:00
Peter Keresztes Schmidt 8f980a1168 Convert NULL/0 to nullptr
The 0 -> nullptr changes should definitely improve readability.
2020-08-26 22:03:40 +02:00
Mitch Capper eb005e8b9c FIFO support for zoneminder zone debugging (#2594)
Adds fifo options for diagnostic images for much lower impact diagnostics mode.  Diagnostic images are only written when there is a client listening for them (otherwise they are skipped).  Also added a json stream for the detection data so you can see in real time the pixels or blobs detected for the motion.  This allows for easy real time stream of both delta and reference images (as video streams) along with the detection numbers.
2019-05-16 15:37:03 -04:00
Isaac Connor 89cd7ceaf8 Whitespace, extra parentheses, google code style 2018-09-23 16:47:06 -04:00
Isaac Connor b5ff820c61 Test that shm is always valid in zma so that zma dies if zmc does. 2018-04-23 16:24:44 -04:00
Isaac Connor 82c44da9be remove some space 2018-03-29 12:24:21 -04:00
Isaac Connor 36ca1d417d code document 2018-03-22 10:26:05 -04:00
Isaac Connor ae5f4c9d9c Add log re-init on HUP 2018-01-10 12:58:22 -05:00
Isaac Connor 10accc4226 google code style 2017-10-18 10:23:40 -07:00
Isaac Connor 772df5b41b add a cast to quiet compiler warning 2017-05-30 10:31:02 -04:00
Andrew Bauer ccc2cc832f Merge branch 'armv7_neon' of https://github.com/mastertheknife/ZoneMinder into mastertheknife-armv7_neon 2017-05-10 07:45:58 -05:00
Kfir Itzhak e02e033cc8 Renamed ssedetect() to hwcaps_detect() and added ARM Neon and AVX2 detection 2017-03-19 02:05:01 +02:00
SteveGilvarry 2f3ebd80da Remove zmf, die..die..die 2017-01-16 13:20:05 -08:00
Andy Bauer 254fcbcef7 update gpl 2 mailing address in source files 2016-12-26 09:23:16 -06:00
Isaac Connor 006fcad10a move jpeg context freeing to a Deinitialise function instead of ~Image. Turn down the logging 2016-10-07 11:35:14 -04:00
Isaac Connor 03b1ced568 tabs to spaces and use 2space indenting 2016-04-04 10:11:48 -04:00
Emmanuel Papin 18758826c7 Do not call time() function when it is not necessary 2015-07-25 13:46:11 +02:00
Emmanuel Papin 0bff99f5c7 Improve string conversion and use unsigned type for analysis_update_delay 2015-07-25 13:38:50 +02:00
Emmanuel Papin 649a39b372 Replace analysis interval parameter by analysis framerate 2015-07-23 16:36:30 -04:00
Andrew Bauer 4deb0d53c8 Add pod documentation to C binaries 2015-06-20 17:11:20 -05:00
Emmanuel Papin 7811354d92 Move iostream inclusion in zm.h and declare explicitely the namespace for cout 2015-05-29 23:22:20 +02:00
Isaac Connor 85e51528a6 add version command line argument to zma 2015-01-06 20:52:18 -05:00
manupap1 b4732e4750 Close logger and database on exit 2014-11-14 22:17:44 +01:00
Kfir Itzhak 0bb2ee7efc More signal improvements:
1) Cleaner code
2) Fixed the path displayed in the addr2line line
3) Improved dependency checking for backtrace
4) Few more improvements
2013-10-07 02:37:50 +03:00
Kfir Itzhak 28e06e935b 1) Fixed blob motion detection issues.
2) Some more progress towards getting analysis images working.
3) Fixed possible log corruption because of ssedetect().
2012-02-01 07:33:21 +02:00
Kfir Itzhak 4a59761bcc Getting closer and closer everyday.
1) Fixed many errors to get it to compile
2) Fixed some small bugs
3) Small other changes
2012-02-01 07:33:20 +02:00
stan 6ff385e407 git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@3459 e3e1d417-86f3-4887-817a-d78f3d33393f 2011-06-21 09:19:10 +00:00
stan 18f196dbcd Added srand initialisation.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@2848 e3e1d417-86f3-4887-817a-d78f3d33393f
2009-04-14 20:18:57 +00:00
stan e6041e24a7 Uppdated copyright headers
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@2611 e3e1d417-86f3-4887-817a-d78f3d33393f
2008-07-25 09:33:23 +00:00
stan ee44d4b274 Updated debug format
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@2513 e3e1d417-86f3-4887-817a-d78f3d33393f
2008-07-14 14:43:47 +00:00
stan 799ee78675 Bug 471 - Compiler warnings, sorted out types and general format tidying
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@2357 e3e1d417-86f3-4887-817a-d78f3d33393f
2008-03-13 13:36:12 +00:00
stan a0b3e2a5a3 Bug 308 - Added improved signal handling and backtracing.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1916 e3e1d417-86f3-4887-817a-d78f3d33393f
2006-04-05 12:22:27 +00:00
stan 235dde1a80 Updated copyright statement.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1829 e3e1d417-86f3-4887-817a-d78f3d33393f
2006-01-17 10:56:30 +00:00
stan 05c2fb5dfd Bug 238 - Changes to do with the various enabled/disable/suspend/trigger modes.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1720 e3e1d417-86f3-4887-817a-d78f3d33393f
2005-12-22 16:46:25 +00:00
stan f089f28bd4 Added simplified direct config interface.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1406 e3e1d417-86f3-4887-817a-d78f3d33393f
2005-05-16 09:27:06 +00:00
stan 264c23d687 Updated copyright statement
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1360 e3e1d417-86f3-4887-817a-d78f3d33393f
2005-02-24 14:40:14 +00:00
stan dc3b3691a0 Revamped debug initialisation and config loading.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1208 e3e1d417-86f3-4887-817a-d78f3d33393f
2005-01-15 17:45:51 +00:00
stan 2ba1ee4eb8 Removed secondary DB user.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1171 e3e1d417-86f3-4887-817a-d78f3d33393f
2004-12-28 17:01:25 +00:00
stan 72da78e98a Added zm.conf feature.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1170 e3e1d417-86f3-4887-817a-d78f3d33393f
2004-12-28 16:46:48 +00:00
stan b508b2a5ce Changed strcpy to strncpy, sprintf to snprintf and query parameter checks to avoid vulnerabilities.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@1017 e3e1d417-86f3-4887-817a-d78f3d33393f
2004-04-19 16:02:17 +00:00
stan 4dfdf8f00b Changed extraneous Info messages to be Error, Debug or removed.
git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@975 e3e1d417-86f3-4887-817a-d78f3d33393f
2004-03-17 10:28:07 +00:00