Monday, March 14, 2011

RoBook Scanner II( Automation)

Introduction:

Now is the time to move on to the 2nd phase of the project and that is automating the scanning process.But before anything else , camera automation is our concern first and if we are going to deal it that is the zooming features.
The zooming of a camera is in the category of capture calibration , every time user will be using this features for image viewing adjustment ,the motor is triggered and the actuation pushes the lens and causes its zooming- a requirements in scanning procedures.

Objectives:
To automate the camera capture mode
To sync the camera to the robot arm sensor.
Initial phase of RoBook Scanner automations

Requirements:
1) An installed libgphoto2 and gphoto2 and libraries
2) A Powershot camera (Canon G10)
3) USB Cables

Methodology:
Note:
Please use the gphoto manual to explore further command combinations.At the cli type:
root@localhost# gphoto2 --help

Installation
:

  • Make sure nothing else has access to the camera, and kill any other possible gphoto instances.
root@localhost# ps aux | grep gphoto2
  • kill -9 pidof gphoto2
  • pkill PTP
  • pkill gphoto2

Gphoto Setup Camera:

  • gphoto2 --set-config capture=On
  • gphoto2 --set-config whitebalance=4
  • gphoto2 --set-config zoom=5
  • gphoto2 --set-config assistlight=Off
  • gphoto2 --set-config iso=0
  • gphoto2 --set-config canonflashmode=off
  • gphoto2 --set-config focusingpoint=0

Gphoto Testing Purposes

  • gphoto2 --set-config canonimgquality=0
  • gphoto2 --set-config canonimgsize=3
Gphoto Production Settings
  • gphoto2 --set-config shootingmode=3
  • gphoto2 --set-config aperture=18
  • gphoto2 --set-config shutterspeed=25
  • gphoto2 --set-config iso=0
  • gphoto2 --set-config canonimgquality=1
  • gphoto2 --set-config canonimgsize=1

Gphoto Camera toggle Focus

  • gphoto2 --set-config focuslock=on
  • gphoto2 --set-config focuslock=off

Gphoto Capture interval

Take Photos every 2 minutes

  • gphoto2 --capture-image --interval=180 --frames=0

Take videos every 2 minutes

   gphoto2 --capture-movie=2s --port=usb:001,075

Get battery level

   gphoto2 --get-config batterylevel | grep Current | cut -c 9-13 

Detail(1) Video on G10 Mono capture automation

Detail(2) Video on G10 Stereo capture automations


Detail(3) Gambas (VB for Linux) Test program


Detail(4) Zooming and Remote Controls

Remarks:

Hints:
1) See to it that your PC is able to detect your G10
root@localhost/gphoto2/gphoto2/ ./gphoto2 --auto-detect
2) To set on automating the camera root@localhost/gphoto2/gphoto2/ ./gphoto2 --set-config capture=On root@localhost/gphoto2/gphoto2/ ./gphoto2 --set-config zoom=15
Note: Automation range depend on the zoom level of your camera (what was mine is g10)
3) To automate zooming on multiple cameras , just use the command
root@localhost#:/usr/local/gphoto2/gphoto2# ./gphoto2 --list-ports

Devices found: 7
Path Description
--------------------------------------------------------------
ptpip: PTP/IP Connection
serial:/dev/ttyS0 Serial Port 0
serial:/dev/ttyS1 Serial Port 1
serial:/dev/ttyS2 Serial Port 2
serial:/dev/ttyS3 Serial Port 3
usb:001,024 Universal Serial Bus
usb:001,023 Universal Serial Bus

So you can now freely include the ports and id....
root@localhost# gphoto2 --set-config zoom=20 --port=usb:001,023
root@localhost# gphoto2 --set-config zoom=20 --port=usb:001,024

Or we have the options every time we want to forcibly over write the captured image
root@localhost# gphoto2 --set-config zoom=20 --force-overwrite --port=usb:001,024

Future preferences:
Note:
As much as possible we should be able to zoom out (+) or in (-) an image as added calibration's features.Below are the suggested zoom call function:


# [Initialize Zooming]

def zoom(self,zoom,port)
captureCmd = [
"gphoto2",
"--set-config capture=On"
]
utils.invokeCommandSync(captureCmd, CaptureError, \
"Could not initialize zooming an image")
return zoom

# [Zoom Calibration values]
def zoom(self,zoom,port)
captureCmd = [
"gphoto2",
"--set-config zoom=%" % zoom,
"--port=%" % port
]
utils.invokeCommandSync(captureCmd, CaptureError, \
"Could not zoom an image with the value of %zoom" on \
% port)
return zoom


Conclusions:

So far So near to an end of deploying RoBook Scanner


3 comments:

  1. Please see the previous techno blog because the procedures are there.

    Mechatronics & Robotics
    Microcontroller Embedded Design

    Thanks

    E^3

    ReplyDelete
  2. can I run the software in Windows 7?
    thanks

    ReplyDelete
  3. Hi Sir orakariK

    The code is compiled under Gambas2 (Fedora /Ubunto)
    so this time it only runs in Linux.

    But if you are a developer ,you can try their SDK (Canon or Nikon) it is then you can have it running in Windows be it XP or Windows 7

    ReplyDelete