blackdread / canon-sdk-java Goto Github PK
View Code? Open in Web Editor NEWCanon EOS SDK in java. Wrapper for Canon EOS Digital Software Development Kit EDSDK.
License: MIT License
Canon EOS SDK in java. Wrapper for Canon EOS Digital Software Development Kit EDSDK.
License: MIT License
I see the following code will take a picture:
Shoot shoot = camera.getShoot();
List<File> file = shoot.shoot();
Currently the picture is saved in a temp folder.
Is there also a possibility to get only a OutputStream?
Or do I need to get an outputstream from the file and delete the file afterwards? (not the best for performance!)
Any ideas?
Hello, I can't find anywhere or my bad search that can find how to set camera settings and send it to camera , In example How can I set SaveInto to Both or PC ? or change ImageSize?
Hi,
I would like to enable the live view in my GUI.
I want to do:
How can I do this... any examples etc.?
How does this general technically works? Do I have to send many images to my JSF Controller etc.?
Thanks for any help
Fail to get classes on class path when use framework as a dependency in another Spring boot project that is packaged into an executable jar via spring-boot-maven-plugin.
Line
final ImmutableSet<ClassPath.ClassInfo> allClasses = ClassPath.from(EdsAccess.class.getClassLoader()).getTopLevelClasses(NATIVE_ENUM_PACKAGE);
will return an empty set (in ConstantUtil).
Issue does not occur if package into an executable jar via shade/assembly/etc => no spring specific jar layout
Hi,
where can I find a Main class for the GUI which I can see under:
"Software example using this Framework/SDK"
Thanks
Hi,
Is it possible with your wrapper to get the shoot in a Stream ? I Don't want to save file on the PC.
Thank
Jimmy Simard
When shooting images one after another (not multiple at once, but shoot-download-shoot-download), I had a problem with busy camera. I think it's caused by reacting to bad event - I've noticed that one image was downloading two times.
Please, what is the right event to react on? I think it's kEdsObjectEvent_DirItemRequestTransfer
and we should skip kEdsObjectEvent_DirItemCreated
in Shoot task.
published in January 2019
When i receive the CameraAdded event. I expected the CameraManager.getAllCamera() to have it but the list had no elements. So i have no way to actually get the added camera so i can call openSession on it.
In the IDE, if i call refreshCamera before calling getAllCamera it work.. but refreshCamera isn't a public method. Technically, it should have been called if i did setRefreshInterval to 0 but it doesn't look like to be called in reality.
Here what i do,,
private CameraAddedListener cameraAddedListener = event -> {
cameraConnected = true;
Platform.runLater(() -> initializeCameraConnexion());
log.info("Camera added detected: {}", event);
};
then..
public void initializeCameraConnexion() {
log.info("initializeCameraConnexion()");
if (CameraManager.getAllCameras().size() > 0) {
this.camera = CameraManager.getAllCameras().get(0);
}
If i look at the getAllCameras() here the results...
https://i.imgur.com/sReHBLC.png
Now if i refresh manually just before here the results...
https://i.imgur.com/yMSSwDZ.png
Problem i have is that calling refreshCameras was possible because i am in the IDE but this method is not public. There is no way to instant refresh manually the cameras list.
Hi,
Can this be used for shooting video?
Now or in the near future
Thank you
Hello,
I try to make the sdk working in an java/javafx project. I final goal isto show the camera preview, take a picture and import it on the computer.
I work with a netbeans project. The project is a maven project and i put this on the pom
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<!-- For test class -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.5.0-M1</version>
<type>jar</type>
</dependency>
<!-- https://mvnrepository.com/artifact/org.blackdread/camera-binding -->
<dependency>
<groupId>org.blackdread</groupId>
<artifactId>camera-binding</artifactId>
<version>1.1.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.blackdread/canon-sdk-java -->
<dependency>
<groupId>org.blackdread</groupId>
<artifactId>canon-sdk-java</artifactId>
<version>1.1.4</version>
<type>pom</type>
</dependency>
<!-- https://mvnrepository.com/artifact/org.blackdread/camera-framework -->
<dependency>
<groupId>org.blackdread</groupId>
<artifactId>camera-framework</artifactId>
<version>1.1.4</version>
</dependency>
I create a standard javafxml main class and try to use some code from the demo directory.
Some code can be useless for my trouble you can skip it if i miss to remove it.
import java.util.List;
import java.util.concurrent.ExecutionException;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.fxml.JavaFXBuilderFactory;
import org.blackdread.camerabinding.jna.EdsdkLibrary;
import org.blackdread.cameraframework.api.camera.CameraManager;
import org.blackdread.cameraframework.api.camera.CanonCamera;
import org.blackdread.cameraframework.api.command.CanonCommand;
import org.blackdread.cameraframework.api.command.TerminateSdkCommand;
import org.blackdread.cameraframework.api.constant.EdsISOSpeed;
import org.blackdread.cameraframework.api.constant.EdsSaveTo;
import org.blackdread.cameraframework.api.helper.factory.CanonFactory;
import org.blackdread.cameraframework.api.helper.initialisation.FrameworkInitialisation;
import org.blackdread.cameraframework.api.helper.logic.event.CameraAddedListener;
import org.blackdread.cameraframework.api.helper.logic.event.CameraObjectListener;
import org.blackdread.cameraframework.api.helper.logic.event.CameraPropertyListener;
import org.blackdread.cameraframework.api.helper.logic.event.CameraStateListener;
import org.junit.jupiter.api.Assertions;
public class Launcher extends Application {
private CameraAddedListener cameraAddedListener;
private CameraObjectListener cameraObjectListener;
private CameraPropertyListener cameraPropertyListener;
private CameraStateListener cameraStateListener;
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
this.camTest();
}
private void camTest()
{
cameraAddedListener = event -> {
System.out.println("Camera added detected: "+ event);
};
cameraObjectListener = event -> {
System.out.println("Object event: "+ event);
};
cameraPropertyListener = event -> {
System.out.println("Property event: "+ event);
};
cameraStateListener = event -> {
System.out.println("State event: "+ event);
};
new FrameworkInitialisation()
.registerCameraAddedEvent()
.withEventFetcherLogic()
.withCameraAddedListener(cameraAddedListener)
.initialize();
final List<CanonCamera> cameras = CameraManager.getAllCameras();
Assertions.assertFalse(cameras.isEmpty());
final CanonCamera camera = cameras.get(0);
final EdsdkLibrary.EdsCameraRef edsCameraRef = get(camera.openSession());
// camera.setCameraRef(edsCameraRef); // not necessary as by default on success the ref is set by the openSession command
// optional as manager does it
get(camera.getEvent().registerObjectEventCommand());
get(camera.getEvent().registerPropertyEventCommand());
get(camera.getEvent().registerStateEventCommand());
CanonFactory.cameraObjectEventLogic().addCameraObjectListener(cameraObjectListener);
CanonFactory.cameraPropertyEventLogic().addCameraPropertyListener(edsCameraRef, cameraPropertyListener);
CanonFactory.cameraStateEventLogic().addCameraStateListener(edsCameraRef, cameraStateListener);
final String artist = get(camera.getProperty().getArtistAsync());
System.out.println("artist: "+ artist);
final String serial = get(camera.getProperty().getBodyIDExAsync());
System.out.println("serial: "+ serial);
final EdsISOSpeed isoSpeed = get(camera.getProperty().getIsoSpeedAsync());
System.out.println("isoSpeed: "+ isoSpeed);
final EdsSaveTo saveTo = get(camera.getProperty().getSaveToAsync());
System.out.println("saveTo: "+ saveTo);
get(camera.closeSession());
CanonFactory.commandDispatcher().scheduleCommand(new TerminateSdkCommand());
}
private static <R> R get(final CanonCommand<R> command) {
try {
return command.get();
} catch (InterruptedException | ExecutionException e) {
throw new IllegalStateException(e);
}
}
}
When i build there is no trouble but when i run i add this error :
[cmd-dispatcher-0] INFO org.blackdread.cameraframework.api.helper.factory.CanonLibraryImpl - Dll auto selected to 32 bit
[cmd-dispatcher-0] WARN org.blackdread.cameraframework.api.helper.factory.SingleCommandDispatcher - Command dispatcher thread ended
Exception in thread "cmd-dispatcher-0" java.lang.Error: Le chemin d’accès spécifié est introuvable. // This means the specify path can't be found
at com.sun.jna.Native.open(Native Method)
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:171)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:398)
at com.sun.jna.Library$Handler.<init>(Library.java:147)
at com.sun.jna.Native.loadLibrary(Native.java:412)
at org.blackdread.cameraframework.api.helper.factory.CanonLibraryImpl.initLibrary(CanonLibraryImpl.java:150)
at org.blackdread.cameraframework.api.helper.factory.CanonLibraryImpl.edsdkLibrary(CanonLibraryImpl.java:95)
at org.blackdread.cameraframework.api.helper.factory.CanonFactory.edsdkLibrary(CanonFactory.java:155)
at org.blackdread.cameraframework.api.command.InitializeSdkCommand.runInternal(InitializeSdkCommand.java:50)
at org.blackdread.cameraframework.api.command.InitializeSdkCommand.runInternal(InitializeSdkCommand.java:39)
at org.blackdread.cameraframework.api.command.AbstractCanonCommand.run(AbstractCanonCommand.java:131)
at org.blackdread.cameraframework.api.helper.factory.SingleCommandDispatcher.commandDispatcher(SingleCommandDispatcher.java:152)
at java.lang.Thread.run(Thread.java:748)
I translate the error message. I think it can come from several sources (but maybe from an other)
Thx for your help.
Hi,
I would like to know how can I customize the path?
Which kind of code do I need to set it to a specific path?
On the other hand I understood it also, that I can place the whole EDSDK / EDSDK64 folder in the "Ressource" folder from the Java project and it will be recognized automatically?
Thanks,
Hello Blackdread,
I would like to kindly ask you, if is it possible and if you can update binding from latest EDSDK? There is a tables with version - https://developers.canon-europe.com/developers/s/article/Latest-EOS-SDK-Version-13-x .
Thank you very much!
David
Describe the bug
To Reproduce
Expected behavior
Screenshots
Operating System:
Wrapper Framework version used:
Additional context
Hello everyone,
Thank you for this very useful library.
I have a question concerning only the EDSDK.
I'd like to be able to autofocus while retrieving images from the liveview.
In my case, when I autofocus, image retrieval stops and starts again once I've received the autofocus command.
I use the :
SendCommand(kEdsCameraCommand_PressShutterButton, kEdsCameraCommand_ShutterButton_Halfway) ;
Is this possible? This function is available via Canon's EOS Utility application.
Thank you for taking the time to read this document.
Hi.
Can someone please help me with copy of the sdk. I want to have a play to see if I can contribute.
I'm in Australia and despite there being no link on the Oceania site to actually apply, Oceania Canon is the most useless arm in the whole company anyway. If they even did have a link nobody would reply. It's always been like this from development to camera firmware.
If anyone can help me that would be great. Thanks.
To start have support for both java 8 and 11
does this sdk support ptp ip connection ? basically connecting to canon eos via wifi like in gphoto2
Is there a way to determine if camera is on manual mode ? Thanks you!
Can I use it for android app ?
Hi,
Try to start use this wrapper, but have some problems on start
I use code from demo and always get "CameraRef is null" exeption in camera.openSession() method
If use CameraManager.getAllCameras().get(0) it's ok and i get my camera (but it some others issues in demo code for me)
If use new CanonCamera() in edsdk4j it's ok and i get my camera.
Thank you
void tryOne() {
cameraAddedListener = event -> {
log.info("Camera added detected: {}", event);
};
cameraObjectListener = event -> {
log.info("Object event: {}", event);
};
cameraPropertyListener = event -> {
log.info("Property event: {}", event);
};
cameraStateListener = event -> {
log.info("State event: {}", event);
};
new FrameworkInitialisation()
.registerCameraAddedEvent()
.withEventFetcherLogic()
.withCameraAddedListener(cameraAddedListener)
.initialize();
final CanonCamera camera = new CanonCamera(); //camera have empty props
final EdsdkLibrary.EdsCameraRef edsCameraRef = get(camera.openSession());
// ...
}
Exception in thread "JavaFX Application Thread" java.lang.IllegalStateException: CameraRef is null
at org.blackdread.cameraframework.api.camera.CanonCamera.lambda$getCameraRefInternal$0(CanonCamera.java:149)
at java.util.Optional.orElseThrow(Optional.java:290)
at org.blackdread.cameraframework.api.camera.CanonCamera.getCameraRefInternal(CanonCamera.java:149)
at org.blackdread.cameraframework.api.camera.CanonCamera.dispatchCommand(CanonCamera.java:133)
at org.blackdread.cameraframework.api.camera.CanonCamera.openSession(CanonCamera.java:286)
at pdcanoncamera.PDCanonCamera.tryOne(PDCanonCamera.java:182)
camera-framework 1.1.1
EDSDK 3.9.0
win10 (x64)
Hi,
I´m trying this lib to connect my Canon 1300d.
The lib / dll files is found and i placed all the files in my project.
My camera is also switched on.
Is there any specifc settings which I have to do on the camera?
I´m getting this error message:
Failed to get property type and size of kEdsPropID_BodyIDEx (EDS_ERR_COMM_DISCONNECTED), inParam 0. Probably not supported by camera
Do I need a memory card inside the cam?
I see also during I start the program that the screen is poping up for 1 sec from the camera, so it seems there is a connection...
Here my log:
Aug. 02, 2022 12:13:29 NACHM. org.blackdread.cameraframework.api.helper.factory.CanonLibraryImpl registerCanonShutdownHook INFORMATION: Registered shutdown hook of library Aug. 02, 2022 12:13:29 NACHM. org.blackdread.cameraframework.api.helper.factory.CanonLibraryImpl initLibrary INFORMATION: Library successfully loaded Aug. 02, 2022 12:13:47 NACHM. org.blackdread.cameraframework.api.helper.factory.PropertyLogicDefault getPropertyTypeAndSize SCHWERWIEGEND: Failed to get property type and size of kEdsPropID_BodyIDEx (EDS_ERR_COMM_DISCONNECTED), inParam 0. Probably not supported by camera Aug. 02, 2022 12:13:47 NACHM. org.blackdread.cameraframework.api.helper.factory.CameraLogicDefault openSession INFORMATION: Error ignored while testing if camera is connected to open session org.blackdread.cameraframework.exception.error.communication.EdsdkCommDisconnectedErrorException: Port disconnected at org.blackdread.cameraframework.api.constant.EdsdkError.getException(EdsdkError.java:411) at org.blackdread.cameraframework.api.helper.factory.PropertyLogicDefault.getPropertyTypeAndSize(PropertyLogicDefault.java:64) at org.blackdread.cameraframework.api.helper.factory.PropertyGetLogicDefault.getPropertyData(PropertyGetLogicDefault.java:72) at org.blackdread.cameraframework.api.helper.logic.PropertyGetLogic.getPropertyData(PropertyGetLogic.java:88) at org.blackdread.cameraframework.api.helper.logic.PropertyGetShortcutLogic.getBodyIDEx(PropertyGetShortcutLogic.java:87) at org.blackdread.cameraframework.api.helper.factory.CameraLogicDefault.openSession(CameraLogicDefault.java:163) at org.blackdread.cameraframework.api.command.OpenSessionCommand.runInternal(OpenSessionCommand.java:60) at org.blackdread.cameraframework.api.command.OpenSessionCommand.runInternal(OpenSessionCommand.java:38) at org.blackdread.cameraframework.api.command.AbstractCanonCommand.run(AbstractCanonCommand.java:131) at org.blackdread.cameraframework.api.helper.factory.SingleCommandDispatcher.commandDispatcher(SingleCommandDispatcher.java:152) at java.base/java.lang.Thread.run(Thread.java:829)
I´m using:
Windows 8.1 Pro
64 Bit
Hello,
Sorry for asking questions here but support is rather limited for the EDSDK. I have searched everywhere and i couldn't see anything. By any chance, do you know if there is a way to determine if camera is ON or OFF? I mean is there an event or something that i can rely on to determine if the camera been disconnected? Because the method GetAllConnectedCamera will still return the camera even if its not available (unplugged for example).
Thanks for your help! That would be my last question.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.