Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate zones for one camera #156

Open
Sungray opened this issue Sep 21, 2022 · 2 comments
Open

Separate zones for one camera #156

Sungray opened this issue Sep 21, 2022 · 2 comments

Comments

@Sungray
Copy link

Sungray commented Sep 21, 2022

I'd like to be able to configure separate zones for the same camera. For instance, if I have a camera which sees the driveway and the garden, I'd like to be able to execute different actions based on what zone and what object has been detected.

It could look something like this:

"Cameras": [
    {
      "Name": "BackDoor",
      "Types": [ "Person, Car" ],
      "Threshold": 30,
      "Zones": [
        1: {
            "Start": { "X": 0, "Y": 0 },
            "End": { "X": 720, "Y": 1080},
            "Mode": Intersect (optional),
            "Types": [ "Car" ] (optional)

        },
        2: {
            "Start": { "X": 721, "Y": 0 },
            "End": { "X": 1920, "Y": 1080},
            "Mode": Contains (optional),
            "Types": [ "Person" ] (optional)
        }
      ]

And the notifier would add the zone where the object was detected:

{
  "camera": "BackDoor",
  "foundTypes": [
    "Car"
  ],
  "predictions": [
    {
      "Label": "car",
      "Confidence": 67.89117,
      "MinX": 238,
      "MinY": 420,
      "MaxX": 804,
      "MaxY": 844,
      "SizeX": 566,
      "SizeY": 424,
      "Zone": 1
    }
  ],
  "message": "Motion detected on BackDoor Zone 1\n\nDetected 1 objects:\nCar"
}
@djdd87
Copy link
Owner

djdd87 commented Sep 21, 2022

Interesting idea. It might be better to find an elegant way to split a single camera into multiple camera objects. Perhaps something like this:

"Cameras": [{
      "Name": "Driveway",
      "Camera": "BackDoor",
      "Zone": {
            "Start": { "X": 0, "Y": 0 },
            "End": { "X": 720, "Y": 1080},
      },
      "Types": [ "Person, Car" ],
      "Threshold": 30
   }, 
   {
      "Name": "Garden",
      "Camera": "BackDoor",
      "Zone": {
            "Start": { "X": 721, "Y": 0 },
            "End": { "X": 1920, "Y": 1080},
      },
      "Types": [ "Person, Car" ],
      "Threshold": 30
   }
]

Would just need some logic to avoid overlapping zones, or could just find the first applicable zone match for the prediction.

This would then allow all the config to just work as it does already without having to move thresholds, exclusions, types, etc, into a child Zones array.

@Sungray
Copy link
Author

Sungray commented Sep 21, 2022

Yes that would be very good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants