Code Monkey home page Code Monkey logo

edsdk4j's Introduction

EDSDK4J

This is a Java wrapper around the EDSDK that gives you full access to your Canon SLR camera via the EDSDK on Windows*. The features include:

  • Taking and downloading pictures
  • Manually adjusting focus
  • Setting apperature, exposure, ISO
  • Accessing live view

(*) With a few changes it could also work on Mac OSX.

Applying for SDK access

Before you can use this library you need to obtain the EDSDK native library from Canon. You can do so via their developers program:

Once you were granted access - this may take a few days - download the latest version of their library and follow the usage instructions.

Architecture

edsdk4j architecture overview

Using the EDSDK from Java directly is possible using the edsdk.native package, but because of threading difficulties and the involved data types this can be a bit painful. In the edsdk.utils package you find a small layer built on top of the EDSDK that gives you more Java-like examples.

Most notably, all calls are asynchroneous. Every command gives you a CanonTask and you can choose if you want to wait for the result or be notified when it's done.

CanonCamera slr = new CanonCamera(); 
slr.openSession();

// Use .get() to block and wait for the result
File file = slr.shoot().get(); 
System.out.println( "File: " + file.getAbsolutePath() );

// Use async handlers to continue your code immediately 
slr.shoot().whenDone( f -> System.out.println( f ) ); 

// close session! 
// because commands are queued this won't be executed 
// until the above slr.shoot() finished it's work. 
slr.closeSession(); 

Getting started

	CanonCamera slr = new CanonCamera(); 
	slr.openSession();
	File file = slr.shoot().get(); 
	slr.closeSession();

For more look at the examples in src/gettingstarted.

Notes

To regenerate the JNA wrapper classes:

set EDSDK_HOME=path-to-edsdk
ant generate-wrapper

Issues:

  • Currently JNAerator is not detecting __stdcall correctly so the Callbacks defined in EdSdkLibrary need to be manually modified to extend StdCallCallback. Technically EdSdkLibrary itself should also extend StdCallLibrary but it's possible to workaround this using options passed into the Native.loadLibrary() method (see CanonCamera class for this workaround).

edsdk4j's People

Contributors

anantapalani avatar kritzikratzi avatar yeroc avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.