项目作者: dimensional-de

项目描述 :
Node AddOn Api module for Canon cameras
高级语言: C++
项目地址: git://github.com/dimensional-de/napi-canon-cameras.git
创建时间: 2021-03-07T22:26:16Z
项目社区:https://github.com/dimensional-de/napi-canon-cameras

开源协议:GNU General Public License v3.0

下载


@dimensional/napi-canon-cameras

EDSDK (Canon camera) wrapper module for Node.js

EDSDK Version: 13.18.40

Features

The EDSDK provides a lot of features and not all of them are
implemented in the module. Our use case was a photo booth
application.

  • List Cameras
  • Camera Events
  • Read Camera Properties
    • Text
    • Integer
      • Flags (true/false)
      • Options (named list values)
      • Aperture
      • Shutter Speed
      • Exposure Compensation
    • Integer Array
    • Time
  • Write Camera Properties
    • Text Properties
    • Integer
    • Integer Array
    • Time
  • Take Picture
    • Download To Directory
    • Download To File
    • Download To String (Base64)
  • Live View
    • Download Image To Data URL
    • Properties
    • Histogram
    • Rolling & Pitching
    • PowerZoom
  • Storage
    • List Volumes
    • List Directories and Files
    • Download Thumbnail
    • Download Files

Usage

  1. import {
  2. Camera, CameraProperty, FileChangeEvent, ImageQuality,
  3. Option,
  4. watchCameras
  5. } from '../';
  6. process.on('SIGINT', () => process.exit());
  7. // catch download request events
  8. cameraBrowser.setEventHandler(
  9. (eventName, event) => {
  10. if (eventName === CameraBrowser.Events.DownloadRequest) {
  11. const file = (event as DownloadRequestEvent).file;
  12. console.log(file);
  13. const localFile = file.downloadToPath(__dirname + '/images');
  14. console.log(`Downloaded ${file.name}.`);
  15. process.exit();
  16. }
  17. }
  18. );
  19. // get first camera
  20. const camera = cameraBrowser.getCamera();
  21. if (camera) {
  22. console.log(camera);
  23. camera.connect();
  24. // configure
  25. camera.setProperties(
  26. {
  27. [CameraProperty.ID.SaveTo]: Option.SaveTo.Host,
  28. [CameraProperty.ID.ImageQuality]: ImageQuality.ID.LargeJPEGFine,
  29. [CameraProperty.ID.WhiteBalance]: Option.WhiteBalance.Fluorescent
  30. }
  31. );
  32. // trigger picture
  33. camera.takePicture();
  34. } else {
  35. console.log('No camera found.');
  36. }
  37. // watch for camera events
  38. watchCameras();

Build Package

The package does not include the Canon EDSDK files. To install the package you will have
to build a TGZ.

  1. Unpack the Canon EDSDK into third_party. Keep the package name as subdirectory.
    • EDSDKv131800W.zipthird_party/EDSDKv131800W
  2. Make sure the variable edsdk_version in binding.gyp matches the EDSDK version. (The numeric part of the
    package name)
  3. Run npm run package
  4. Look for ../node_packages/@dimensional/napi-canon-cameras.tgz
  5. cd ../YourProject (Switch to your project directory)
  6. npm i ../node_packages/@dimensional/napi-canon-cameras.tgz

NPM Tasks

  • package - Create TGZ package for AddOn
  • prebuild - Build for 32 and 64bit Node.js
  • prebuild:x64 - Build for 64bit Node.js
  • prebuild:ia32 - Build for 32bit Node.js
  • build:docs - Update API documentation in README.md
  • build:stubs - Update and build stubs (needs prebuild AddOn)
  • clean - Remove build artifacts

FAQ

Does the module work in Electron Applications?

Yes.