Commit Graph

57 Commits

Author SHA1 Message Date
Josh Hawkins
5d8bcb42c6
Fix autotrack to work with new tracked object package (#14414) 2024-10-17 10:21:27 -06:00
Nicolas Mowen
8ac4b001a2
Various fixes (#14410)
* Fix access

* Reorganize tracked object for imports

* Separate out rockchip build

* Formatting

* Use original ffmpeg build

* Fix build

* Update default search type value
2024-10-17 11:02:27 -05:00
Josh Hawkins
b9e74ee9ab
Fix autotracking absolute zoom interpolation logic (#14139) 2024-10-03 08:40:27 -05:00
gtsiam
54900ae318
Properly call super() in subclasses (#14124) 2024-10-02 19:35:46 -06:00
Josh Hawkins
3688a3bc67
Misc fixes (#14064)
* Add loading indicator when explore view is revalidating

* Portal tooltip in object lifecycle pane

* Better config file handling

* Only manually set aspect ratio when using alert videos
2024-09-30 07:32:54 -06:00
gtsiam
c0bd3b362c
Custom classes for Process and Metrics (#13950)
* Subclass Process for audio_process

* Introduce custom mp.Process subclass

In preparation to switch the multiprocessing startup method away from
"fork", we cannot rely on os.fork cloning the log state at fork time.
Instead, we have to set up logging before we run the business logic of
each process.

* Make camera_metrics into a class

* Make ptz_metrics into a class

* Fixed PtzMotionEstimator.ptz_metrics type annotation

* Removed pointless variables

* Do not start audio processor when no audio cameras are configured
2024-09-27 07:53:23 -05:00
Josh Hawkins
a7ed90f042
try deleting zoom spaces if disabled (#13915) 2024-09-23 15:34:08 -05:00
Nicolas Mowen
af84af7b7a
Don't print error for requesting camera info (#13905) 2024-09-23 08:49:34 -05:00
gtsiam
edababa88e
Work through most of the cspell warnings in python (#13794) 2024-09-17 10:41:46 -05:00
Josh Hawkins
9bcb928715
check for onvif movement support before attempting movement (#13771) 2024-09-16 10:46:35 -06:00
Nicolas Mowen
9afa1354da
Limit shm frame count (#12363)
* Limited shm frame count (#12346)

* Only keep 2x detect fps frames in SHM

* Don't delete previous shm frames in output

* Catch case where images do not exist

* Ensure files are closed

* Clear out all frames when shutting down

* Correct the number of frames saved

* Simplify empty shm error handling

* Improve frame safety

* Add handler logs when frame is None

* Don't fail on cleanup

* Cleanup logging

* Update docs

* Update calculation

* Restore condition

* Fix case where thumbnail is saved without frame

* Adjust debug logs

* Calculate best shm frame count

* Fix shm count calculation

* Catch missing frame

* Formatting

* Clarify docs

* Catch none frame in autotracking
2024-09-03 10:22:30 -06:00
Josh Hawkins
e3da5ef2d5
Lower onvif timeouts to 10s (#13473) 2024-08-31 16:15:10 -05:00
Josh Hawkins
3afd77cbe0
No need to check for h264 onvif profile (#12444) 2024-07-14 13:29:49 -05:00
Josh Hawkins
093201a1cc
Update docs for clarity on review items (#12441) 2024-07-14 11:12:26 -06:00
Josh Hawkins
51153af944
Attempt to support zoom-only onvif cams (#12415)
* Attempt to support zoom-only onvif cams

* don't skip ptz configuration
2024-07-12 11:01:52 -06:00
stephendb
aacb8c84e0
Bug fix for ONVIF cameras, adjust_time parameter added (#12352)
* adds adjust_time which allows users to fix an issue with onvif authentication where time is not syncrhonized

* updated adjust_time to ignore_time_mismatch to make it clearer what this option does

* adds ignore_time_mismatch to the reference.md and adds a line about the security risk this can introduce as well as the recommendation to setup NTP for both ends.

* fix format error

* happy now linter?

* white space

* Update docs/docs/configuration/reference.md

Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>

---------

Co-authored-by: Stephen Butler <stephen.butler@ni.com>
Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
2024-07-09 13:00:47 -06:00
Meow
6e39d55dd3
cspell fixes (#11447) 2024-05-20 07:37:56 -06:00
Nicolas Mowen
9be5951076
UI tweaks (#10998)
* Make buttons consistent and have hover state

* Use switch for camera to be consistent

* Use everywhere and remove unused

* Use green for normal stats color

* Fix logs copy icon

* Remove warnings from pydantic serialization

* Ignore warnings

* Fix wsdl resolution

* Fix loading on switch
2024-04-16 15:55:24 -05:00
Martin Weinelt
b65656fa87
Make wsdl_dir path resolving more robust (#10967)
Relying on importlib to resolve the path to the wsdl directory is more
robust, since it traverses all site-packages directories, that are part
of the PYTHONPATH.
2024-04-13 12:25:58 -05:00
faurel
a886b6a3e5
Support ONVIF exceptions when sending pan-tilt commands (#10777)
Co-authored-by: Aurel <me@home.com>
2024-04-01 13:19:24 -06:00
Josh Hawkins
3a9607e59b
Add relative movement by clicking on camera image for supported ptzs (#10629) 2024-03-23 10:53:33 -06:00
Josh Hawkins
9fc1286568
Don't check autotracking onvif requirements for users with autotracking disabled (#10350)
* separate autotracking onvif needs from standard ptz control setup

* try/except around GetServiceCapabilities call
2024-03-09 08:48:31 -06:00
Nicolas Mowen
cb30450060
Migrate pydantic to V2 (#10142)
* Run pydantic migration tool

* Finish removing deprecated functions

* Formatting

* Fix movement weights type

* Fix movement weight test

* Fix config checks

* formatting

* fix typing

* formatting

* Fix

* Fix serialization issues

* Formatting

* fix model namespace warnings

* Update formatting

* Format go2rtc file

* Cleanup migrations

* Fix warnings

* Don't include null values in config json

* Formatting

* Fix test

---------

Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
2024-02-29 16:10:13 -07:00
Josh Hawkins
824e5ec3a3
Use first onvif profile with ptz config (#10012)
* Use zoom space id in Onvif RelativeMove setup (#9859)

* use zoom space id in onvif relativemove setup

* better handle cases when zooming is disabled

* Fix birdseye camera comparison (#9887)

* Format (#9889)

* use first onvif profile with ptz config

* Use zoom space id in Onvif RelativeMove setup (#9859)

* use zoom space id in onvif relativemove setup

* better handle cases when zooming is disabled

* use first onvif profile with ptz config

---------

Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
2024-02-24 06:49:34 -07:00
Blake Blackshear
198dbbdff1 Merge remote-tracking branch 'origin/master' into dev 2024-02-14 18:20:55 -06:00
Josh Hawkins
dc2e8f7f70
Onvif: skip non-video profiles in setup (#9708)
* use first h264 onvif profile

* error if profile remains unset

* move create_ptz_service call

* add profile logger debug
2024-02-10 13:41:24 -06:00
Josh Hawkins
a33f2f117e
more robust onvif checks (#9635) 2024-02-05 17:52:47 -06:00
Josh Hawkins
3df8b5829c
Small autotracking changes (#9571)
* ignore web-new

* remove web-new

* catch exceptions for unsupported cameras

* don't split up large ptz movements

* fix ruff
2024-02-02 06:23:14 -06:00
Josh Hawkins
d430b99562 Autotracking: better handle objects that touch frame edges (#9062)
* handle edge cases better

* don't lowercase status strings

* ruff formatting
2024-01-31 12:56:11 +00:00
Josh Hawkins
cc5297f180
handle onvif connection failure in autotrack init (#8838)
* handle onvif connection failure in autotrack init

* remove whitespace and add consistency

* error message consistency

* more consistency
2023-12-03 03:14:52 +00:00
Josh Hawkins
678f1201c6
use timeout for move queues (#8662) 2023-11-18 15:36:13 -06:00
Josh Hawkins
7b520e8a9d
use enabled_in_config for switch in HA integration (#8630) 2023-11-16 01:25:48 +00:00
Josh Hawkins
266b4099b5
a few small onvif fixes and relativemove debug (#8583) 2023-11-15 05:41:41 -06:00
Nicolas Mowen
3457dcddfe
Don't run forever in autotracking (#8579) 2023-11-10 18:12:20 -06:00
Josh Hawkins
1d99bb908d
only use max target box for relative zoom limiter (#8509) 2023-11-07 11:31:39 +00:00
Josh Hawkins
6eff08eb2d
Add MQTT topic for active autotracking (#8419)
* prevent estimate clipping when autotracking

* use unclipped estimate in distance function only

* remove autotracking velocity changes

* publish on init
2023-11-01 23:20:26 +00:00
Josh Hawkins
af24eb7dbf
Autotracking tweaks (#8400)
* optimize motion and velocity estimation

* change recommended fps and fix config validate

* remove unneeded var

* process at most 3 objects per second

* fix test
2023-11-01 06:12:43 -05:00
Josh Hawkins
a399cb09fa
Autotracking tweaks and docs update (#8345)
* refactor thresholds and reduce a duplicate call

* add camera to docs

* udpate docs
2023-10-26 18:21:58 -04:00
Josh Hawkins
9df5927ac5
Autotracking bugfixes and zooming updates (#8103)
* zoom in/out in search for lost objects

* predicted box should not be empty

* clean up and update zoom logic

* only zoom if enabled

* more cleanup

* check for valid velocity when zooming

* only try absolute zoom in if obj area has changed

* zoom logic

* don't enqueue lost object zoom if already at limit

* don't disable motion boxes during ptz moves

* velocity threshold based on move coefficients

* fix area zoom logic

* disable debug zoom

* don't process objects if ptz moving

* recalc with exponent

* change exponent

* remove lost object zooming

* increase distance threshold for stationary object

* increase distance threshold constant

* only zoom out if nonzero

* camera name in all debug logging

* add camera name to debug logging

* camera variable name consistency

* update calibration behavior and docs

* docs and better zooming

* more sensible target values

* docs wording

* fix velocity threshold variable

* zooming tweaks and remove iou for current objects

* debug and docs

* get valid velocity

* include zero

* additional debug statements

* add zoom hysteresis

* zoom on initial move if relative

* only update target box if we actually zoom

* merge dev

* use getattr instead of get

* increase distance threshold

* reverse logic

* get_camera_status after preset move to store zoom

* final tweaks and docs

* use constants and catch possible debug exception

* adjust zoom factor exponent

* don't run motion estimation when calling preset

* adjust dimension threshold

* use numpy for velocity estimate calcs

* more numpy conversion

* fix numpy shapes

* numpy zeros dimension

* more zoom out conditions

* fix velocity bug

* ensure init has been called in debug view

* ensure onvif init if enabling by mqtt

* change default hysteresis values

* recalc relative zoom value

* zoom out value

* try to zoom when object isn't moving

* try zoom when tracked object is not moving

* don't try to zoom every time

* negate zoom out condition when needed

* hysteresis constants for absolute zooming

* update zoom conditions

* don't recalc target box on zoom only

* zoom out if above area threshold

* don't print zooming debug for stationary obj

* revamp zooming to use area moving average

* zooming tweaks and expose property

* limit zoom with max target box

* use calibration to determine zoom levels

* zoom logic fix

* docs

* add tapo c200 camera

* fix initial absolute zoom

* small zoom logic fix

* better invalid velocity checks

* fix test

* really fix test this time
2023-10-22 12:59:13 -04:00
Daniël van den Berg
d102ebf855
[CHANGE] More resilient and slightly faster PTZ (#8009)
* [CHANGE] More resilient and slightly faster PTZ

* Make "Check Black" happy.

* Make "check black" happier

* Remove unused named exception

---------

Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
2023-10-22 09:08:05 -05:00
Josh Hawkins
ee1e1b748c
fix logic error in preset fetch (#8245) 2023-10-20 19:27:47 -04:00
Josh Hawkins
dbd21eb6fa
use getattr instead of get (#8094) 2023-10-08 14:30:23 -05:00
Josh Hawkins
67a5a7d21a
onvif: use preset token if name is unsupported (#8046)
* onvif: use preset token if name is unsupported

* move parenthesis
2023-10-07 09:20:42 -05:00
Josh Hawkins
fe9fcf3eaa
remove erroneous check for move threads (#8031) 2023-10-07 09:18:07 -05:00
Josh Hawkins
20c2ab39bc
disable zooming if relative zoom not supported (#8028) 2023-10-07 09:17:54 -05:00
Josh Hawkins
ead03c381b
Autotracking improvements and bugfixes (#7984)
* add zoom factor and catch motion exception

* reword error message

* check euclidean distance of estimate points

* use numpy for euclidean distance

* config entry

* use zoom factor and zoom based on velocity

* move debug inside try

* change log type to info

* logger level warning

* docs

* exception handling
2023-09-28 18:21:37 -05:00
Josh Hawkins
50f13b7196
thread lock for move queues (#7973) 2023-09-28 18:01:05 -05:00
Josh Hawkins
27144eb0b9
Autotracker: Basic zooming and moves with velocity estimation (#7713)
* don't zoom if camera doesn't support it

* basic zooming

* make zooming configurable

* zooming docs

* optional zooming in camera status

* Use absolute instead of relative zooming

* increase edge threshold

* zoom considering object area

* bugfixes

* catch onvif zooming errors

* relative zooming option for dahua/amcrest cams

* docs

* docs

* don't make small movements

* remove old logger statement

* fix small movements

* use enum in config for zooming

* fix formatting

* empty move queue first

* clear tracked object before waiting for stop

* use velocity estimation for movements

* docs updates

* add tests

* typos

* recalc every 50 moves

* adjust zoom based on estimate box if calibrated

* tweaks for fast objects and large movements

* use real time for calibration and add info logging

* docs updates

* remove area scale

* Add example video to docs

* zooming font header size the same as the others

* log an error if a ptz doesn't report a MoveStatus

* debug logging for onvif service capabilities

* ensure camera supports ONVIF MoveStatus
2023-09-27 06:19:10 -05:00
Nicolas Mowen
08586f8f65
Fix case where camera is disabled but autotrack is enabled (#7914) 2023-09-24 05:05:29 -05:00
Nicolas Mowen
2e4f5bc0e0
Don't fail ptz if camera does not support relative zoom (#7542)
* Remove relative zoom space as it is not used

* Catch case where camera does not support relative zoom

* Cleanup
2023-09-01 07:07:18 -05:00