djdd87 / SynoAI

A Synology Surveillance Station notification system utilising DeepStack AI
GNU General Public License v3.0
209 stars 24 forks source link

Exclusion not working when specifying exclusion zone co-ordinates "backwards" #141

Closed Neocramencer closed 2 years ago

Neocramencer commented 2 years ago

Hi,

i defined an exclusion zone which seems not to be working. Config:

{ "Logging": { "LogLevel": { "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } },

"Url": "xxx", "User": "xxx", "Password": "xxx",

"MinSizeX": 50, "MinSizeY": 50,

"BoxColor": "#FF0000", "FontColor": "#FF0000", "FontSize": 20,
"Delay": 5000, "DrawMode": "Matches", "StrokeWidth": 3, "TextOffsetY": -25, "TextOffsetX": 0, "DrawExclusions": true,

"AI": { "Type": "DeepStack", "Url": "http://192.168.0.200:83" },

"Notifiers": [ {

"Type": "Pushover", "ApiKey": "xxx", "UserKey": "xxx", "Sound": "siren" } ],

"Cameras": [ { "Name": "Garten", "Types": [ "Person", "Cat", "Dog" ], "Threshold": 42, "MinSizeX": 50, "MinSizeY": 50, "Exclusions": [ { "Start": { "X": 2363, "Y": 853 }, "End": { "X": 1888, "Y": 1404 } }, { "Start": { "X": 1731, "Y": 853 }, "End": { "X": 1886, "Y": 1152 } } ] } ] }

Example Image:

Garten_2022_08_02_10_46_26_343_1

Second: is it possible to also use anything different then rectengular for exclusion zones? As you see in my Capture with rect. boxes it is quite complicated to exclude.

Thanks and best regards Marc

djdd87 commented 2 years ago

Hey, I think it's because you've defined your exclusion zones in a negative way. It's supposed to go from top left to bottom right, but you've done top right to bottom left.

I should probably be able to account for this, but in the mean time, can you please try this:

"Exclusions": [
  {
    "Start": { "X": 1888, "Y": 853 }, 
    "End": { "X": 2363, "Y": 1404 }
  },
  {
    "Start": { "X": 1731, "Y": 853 },
    "End": { "X": 1886, "Y": 1152 }
  }
]

I might be able to look into different shapes for exclusion zones using SKPath. I'll log an issue for it.

Neocramencer commented 2 years ago

Hi,

just see the green boxes above, this should be the exclusion zones or am i wrong? I enabled drawing the exclusion zones and the person is right in the zone.

Best regards

djdd87 commented 2 years ago

Yes, those are the exclusion zones. But as I said, you've defined the zones backwards and I never accounted for anyone defining from top right to bottom left. Try what I suggested please.

Neocramencer commented 2 years ago

Will do so and respond ;)

Neocramencer commented 2 years ago

Garten_2022_08_03_09_02_36_668_1

Still not working correctly, but maybe there is an issue with multiple exclusion zones.

Neocramencer commented 2 years ago

Garten_2022_08_02_20_08_25_356_1

djdd87 commented 2 years ago

Yeah I think you're right. You could just use the "Intersect" mode though instead of "Contains" which is the default:

"Start": { "X": 1888, "Y": 853 }, "End": { "X": 2363, "Y": 1404 }, "Mode": "Intersect"

It doesn't look like I've documented that option in the readme.

Neocramencer commented 2 years ago

under each exclusion zone or just the first?

djdd87 commented 2 years ago

The setting is per exclusion zone.

Neocramencer commented 2 years ago

Thanks for the feedback, i will try again ;)

Neocramencer commented 2 years ago

Tested your suggestion a few days now and it seems to work, so you can close the issue now :) when the more advanced exclusion zonr is possible i can switch to just one simple exclusion uonr. Thanks alot again.

djdd87 commented 2 years ago

I'll close it when I get chance to fix the negative definitions of exclusions. It should work either way around really.