1

So I am working on a 4G enabled security camera. While I know there is several options to choose from I was kind of intrigued by the Twilio Security Camera Blueprint, https://www.twilio.com/wireless/blueprints/security-camera/, as an option for what I am trying to do. So I purchased a Raspberry Pi 3 +, Sixfab LTE Hat, and began the setup. As of now, everything appears to be working LTE side but the dang Twilio stuff isn't working.

First, off they haven't updated their walkthrough but changed some files around so after some research and several hours I was finally able to add the camera to "the front end" (page 3 of the walkthrough) and then started the config on my pi.

As I went through the steps on the Raspberry Pi I was able to successfully do everything EXCEPT issue the NPM start command.

Every time I issue the command it fails to start and gives me the following error. I reached out to Twilio Support to see if they had any suggestions but all they could say was to make sure I completed all steps in the guide.

Based on the last few hours I've spent on this I am guessing that OPENCV no longer has a function called ImageSimilarity and they don't exactly say what they changed it to. Does anybody have any ideas? I'm beginning to think Twilio might not be the best option if it is this difficult to setup or even build upon. Below is the printout of running the command as well as the npm debug log.

NPM Start Command

pi@raspberrypi:~/camera $ npm start

> wireless-security-camera@0.0.1 start /home/pi/camera
> node security-camera.js

Got configuration for camera: Camera1
Control map: 
Snapshot document: 
Starting camera capture
calling....
/opt/vc/bin/raspistill --width 640 --height 360 --output /home/pi/camera/images/camera%03d.jpg --nopreview --timeout 1800000 --timelapse 250 --quality 80 --rotation 180 --thumb 0:0:0
raspicam::watcher::event rename
raspicam::watcher::event change
raspicam::watcher::event change
raspicam::watcher::event change
raspicam::watcher::event change
raspicam::watcher::event rename
raspicam::watcher::event rename
Frame captured: null 1579100567771 camera000.jpg
CV loaded: /home/pi/camera/images/camera000.jpg [ Matrix 360x640 ]
raspicam::watcher::event rename
stderr: mmal: Skipping frame 1 to restart at frame 2

raspicam::watcher::event change
raspicam::watcher::event change
raspicam::watcher::event change
raspicam::watcher::event rename
raspicam::watcher::event rename
Frame captured: null 1579100568502 camera002.jpg
CV loaded: /home/pi/camera/images/camera002.jpg [ Matrix 360x640 ]
/home/pi/camera/security-camera.js:115
        CV.ImageSimilarity(im, previousImage, function (err, dissimilarity) {
           ^

TypeError: CV.ImageSimilarity is not a function
    at CV.readImage (/home/pi/camera/security-camera.js:115:12)
    at RaspiCam.<anonymous> (/home/pi/camera/security-camera.js:112:8)
    at emitThree (events.js:136:13)
    at RaspiCam.emit (events.js:217:7)
    at FSWatcher.<anonymous> (/home/pi/camera/node_modules/raspicam/lib/raspicam.js:196:14)
    at emitTwo (events.js:126:13)
    at FSWatcher.emit (events.js:214:7)
    at FSEvent.FSWatcher._handle.onchange (fs.js:1364:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! wireless-security-camera@0.0.1 start: `node security-camera.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the wireless-security-camera@0.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/pi/.npm/_logs/2020-01-15T15_02_50_331Z-debug.log
pi@raspberrypi:~/camera $

NPM Debug Log

 0 info it worked if it ends with ok
    1 verbose cli [ '/home/pi/.nvm/versions/node/v8.17.0/bin/node',
    1 verbose cli   '/home/pi/.nvm/versions/node/v8.17.0/bin/npm',
    1 verbose cli   'start' ]
    2 info using npm@6.13.6
    3 info using node@v8.17.0
    4 verbose run-script [ 'prestart', 'start', 'poststart' ]
    5 info lifecycle wireless-security-camera@0.0.1~prestart: wireless-security-camera@0.0.1
    6 info lifecycle wireless-security-camera@0.0.1~start: wireless-security-camera@0.0.1
    7 verbose lifecycle wireless-security-camera@0.0.1~start: unsafe-perm in lifecycle true
    8 verbose lifecycle wireless-security-camera@0.0.1~start: PATH: /home/pi/.nvm/versions/node/v8.17.0/lib/node_modules/npm$
    9 verbose lifecycle wireless-security-camera@0.0.1~start: CWD: /home/pi/camera
    10 silly lifecycle wireless-security-camera@0.0.1~start: Args: [ '-c', 'node security-camera.js' ]
    11 silly lifecycle wireless-security-camera@0.0.1~start: Returned: code: 1  signal: null
    12 info lifecycle wireless-security-camera@0.0.1~start: Failed to exec start script
    13 verbose stack Error: wireless-security-camera@0.0.1 start: `node security-camera.js`
    13 verbose stack Exit status 1
    13 verbose stack     at EventEmitter.<anonymous> (/home/pi/.nvm/versions/node/v8.17.0/lib/node_modules/npm/node_modules/$
    13 verbose stack     at emitTwo (events.js:126:13)
    13 verbose stack     at EventEmitter.emit (events.js:214:7)
    13 verbose stack     at ChildProcess.<anonymous> (/home/pi/.nvm/versions/node/v8.17.0/lib/node_modules/npm/node_modules/$
    13 verbose stack     at emitTwo (events.js:126:13)
    13 verbose stack     at ChildProcess.emit (events.js:214:7)
    13 verbose stack     at maybeClose (internal/child_process.js:915:16)
    13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
    14 verbose pkgid wireless-security-camera@0.0.1
    15 verbose cwd /home/pi/camera
    16 verbose Linux 4.19.75-v7+
    17 verbose argv "/home/pi/.nvm/versions/node/v8.17.0/bin/node" "/home/pi/.nvm/versions/node/v8.17.0/bin/npm" "start"
    18 verbose node v8.17.0
    19 verbose npm  v6.13.6
    20 error code ELIFECYCLE
    21 error errno 1
    22 error wireless-security-camera@0.0.1 start: `node security-camera.js`
    22 error Exit status 1
    23 error Failed at the wireless-security-camera@0.0.1 start script.
    23 error This is probably not a problem with npm. There is likely additional logging output above.
    24 verbose exit [ 1, true ]

NPM Package List

pi@raspberrypi:~/camera $ npm list --depth 0
wireless-security-camera@0.0.1 /home/pi/camera
nyc@15.0.0
opencv@6.2.0
raspicam@0.2.14
request@2.88.0
twilio-common@0.1.7
twilio-sync@0.11.5
uuid@3.3.3
  • A smal help – Ephemeral Jan 15 at 10:11
  • Please don't post pictures of text. Instead paste the text direct into the question. – Ingo Jan 15 at 11:35
  • 1
    @Ephemeral opencv@6.2.0 – Nicholas McNel Jan 15 at 15:16
  • 1
    @Ephemeral Yes I have tried following that as well as the link i first mentioned above. The error is happening when running the NPM Start Command as mentioned at the bottom of you referenced link. I know that Twilio hasn't updated the git for sometime and I even had to do some research to find out what they changed because a couple steps were not accurate – Nicholas McNel Jan 15 at 15:31
  • 1
    @Ephemeral Ill give it a try again, I want to say last night i tried to install the node-opencv as outlined on his git page "npm i opencv" and it installs what is currently installed on the machine. – Nicholas McNel Jan 15 at 15:52
0

While not exactly an answer I have figured out the issue. After doing a lot more research i found that the twilio blueprint example i was following was using the OpenCV 2 as the basis for the functions. The only way now to proceed would be to rebuild the script with OpenCV 4 functionality.

| improve this answer | |
  • Please accept your own answer with a click on the tick on its left side. Only this will finish the question and it will not pop up again year for year. – Ingo Jan 23 at 11:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.