File Exchange

image thumbnail

sonyalpha: Control a Sony Alpha Camera

version 18.812 (2.98 MB) by Emmanuel Farhi
Control a Sony Alpha Camera


Updated 07 Apr 2021

From GitHub

View Version History

View license on GitHub

SONYALPHA A class to control a Sony Alpha Camera (NEX, Alpha, ...) compatible with the Camera Remote API by Sony.
** Usage **
>> camera = sonyalpha;
>> image(camera);
Then you can use the Methods:
- getstatus(camera): get the camera status
- iso: set/get ISO setting
- shutter: set/get shutter speed setting
- mode: set/get the PASM mode
- timer: set/get the self timer
- fnumber: set/get the F/D aperture
- white: set/get the white balance
- image: take a shot and display it
- imread: take a shot and download the image (no display)
- ...

** Connecting the Camera **
Start your camera and use its Remote Control App (e.g. Play Memories App) from the Camera settings. This starts the JSON REST HTTP server, used to control the camera. The Network SSID is shown on the Camera screen. Connect from your PC on that network. The usual associated IP is then (port 8080)
The connection must be a dedicated ad-hoc, e.g. can NOT use an intermediate router. If you are already connected to the Internet, you have to drop your current connection, or use an additional Wifi adapter (e.g. USB-Wifi).

You can also connect the camera via a USB cable when GPhoto is installed.

** Requirements/Installation **
- Matlab, no external toolbox
- A wifi or USB connection
- A Sony Camera
- curl (for wifi)
- ffmpeg (for liveview via Wifi)
- gphoto2 (for USB)
Just copy the files and go into the directory. Then type commands above, once the camera is configured (see above).

** Credits **
(c) E. Farhi, GPL2, 2018.

Cite As

Emmanuel Farhi (2021). sonyalpha: Control a Sony Alpha Camera (, GitHub. Retrieved .

Comments and Ratings (2)

Emmanuel Farhi

Hi Irina, this contribution requires 'curl' which mostly run under Linux systems. The other dependencies are optional. Perhaps you can use the Windows Subsystem Linux under W10 (WSL).

Irina Rinder

Hello, does ist run on Win10?

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!