Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

And we are archiving all the images on IPFS. 

Image volume

Each image taken by the Theta SC has a resolution of 5376×2688 pixels, which is equivalent to approximately 14 megapixels. 

...

  1. Determine when and how to take a photograph
    1. when (cron entry or continuos loop)
    2. how (light settings)
  2. Trigger the photograph from openvinopi
    1. Take the picture
    2. Download the picture from Theta SC to openvinopi
    3. Erase the picture on the camera
  3. Process the image
    1. include metadata (hash for blockchain)
    2. publish the still image (as most recent image on web)
  4. Create a timelapse of the past 24h
    1. Select the appropriate images
    2. Concatenate the images into a 360º video
    3. Publish the video to YouTube with appropriate metadata
    4. Archive images
  5. Create a timelapse of the past month?
    1. Select the appropriate images
    2. Concatenate the images into a 360º video
    3. Publish the video to YouTube with appropriate metadata
  6. Create a timelapse of the season - May6 - May6
    1. Select the appropriate images
    2. Concatenate the images into a 360º video
    3. Publish the video to YouTube with appropriate metadata

...

gphoto2 is the software used to capture images from the camera, via USB. 

gphoto2 uses ptpcam.


Install gphoto2

pi@vinoblock:~ $ sudo apt-get install gphoto2.

...

Deleting file /store_00010001/DCIM/100RICOH/R0013444.JPG on the camera
*** Error ***              
PTP Invalid Object Handle

ptpcam

We need to install ptpcam as well, for managing camera functions, such as shutterspeed and monitoring battery levels (in case of voltage problems).


To compile libptp2 on Raspberry PI one has to install following dependencies:

apt-get -y install build-essential &&
apt-get -y install libtool &&
apt-get -y install automake &&
apt-get -y install pkg-config &&
apt-get -y install subversion &&
apt-get -y install libusb-dev

Then checkout the current source code:

svn checkout svn://svn.code.sf.net/p/libptp/code/trunk libptp-code

Compile the libptp2 and its companion tool:

cd libptp-code

./autogen.sh
./configure
make


And finally install:

sudo make install 
sudo ldconfig


Make sure that you properly connected the camera and the user you run ptpcam has proper permissions to access USB devices. If you stumble upon something like:

# ptpcam -l

Listing devices...
bus/dev vendorID/prodID device model
ERROR: Could not open session!
Try to reset the camera.

# dmesg | tail
[829332.584482] usb 1-1.5.1: new full-speed USB device number 46 using dwc_otg
[829332.689240] usb 1-1.5.1: New USB device found, idVendor=04b0, idProduct=040e
[829332.689259] usb 1-1.5.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[829332.689271] usb 1-1.5.1: Product: NIKON DSC D70s
[829332.689282] usb 1-1.5.1: Manufacturer: NIKON
[829336.094289] usb 1-1.5.1: usbfs: interface 0 claimed by usbfs while 'ptpcam' sets config #1
[829336.094598] usb 1-1.5.1: usbfs: process 8416 (ptpcam) did not claim interface 0 before use

Manipulating properties

To list the properties that your camera support use the -p switch:

# ptpcam -p 

Listing properties...
Camera: D3300
 0x5001: Battery Level
 0x5003: Image Size
 0x5004: Compression Setting
 0x5005: White Balance
 0x5007: F-Number
 0x5008: Focal Length
 0x500a: Focus Mode
 0x500b: Exposure Metering Mode
 0x500c: Flash Mode
 0x500d: Exposure Time
 0x500e: Exposure Program Mode
 0x500f: Exposure Index (film speed ISO)
 0x5010: Exposure Bias Compensation
 0x5011: Date Time
 0x5013: Still Capture Mode
 0x5018: Burst Number
 0x501c: Focus Metering Mode
 0xd303: UNKNOWN
 0xd406: UNKNOWN
 0xd407: UNKNOWN

Unfortunately not all proprietary extension properties are documented or reversed and hence listed as UNKNOWN (though you might still be able to identify and manipulate them).

Properties can be of various types like UINT8, UINT32, INT16, STRING, etc. and its values can be either random (rarely), range (for numeric properties) or enumerated (any  type). To show property along its value and description use switch -s together with -v:

# ptpcam -s 0x5001 -v

Camera: D3300
Battery Level: [0x5001, readonly, UINT8] 
 Current value: 100
 Factory value: 100
Range [0 - 100; step 1]


Alternatively you can also use the textual property names with abbreviations, like this (–set without –val is equivalent of -s):

# ptpcam --set Battery -v

Camera: D3300
Battery Level: [0x5001, readonly, UINT8] 
 Current value: 100
 Factory value: 100
Range [0 - 100; step 1]

From the output we can find that property Battery Level is a readonly property (of UINT8 type), its current value is 100 and possible values are in range between 0and 100 with step of 1.

Other properties are settable, for example:

# ptpcam -s 0x5003 -v

Camera: D3300
Image Size: [0x5003, readwrite, String] 
 Current value: "4496x3000"
 Factory value: "6000x4000"
Enumerated:
"6000x4000"
"4496x3000"
"2992x2000"

The Image Size property is a string and is readwrite. Please note that some properties (in example F-Stop) can be set only in certain camera modes (Manual, Aperture Priority)  so make sure you turn the dial to proper mode before complain that given property is readonly.

To obtain the overview of camera properties use –show-all-properties switch along -v:

# ptpcam --show-all-properties -v

Camera: D200
 0x5001: (Battery Level) 50
 0x5003: (Image Size) "3872x2592"
 0x5004: (Compression Setting: JPEG Normal) 1
 0x5005: (White Balance: Automatic) 2
 0x5007: (F-Number: 16.0) 1600
 0x5008: (Focal Length: 18mm) 1800
 0x500a: (Focus Mode: Manual) 1
 0x500b: (Exposure Metering Mode: Multi-spot) 3
 0x500c: (Flash Mode: Front-courtain) -32752
 0x500d: (Exposure Time: 0.1000s) 1000
 0x500e: (Exposure Program Mode: Manual) 1
 0x500f: (Exposure Index (film speed ISO)) 400
 0x5010: (Exposure Bias Compensation: 0.0) 0
 0x5011: (Date Time) "20150610T220559"
 0x5013: (Still Capture Mode: Single Frame) 1
 0x5018: (Burst Number) 1
 0x501c: (Focus Metering Mode: Single Area) -32752


Some cameras support less properties while others support more:

# ptpcam --show-all-properties -v

Camera: D70s
 0x5001: (Battery Level) 100
 0x5003: (Image Size) "3008x2000"
 0x5004: (Compression Setting: JPEG Fine) 2
 0x5005: (White Balance: Automatic) 2
 0x5007: (F-Number: 0.0) 0
 0x5008: (Focal Length: 0mm) 0
 0x500a: (Focus Mode: Manual) 1
 0x500b: (Exposure Metering Mode: Multi-spot) 3
 0x500c: (Flash Mode: Front-courtain) -32752
 0x500d: (Exposure Time: 0.1666s) 1666
 0x500e: (Exposure Program Mode: Manual) 1
 0x500f: (Exposure Index (film speed ISO)) 200
 0x5010: (Exposure Bias Compensation: 0.0) 0
 0x5011: (Date Time) "20150611T001523"
 0x5013: (Still Capture Mode: Single Frame) 1
 0x5018: (Burst Number) 1
 0x501c: (Focus Metering Mode: Single Area) -32752
 0xd017: (NIKON White Balance Auto Bias) 0
 0xd018: (NIKON White Balance Tungsten Bias) 0
 0xd019: (NIKON White Balance Flourescent Bias) 1
 0xd01a: (NIKON White Balance Daylight Bias) 3
 0xd01b: (NIKON White Balance Flash Bias) 2
 0xd01c: (NIKON White Balance Cloudy Bias) 0
 0xd01d: (NIKON White Balance Shade Bias) 1
 0xd01f: (UNKNOWN) 0
 0xd025: (UNKNOWN) 28115589
 0xd026: (UNKNOWN) 36372868
 0xd02a: (NIKON Image Sharpening: -2 Low) 2
 0xd02b: (NIKON Tone Compensation: Normal) 1
 0xd02c: (NIKON Color Mode: IIIa (sRGB)) 2
 0xd02d: (NIKON Hue Adjustment) 0
 0xd045: (UNKNOWN) 0
 0xd04f: (NIKON Focus Area Wrap: No Wrap) 0
 0xd054: (NIKON ISO Auto: Off) 0
 0xd056: (NIKON EV Step: 1/3) 0
 0xd058: (NIKON Exposure Compensation by Command Dial only: Off) 0
 0xd059: (NIKON Center Weighted Area: 8mm) 1
 0xd05e: (NIKON AE Lock Mode: AE-L Button) 0
 0xd05f: (NIKON AE-L/AF-L Mode: Exposure and Focus Lock) 0
 0xd062: (NIKON Meter-Off: 6s) 1
 0xd063: (NIKON Self Timer: 10s) 2
 0xd064: (NIKON Monitor Off: 20s) 1
 0xd06b: (NIKON Long Exposure Noise Reduction: On) 1
 0xd06c: (NIKON File Number Sequence: On) 1
 0xd075: (NIKON Slowest Flash Shutter Speed: 1/60) 0
 0xd078: (NIKON Bracket Set: AE & Flash) 0
 0xd07a: (NIKON Bracket Order: MTR->Under->Over) 0
 0xd086: (NIKON Reverse Command Dials: Yes) 1
 0xd08a: (NIKON No CF Card: Enabled Release) 0
 0xd090: (NIKON Image Comment String) " "
 0xd091: (NIKON Image Comment Attach: Off) 0
 0xd092: (NIKON Image Rotation: Automatic) 0
 0xd0c0: (NIKON Bracketing: Off) 0
 0xd0c2: (NIKON Bracketing Program: +2F) 1
 0xd0c3: (UNKNOWN) 1
 0xd0c4: (NIKON White Balance Bracket Step) 0
 0xd0c5: (UNKNOWN) 0
 0xd0e0: (NIKON Lens ID) 0
 0xd0e1: (UNKNOWN) 0
 0xd0e2: (UNKNOWN) 0
 0xd0e3: (NIKON Min. Focal Length: 0) 0
 0xd0e4: (NIKON Max. Focal Length: 0) 0
 0xd0e5: (NIKON Max. Aperture at Min. Focal Length: 0.0) 0
 0xd0e6: (NIKON Max. Aperture at Max. Focal Length: 0.0) 0
 0xd100: (NIKON Exposure Time: 1/6) 65542
 0xd101: (NIKON AC Power) 0
 0xd102: (UNKNOWN) 0
 0xd103: (NIKON Maximum Shots) 2
 0xd104: (NIKON AF-L Locked) 0
 0xd105: (NIKON AE Lock: Not Locked) 0
 0xd106: (NIKON AF Lock) 0
 0xd108: (NIKON Autofocus Area selector: <CENTER>) 0
 0xd109: (UNKNOWN) 0
 0xd10a: (NIKON Light Meter) 0
 0xd10d: (UNKNOWN) "NO= 1006b1f2 "
 0xd10e: (NIKON Camera orientation: Landscape) 0
 0xd10b: (UNKNOWN) 0
 0xd120: (UNKNOWN) 0
 0xd121: (UNKNOWN) 0
 0xd122: (UNKNOWN) 0
 0xd124: (UNKNOWN) 0
 0xd125: (UNKNOWN) 1
 0xd126: (NIKON Flash Exposure Compensation: 0.0) 0
 0xd140: (NIKON Optimize Image: Vivid) 1
 0xd142: (NIKON Saturation: Moderate) 1
 0xd160: (NIKON Beep: On) 0
 0xd161: (NIKON Autofocus Mode: AF-S (single-servo)) 0
 0xd163: (NIKON AF Assist Lamp: On) 0
 0xd164: (NIKON Auto ISO shutter limit for P A and DVP Mode: 1/30) 2
 0xd165: (NIKON Image Review: On) 0
 0xd166: (NIKON AF Area Illumination: Auto) 0
 0xd167: (NIKON Flash Mode: TTL) 0
 0xd168: (NIKON Flash Commander Mode: TTL) 0
 0xd169: (NIKON Flash Signal Indicator: On) 0
 0xd16b: (NIKON Remote Timeout: 1min) 0
 0xd16c: (NIKON Viewfinder Grid Display: Off) 0
 0xd16d: (NIKON Flash Manual Mode Power: Full power) 0
 0xd16e: (NIKON Flash Commander Mode Power: FULL) 0
 0xd180: (NIKON CSM Menu: Detailed) 1
 0xd190: (NIKON Bracketing Increment: 2.0) 12
 0xd1b0: (NIKON Low Light Indicator: No) 0
 0xd1c0: (NIKON Flash Open: No) 0
 0xd1c1: (NIKON Flash Charged: No) 0
# ptpcam --show-all-properties -v

Camera: D3300
 0x5001: (Battery Level) 100
 0x5003: (Image Size) "4496x3000"
 0x5004: (Compression Setting) 1
 0x5005: (White Balance: Automatic) 2
 0x5007: (F-Number: 1.8) 180
 0x5008: (Focal Length: 30mm) 3000
 0x500a: (Focus Mode) -32750
 0x500b: (Exposure Metering Mode: Multi-spot) 3
 0x500c: (Flash Mode) -32752
 0x500d: (Exposure Time: 0.0012s) 12
 0x500e: (Exposure Program Mode: Manual) 1
 0x500f: (Exposure Index (film speed ISO)) 6400
 0x5010: (Exposure Bias Compensation: 0.0) 0
 0x5011: (Date Time) "20150610T225551"
 0x5013: (Still Capture Mode: Normal) 1
 0x5018: (Burst Number) 1
 0x501c: (Focus Metering Mode) -32751
 0xd303: (UNKNOWN) 1
 0xd406: (UNKNOWN) "Windows/6.0.5330.0 MTPClassDriver/6.0.5330.0"
 0xd407: (UNKNOWN) 1


As you can see in the output some vendor extension modes are not recognized and are displayed as numeric values rather than descriptive text. However we can inspect such properties anyway:

# ptpcam -s 0x501c -v

Camera: D3300
Focus Metering Mode: [0x501c, readwrite, UINT16] 
 Current value: 0x8011 (-32751)
 Factory value: 0x8011 (-32751)
Enumerated:
0x0002 (2) [Multi-spot]
0x8010 (-32752)
0x8011 (-32751)
0x8012 (-32750)

Mind that you can use textual property names with abbreviations:

# ptpcam --set "Focus M" -v

Camera: D3300
Focus Mode: [0x500a, readonly, UINT16] 
 Current value: 0x8012 (-32750)
 Factory value: 0x8012 (-32750)
Enumerated:
0x0001 (1) [Manual]
0x8010 (-32752)
0x8011 (-32751)
0x8012 (-32750)
0x8013 (-32749)

# ptpcam --set "Focus Me" -v

Camera: D3300
Focus Metering Mode: [0x501c, readwrite, UINT16] 
 Current value: 0x8011 (-32751)
 Factory value: 0x8011 (-32751)
Enumerated:
0x0002 (2) [Multi-spot]
0x8010 (-32752)
0x8011 (-32751)
0x8012 (-32750)

Setting properties is as simple as it can be:

# ptpcam --set "Focus Me" -v --val 2

Camera: D3300
'Focus Metering Mode' is set to: 0x8011 (-32751)
Changing property value to 2 [Multi-spot] succeeded.

# ptpcam --set Image --val 6000x4000

Camera: D3300
'Image Size' is set to: "4496x3000"
Changing property value to 6000x4000 [(null)] succeeded.

# ptpcam -s 0x5005 --val 4

Camera: D3300
'White Balance' is set to: [Automatic]
Changing property value to 4 [Daylight] succeeded.

Power issues

The Ricoh Theta SC will work if directly connected to the Raspberry Pi USB - even with 5m of USB cable. HOWEVER, the Pi does not deliver enough power to charge, or maintain the charge , of the Theta SC over a long period of time, and will start to fuck up, with the following warning visible in /var/log/messages (output of dmesg):


I have tested this both with several different USB cables, short and long, including the USB cable that came with the camera. It would appear that the problem is insufficient voltage from the RPi. 

This is annoying. To get around the problem, we have to split the 5v power source to the camera from the USB data lines.