Hardware and Software for Capturing HDR Light Fields
Last edited on: July 17, 2021 12:57 AM
This project aims to design a system that captures HDR light fields to generate image-based 3D reconstruction for display on the HDR multi-focal stereoscope. The setup consists of an Arduino used to control the Stepper Motor and a Raspberry Pi used to send instructions to the Arduino and capture/receive images from the camera.
Hardware design
Arduino wiring
The Stepper Driver used in this setup is DQ542MA and the Stepper Motor used is NEMA 17 42BYGH-W811.
Connection between Stepper Driver and Arduino:
- PUL+ from Driver to Arduino PIN7
- PUL- from Driver to Arduino PIN5
- DIR+ from Driver to Arduino PIN7
- DIR- from Driver to Arduino PIN6
- ENBL+ from Driver to Arduino PIN7
Connection between Stepper Driver and Stepper Motor:
- A+ from Driver to Stepper BLACK wire
- A- from Driver to Stepper GREEN wire
- B+ from Driver to Stepper RED wire
- B- from Driver to Stepper BLUE wire
Connection between Button and Arduino:
- Button YELLOW wire to Arduino PINA0
DIP switch setting
The first three bits of the DIP switch are used to set the dynamic current. For an output current of 2.37A, SW 1, 2, 3 is set to OFF, OFF, ON.
Micro step resolution is set by the last four bits of the DIP switch. For 1600 pulse per revolution, SW 5, 6, 7, 8 is set to OFF, OFF, ON, ON.
Power supply
The power supply for the Stepper Driver is 18V (3 parallel sets of 2 9V batteries in series).
Serial communication with Python
Dependencies
Installing libgphoto2:
1 |
|
Installing python-gphoto2 and pySerial for python3 with pip:
1 |
|
Usage Examples
Specify the port and baud rate for the serial communication between Arduino and Raspberry Pi in python/camera.py
:
1 |
|
Set the parameters for HDR Light Field capture in python/gui.py
:
1 |
|
(Optional) Merge the captured images into HDR light field (requires OpenCV):
1 |
|
GUI design with python
GUI allows for basic motor and camera control:
- Motor speed can be set from 1 to 10. (disabled)
- Camera location can range from 0 to 1000.
- Number of exposures and stops can be set according to camera settings.
- Number of views can range from 1 to 1001.
- Click
Capture
to capture a single image. - Click
Capture LF
to capture HDR light field.
Uncomment relevant code in python/gui.py
to enable different controls.
Release History
- 0.2.0
- Edited code structure and added more controls
- CHANGE: Seperate
control.py
into andcontrol.py
andgui.py
- 0.1.0
- The first proper release
- CHANGE: Add
arduino
andpython
- 0.0.1
- Work in progress
All articles in this blog are used except for special statements CC BY-SA 4.0 reprint policy. If reproduced, please indicate source Ziyi Zhu!