Linux上使用数码相机

  刚拿到相机的时候,就在本上的Vista上插了一下,没想到Vista哗啦哗啦装了一堆东西,然后说这个佳能400D已经可用了,怪不得带着几个GB的驱动,真是准备充分啊。XP就不行,就得装佳能提供的光盘才能用。佳能同时也提供了MacOS使用的光盘。

  Linux安装时不会带这么多外围驱动,也没有厂商光盘。但Google了一下之后,发现一些Ubuntu的其他相机的结果,大体就是给udev加一 些规则,这个规则就是gphoto的规则。再查gphoto,发现一个支持的相机的列表,400D就在上面,上面还有许多著名不著名的,买相机时可以参 考。甚至EOS 1D mark II都在,了不得。号称超过900种。

  但是gphoto自己只是个库,给其他程序提供接口,同时只有一个命令行的程序。要想简单点用,就要装一个前端界面,这里是gtkam,gtk的,它 同时有一个gimp照片编辑软件的插件。gtkam可以查到相机,看照片,然后把选定的或全部的照片下载到硬盘上。其他客户端还有 gnocam,digikam/qtkam-这两个是qt的。

  总之还是很简单的。当然最差不过拿下卡来弄个读卡器来用,也可以。

 

Using the gphoto2 command line interface (CLI )

OK, we begin with finding out how you can connect a camera to your computer:

alice@host:~$ gphoto2 --list-ports
Devices found: 4
Path                             Description
--------------------------------------------------------------
serial:/dev/ttyS0                Serial Port 0                  
serial:/dev/ttyS2                Serial Port 2                  
serial:/dev/ttyS3                Serial Port 3                  
usb:                             Universal Serial Bus     

     

In this example, we see that we have the three serial devices /dev/ttyS0, /dev/ttyS2 and /dev/ttyS3 which are configured properly and to which gphoto2 has write permissions for. Additionally, there is also a USB bus. However, we cannot tell yet whether we will have write access to the USB device file your camera will be assigned by your operating system.

The next step is to connect your camera and find out whether the gphoto2 can find it. This only works with USB. If you are using a camera that connects over RS232, then you need to specify the model explicitly: gphoto2 cannot detect serial cameras (unlike USB, RS232 ports are dumb).

alice@host:~$ gphoto2 --auto-detect
Model                          Port                                            
----------------------------------------------------------
Canon PowerShot G2             usb:           

     

In this case, a camera called “Canon PowerShot G2” is connected to your system's USB bus.

If your camera is a Kodak EasyShare™ and if you use the dock, then you need to press the button to have the camera detected by the computer.

OK, so now let's see what we can find out about the camera:

alice@host:~$ gphoto2 --summary
Detected a 'Canon PowerShot G2'.                                               
Camera Summary:

Camera identification:
  Model: Canon PowerShot G2
  Owner: Alice Smith

Power status: on battery (power OK)

Flash disk information:
  Drive D:
   31'885'312 bytes total
   27'668'480 bytes available

Time: 2002-07-09 20:45:15 (host time +0 seconds)

     

The actual result of gphoto2 --summary may be different from camera to camera. However, we can see that gphoto2 obviously can talk to the camera, and we get some information about the camera.

OK, now that we have seen that there is some space occupied on the storage medium of the camera, let's have a look at what is stored there:

alice@host:~$ gphoto2 --list-files
Detected a 'Canon PowerShot G2'.                                               
There are no files in folder '/'.
There are no files in folder '/DCIM'.
There are 4 files in folder '/DCIM/154CANON':
#1     CRW_5417.CRW               rd  2334 KB image/x-canon-raw
#2     IMG_5415.JPG               rd  1044 KB image/jpeg
#3     IMG_5416.JPG               rd    31 KB image/jpeg
#4     MVI_5418.AVI               rd   682 KB video/x-msvideo
There are no files in folder '/DCIM/CANONMSC'.
     

There are multiple folders on the camera, and there are several files of different types and sizes on stored in one of them. One is a raw file of the type this camera produces, two are JPEG files (one large and one small) and one seems to be a short video sequence.

Now that we have an impression of what expects us when we actually download the images from the camera, we are going to do that:

alice@host:~$ gphoto2 --get-all-files
Detected a 'Canon PowerShot G2'.                                               
Downloading 'CRW_5417.CRW' from folder '/DCIM/154CANON'...
Saving file as CRW_5417.CRW                                                    
Downloading 'IMG_5415.JPG' from folder '/DCIM/154CANON'...
Saving file as IMG_5415.JPG                                                    
Downloading 'IMG_5416.JPG' from folder '/DCIM/154CANON'...
Saving file as IMG_5416.JPG                                                    
Downloading 'MVI_5418.AVI' from folder '/DCIM/154CANON'...
Saving file as MVI_5418.AVI                                                    
     

And now we have all the files in our current directory (in this case in directory ~) and can do something with them.

Well, that's about it. You may also want to have a look at the command line examples from the gphoto2(1) man page.

下载部份文件,比如你要下载文件列表时第7到第13个文件:

host:~$ gphoto2 --get-file 7-13


如果在fedora下,打开gThumb,在“文件”菜单里就可以import pictures,不要其它前端!





  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值