Skip to content

UrielCh/opencv-electron

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

opencv-electron

This is an example of how to use opencv4nodejs with electron to build cross-platform desktop apps.

opencv-electron

Note that there is an additional npm script to rebuild the package for electron, which is called from the install script:

"electron-rebuild": "electron-rebuild -w opencv4nodejs"

plain-js

This example shows how to use opencv4nodejs with electron and plain HTML + Javascript without any bundler.

Running this example (plain-js)

Set up opencv4nodejs, electron and rebuild the module for electron

npm install

Run

npm start

webpack-reactjs

This example shows how to use opencv4nodejs with webpack and react, requires node-loader to load the native addon.

npm i node-loader

On windows

If you are using the autobuild on windows, you have to append the path to the binaries to the path env of main process manually as follows (in main.js):

if (process.platform === 'win32' && !process.env.OPENCV4NODEJS_DISABLE_AUTOBUILD) {
  process.env.path += ';' + require('../renderer/node_modules/opencv-build').opencvBinDir
}

Running this example (webpack-reactjs)

In the root directory:

npm install
npm start

In another terminal cd into ./renderer and run the dev server:

npm install
npm start

Known issues

If you are receiving the following error on windows during electron-rebuild:

AttributeError: 'MSVSProject' object has no attribute 'iteritems'

Delete fsevents from your node_modules folder and rerun:

npm run electron-rebuild

About

Example for using opencv4nodejs with electron.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 53.5%
  • JavaScript 30.5%
  • TypeScript 13.8%
  • CSS 2.2%