Include Screenshot with DO HTTP REQUEST

Answered

Comments

24 comments

  • Official comment
    Avatar
    Norman Graafsma

    Hi P Roets

    I need a bit more information about what you want to achieve, but in general, if you want to send a screenshot (aka thumbnail) you can use the following Api call:

    /ec2/cameraThumbnail
    But as said, to give you the best answer I need to know more precise what it is that you want to achieve. 
     
    Comment actions Permalink
  • Avatar
    P Roets

    Hi Norman Graafsma

    It's basically the implementation of the Free AI person detection for another VMS by GentlePumpkin at a forum dedicated to video surveillance which:

    • Analyze a motion alert via the FREE DeepQuestAI as to sort out false alerts
    • Send alert images to Telegram via Gentlempkin Ai tool
    • Doesn't utilize any M$ resources - Linux only.

     

     

    0
    Comment actions Permalink
  • Avatar
    Norman Graafsma

    HI Wi

    All is clear now. I adjusted your reply a bit since we do not promote other VMS on our community. I hope you understand.  

    If the developer GentlePumpkin can say hi here, I can create a support ticket so our developers can discuss with the developer of the Free AI Detection application how to change it, so it will work within Nx Witness, and we can promote the solution through our Works with Nx section on my.networkoptix.com. 

     

     

    0
    Comment actions Permalink
  • Avatar
    P Roets

    Hi Norman Graafsma,

    - The DeepStackIA is freeware.

    - GentlePumpkin's AiTool can be downloaded and compiled from GitHub.

    - The main hurdle is acquiring the still images from Nx Witness on motion detection.

    With the hyperlinks removed on the previous post, this installation notes I thought people with interest might review, is now also unavailable.

    All we really require from Nx is still images during motion detection dropped into a readable folder. It would be great if GentlePumpkin would chime in, and surely this very simplistic implementation would be beneficial to NetworkOptix, but until then, I'll herewith provide a summarized reference of his installation notes:

     

    1. Install DeepQuestAI


    The actual software that analyzes the still images.

    2. Configure VMS ...

    2.1 Create 'Input' folder

    We need an directory where "the VMS" stores all the images relating to motion detection. We can name this folder for example "aiinput". We can furthermore limit the folder size to p.e. 5Gb, so that old images are automatically removed.​
    2.2 Store alert images in 'Input Path'
     
    Enable 'JPEG snapshot each (mm:ss)', select the folder you created in step 2.1, check the box 'Only when triggered' and set the interval to p.e. 0:05.0 (one image every 5 second). Furthermore, you might want to disable 'Create Alert list images when triggered', because otherwise a lot of false-alarm images (remember we set the motion detection to be very sensitive) will be stored in your alerts folder.​
    Now go to 'Trigger', check 'Capture an alert list image' and set the Break time 'End trigger unless retriggered' to p.e. 4s, so that a short alert only causes one image to analyze. If you think that the AI Software might overlook an object "on first sight" because it's only party visible (which most times is no problem at all for the AI Software), you can also make the break time longer than the 5s interval. In this case, multiple images will be analyze by the AI Software.​

    3. Configure GentlePumpkin's AiTool according to your setup and requirements

    Setup and configure the AI Software
     
    3.1 Download the latest version, unzip it where you want and start 'aitool.exe'.​ (or compile from GitHub)
    3.2 Go to the 'Settings' tab, add the 'Input Path' we created in step 2.1 and ensure that the 'Deepstack URL' is correct. Hit 'Save'.​
    3.3 The AI Software already contains a default profile and as long as no other profile matches an inputted image, whatever is specified in the Default profile will happen. That is useful, but we will want to give every camera its own profile, so that the specific camera can be triggered.​
    Configure the individual camera profiles
     
    3.4 The following steps must be repeated for every camera and will be conducted using the example cam 'frontyard'.
    .1 Open the 'Cameras' tab, click 'Add Camera', name the camera "frontyard" and hit ENTER.​
    .2 The alert images will be stored under names that start with the camera name, so p.e. 'aifrontyard.20180326_054241.0.64.jpg'. 
    .3 Check all objects that you want to trigger an alert on this camera, p.e. 'Person' and 'Car'.​
    .4 Input a 'Cooldown Time', you could try 3 minutes. 0 minutes means that the cooldown feature is disabled on this camera.​
    .5 It is not recommended to limit the confidence limits at the beginning. Rather it's recommended to adjust the limits if you repeatedly receive false positive alerts with p.e. a low confidence of around 30% while your correct alerts usually have confidence of 80-100%. Then you could set a confidence threshold at maybe 40% (lower limit).​
    .6 If we don't specify one or multiple 'Trigger URL(s)', no trigger call will be made. If we want to call multiple urls, we have to seperate the URLs with commas. Every URL should start with ' '. Meanwhile, the trigger URL is not limited, practically everything can be triggered that has such an URL that one can call for a trigger (p.e. home automation).​
    Take the following url template and replace user, password (both from step 2.2) and the short cam name with yours:​
    http://localhost:80/admin?trigger&camera=[short cam name]&user=[user]&pw=[password]
    In our example with the admin account name "admin" and the password "todsicher": http://localhost:80/admin?trigger&camera=frontyard&user=admin&pw=todsicher
    If you filled in everything, copy/paste the whole url into your webbrowser and make sure it causes an alert on the camera 'frontyard'. Finally, input the URL into the 'Trigger URL(s)' field.​
    .6 Hit 'Save'.​
    Leave 'Send alert images to Telegram' unchecked for now, you can activate it later.​
    0
    Comment actions Permalink
  • Avatar
    P Roets

    Norman Graafsma, can you be PM'd ?

    0
    Comment actions Permalink
  • Avatar
    Gentle Pumpkin

    GentlePumpkin, that's me. ;-)

    0
    Comment actions Permalink
  • Avatar
    Norman Graafsma

    We continued the conversation in email and I will update the topic as soon as there is solution. 

    0
    Comment actions Permalink
  • Avatar
    P Roets

    Norman Graafsma

    With reference to accessing the API spec as per email:

    nx-test resolves within our lan, yet even using the IP results in the same issue:

     

    However, by specifying http://<IP>:7001/static/api.xml# I can get to the API reference WITHOUT any authentication issues :

    0
    Comment actions Permalink
  • Avatar
    Norman Graafsma

    So per our conversation I will paste the following content here so other people can comment on it as well: 

    "However, upon trying to access the local server's version http://nx-test:7001/static/index.html#/developers/api, I noticed that neither my admin account nor test account is being authorised. Upon authentication the authentication windows is simply re-posted, with no pertinent error. An incorrect password though is answered with "Login or password is incorrect". This being applicable with Brave, FireFox and Chrome browsers."

    To be honest, I do not know why the IP address does give you access and the nx-test url doens't, I would use Wireshark to check upon the communication between client and server to see what result this presents. 

    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    Hi P Roets ,

    However, upon trying to access the local server's version http://nx-test:7001/static/index.html#/developers/api, I noticed that neither my admin account nor test account is being authorised.

    Which version of Nx Witness/MetaVMS are you using?

    There was a bug (already fixed). First, try just  http://nx-test:7001, authorize, then use the full URL.

    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    - The main hurdle is acquiring the still images from Nx Witness on motion detection.

    With the hyperlinks removed on the previous post, this installation notes I thought people with interest might review, is now also unavailable.

    All we really require from Nx is still images during motion detection dropped into a readable folder. It would be great if GentlePumpkin would chime in, and surely this very simplistic implementation would be beneficial to NetworkOptix, but until then, I'll herewith provide a summarized reference of his installation notes:

    Depending on your objectives, you could either:

    1. Develop an analytics plugin, which would send a frame or several to your application when motion is detected.

    You can start with this pinned post Getting started with plugin development

    Here is the thread and post worth reading as well

    https://support.networkoptix.com/hc/en-us/community/posts/360038642973/comments/360010527354

    2. Create several rules in Nx for a camera of your interest.

    One rule would create a bookmark when there is motion detected on a camera (screenshot)

    Another rule would "Do HTTP request" to your application signaling the motion on a camera.

    Having been notified, your application could use /ec2/bookmarks API to get bookmarks from the camera, and afterwards knowing "startTimeMs" could get an image from a camera by using /ec2/cameraThumbnail.

    0
    Comment actions Permalink
  • Avatar
    P Roets
     
    In Firefox:
     
    http://10.17.40.116:7001/ is rewitten to http://10.17.40.116:7001/static/index.html#/ before presenting the log in window, yet then only continues the log in loop.
     
    In Chrome:
     
    http://10.17.40.116:7001/ is rewitten to http://10.17.40.116:7001/static/index.html#/ and the login is successfull, yet the initial page is blank. Except for the "Log Out" link, none of the other links (Setting / View / Lite Client / information / For Developers / Help) works.
     
    In Brave:
     
    Same a Firefox
     
    Nx Witness Client version 4.0.0.29987
     
    Do you provide bug bounties ?
    0
    Comment actions Permalink
  • Avatar
    P Roets

    Andrey Terentyev, Norman Graafsma

    As to keep things simple, efficient and especially provide quicker initial results, could you not allow a third option: Write thumbnail to disk ?

    In all regards, upon event "Motion on camera" create action "Write image" and specify "a folder" location

    A minor adjustment to the "Send email" action that is available ...

    Except for advising Nx via the /createEvent API call to start recording at a specific camera, no other interaction with Nx would be required.

    Having to specifically develop a plugin simply creates to much additional unnecessary complexities and overhead.

     

    0
    Comment actions Permalink
  • Avatar
    Norman Graafsma

    Hi P Roets,

    Regarding: 

    "In Chrome:

    ....yet the initial page is blank. Except for the "Log Out" link, none of the other links (Setting / View / Lite Client / information / For Developers / Help) works...."
     
    This is a known issue when Chrome was updated to version 80+. We managed to circumvent it and resolved it in patch 4.0.030434. 
     
    You can update to the latest patch with the following credentials: 
     
    Build Number: 30434
    Password: xo5e21
     
    Regarding:

    "In all regards, upon event "Motion on camera" create action "Write image" and specify "a folder" location."

    I will create an internal feedback form so our product team can take this into consideration for our roadmap. I'm not sure if it will be used much, since it will be hard to capture the right moment to be useful.

    JIRA-FDBK-198

    0
    Comment actions Permalink
  • Avatar
    Peek Poke

    Regarding:

    "In all regards, upon event "Motion on camera" create action "Write image" and specify "a folder" location."

    It should rather be seen as an "Alert List".

    Same as with the "Interval of action" option as already present with the "Send email" action.

    0
    Comment actions Permalink
  • Avatar
    P Roets

    On motion detection (and alerting via email), we're only receiving a single image for the entire motion detection period, of which the provided image is before the object even enters the viewing area.

    The option to acquire numerous thumbnails (i.e 1 seconds apart) within the duration of that same motion detection event would surely also be beneficial for email alerts. 

    From an API perspective, how can the status of an triggered motion event be validated?

     

     

     

    0
    Comment actions Permalink
  • Avatar
    P Roets

    Can confirm that patch 4.0.030434 is working in Chrome 83.0.4103.97

    It's not working in FireFox 77.0.1 and Brave 1.9.80 Chromium: 81.0.4044.138 though.

    0
    Comment actions Permalink
  • Avatar
    Norman Graafsma

    Peek Poke Great avatar! 

    P Roets

    Regarding: 

    "The option to acquire numerous thumbnails (i.e 1 seconds apart) within the duration of that same motion detection event would surely also be beneficial for email alerts." 

    There are no plans to create such option. It will be hard as well, since the operation differs per brand.
    As a simplified example since there are lot more packages send back and forward:

    Brand A detects the event, sends the image, and then the notification, and Brand B detects the event, sends the notification and then the image. There can be several seconds of delays between notification and image and as a result you might need to send multiple MB of data for each event. This is a potential nightmare for lightweight systems with limited CPU and RAM resources, but also challenging in environments with limited network bandwidth. We have customers with bandwidth limitations per month (e.g. 25 GB per month) or just poor performance of 512 KB/s or even less. 

    In version 4.1 we will offer Push Notifications for the systems connected to the Nx Cloud. In this way you only send the metadata and you instantly go to the event in Nx Mobile and if you have set up bookmarks, you can search very easily through the desktop client for the Bookmarks where you can modify the pre- and post recording in a way the event can be captured.  

    Regarding: 

    "Can confirm that patch 4.0.030434 is working in Chrome 83.0.4103.97
    It's not working in FireFox 77.0.1 and Brave 1.9.80 Chromium: 81.0.4044.138 though."

    Unfortunately I can't confirm any failure for Firefox 77.01 on my systems running Ubuntu 18.04 LTS, 19.10, and 20.04 LTS as the OS. Can you tell me which OS you use and maybe provide a screenshot?  

    Regarding Brave and Chromium, both aren't officially supported browsers, so I doubt this will be intentionally resolved. 
    Official supported browsers are: Chrome, Edge, Firefox, Opera, and Safari. 

     

    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    Hello,

    In addition to said by Norman on regard to this

    "In all regards, upon event "Motion on camera" create action "Write image" and specify "a folder" location."

    Actually, there is already such folder. It is called "video archive". It stores ALL the images from the cameras being recorded.

    Once you have a timestamp, you can get the corresponding image from the archive.

    In order to have a timestamp you can configure, for example, a bookmark as an action for detected motion.

     

    0
    Comment actions Permalink
  • Avatar
    P Roets

    Norman Graafsma,

    Unfortunately I can't confirm any failure for Firefox 77.01 on my systems running Ubuntu 18.04 LTS, 19.10, and 20.04 LTS as the OS. Can you tell me which OS you use and maybe provide a screenshot?  

    Sever: Ubuntu 18.04.4 LTS (GNU/Linux 4.15.0-106-generic x86_64

    Nx Witness: 4.0.0.30434

    Client: Windows 10 Pro x64 - 10.0.18363 Build 18363

    Browser: Firefox 77.0.1 (32 bit)

    At login:

    Upon clicking on "Log in"

     

    0
    Comment actions Permalink
  • Avatar
    P Roets

    Andrey Terentyev,

    Recording and alerting is only triggered after image analysis. 

    We thus understand that the only option forward with Nx would be a plugin development.

    0
    Comment actions Permalink
  • Avatar
    P Roets

    Andrey Terentyev,

    What is the folder location for the "video archive" ?

    0
    Comment actions Permalink
  • Avatar
    Andrey Terentyev

    P Roets ,

    Login to your server via GUI client.

    Right click on your server in the left-hand panel. Select "Server Settings..."->"Storage Management"

    0
    Comment actions Permalink
  • Avatar
    P Roets

    We have finally secured the first images upon motion detection, yet via our own in-house API implementation.

    0
    Comment actions Permalink

Please sign in to leave a comment.