LoginSignup
6
3

More than 5 years have passed since last update.

[Raspberry PI2] CentOSでカメラモジュールを使う

Last updated at Posted at 2016-05-24

Raspberry Pi2CentOSをインストールしたものの、
カメラモジュール有効化の話は、Raspbianraspi-configコマンドばかり。

残念ながらCentOSにはraspi-configはないので直接いじる。

参照:http://elinux.org/RPiconfig

/boot/config.txt
#uncomment to overclock the arm. 700 MHz is the default.
arm_freq=700# NOOBS Auto-generated Settings:
hdmi_force_hotplug=1
config_hdmi_boost=4
overscan_left=24
overscan_right=24
overscan_top=16
overscan_bottom=16
disable_overscan=0
core_freq=250
sdram_freq=400
over_voltage=0
# 追加
start_x=1

サンプル:https://raw.githubusercontent.com/Evilpaul/RPi-config/master/config.txt

再起動後、カメラモジュールを使ったアプリケーションをインストール。
これまたCentOSには標準で入ってないので、ソースビルドする

# git clone https://github.com/raspberrypi/userland.git
# cd userland
# ./buildme
インストールまでしてくれるのでしばらく待つ

インストールディレクトリは/opt/vc/
binディレクトリにraspistillがあるので
実行する

# /opt/vc/bin/raspistill -o img.jpg
raspistill: error while loading shared libraries: libmmal_core.so: cannot open shared object file: No such file or directory

ライブラリのチェック。

# ldd /opt/vc/bin/raspistill
        linux-vdso.so.1 =>  (0x7eb74000)
        libmmal_core.so => not found
        libmmal_util.so => not found
        libmmal_vc_client.so => not found
        libvcos.so => not found
        libbcm_host.so => not found
        libGLESv2.so => not found
        libEGL.so => not found
        libm.so.6 => /lib/libm.so.6 (0x76ee9000)
        libvcsm.so => not found
        libvchiq_arm.so => not found
        libpthread.so.0 => /lib/libpthread.so.0 (0x76ec9000)
        libdl.so.2 => /lib/libdl.so.2 (0x76ebc000)
        librt.so.1 => /lib/librt.so.1 (0x76ead000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x76e86000)
        libc.so.6 => /lib/libc.so.6 (0x76d3d000)
        /lib/ld-linux-armhf.so.3 (0x54b5d000)

全然ないwwwとおもったら、libディレクトリに全部あった!

# vi /etc/ld.so.conf
include ld.so.conf.d/*.conf
/opt/vc/lib

# ldconfig
# ldd /opt/vc/bin/raspistill
        libmmal_core.so => /opt/vc/lib/libmmal_core.so (0x76f30000)
        libmmal_util.so => /opt/vc/lib/libmmal_util.so (0x76f17000)
        libmmal_vc_client.so => /opt/vc/lib/libmmal_vc_client.so (0x76f04000)
        libvcos.so => /opt/vc/lib/libvcos.so (0x76ef1000)
        libbcm_host.so => /opt/vc/lib/libbcm_host.so (0x76ed2000)
        libGLESv2.so => /opt/vc/lib/libGLESv2.so (0x76eb5000)
        libEGL.so => /opt/vc/lib/libEGL.so (0x76e84000)
        libm.so.6 => /lib/libm.so.6 (0x76e10000)
        libvcsm.so => /opt/vc/lib/libvcsm.so (0x76e03000)
        libvchiq_arm.so => /opt/vc/lib/libvchiq_arm.so (0x76df3000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x76dd4000)
        libdl.so.2 => /lib/libdl.so.2 (0x76dc7000)
        librt.so.1 => /lib/librt.so.1 (0x76db8000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x76d92000)
        libc.so.6 => /lib/libc.so.6 (0x76c49000)
        /lib/ld-linux-armhf.so.3 (0x54b72000)

OK

# /opt/vc/bin/raspistill -o img.jpg
# identify -verbose img.jpg
Image: img.jpg
  Format: JPEG (Joint Photographic Experts Group JFIF format)
  Class: DirectClass
  Geometry: 2592x1944+0+0
  Resolution: 72x72
  Print size: 36x27
  Units: PixelsPerInch
  Type: TrueColor
  Endianess: Undefined
  Colorspace: sRGB
  Depth: 8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
  Channel statistics:
    Red:
      min: 33 (0.129412)
      max: 244 (0.956863)
      mean: 126.465 (0.495942)
      standard deviation: 33.745 (0.132333)
      kurtosis: 3.81118
      skewness: 1.79923
    Green:
      min: 37 (0.145098)
      max: 250 (0.980392)
      mean: 130.904 (0.513347)
      standard deviation: 40.5139 (0.158878)
      kurtosis: 1.25588
      skewness: 1.12529
    Blue:
      min: 18 (0.0705882)
      max: 242 (0.94902)
      mean: 74.2161 (0.291044)
      standard deviation: 43.4742 (0.170487)
      kurtosis: 6.60204
      skewness: 2.51813
  Image statistics:
    Overall:
      min: 18 (0.0705882)
      max: 250 (0.980392)
      mean: 110.528 (0.433444)
      standard deviation: 39.455 (0.154726)
      kurtosis: 4.95092
      skewness: 1.43484
  Rendering intent: Perceptual
  Gamma: 0.454545
  Chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
  Interlace: None
  Background color: white
  Border color: srgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Compose: Over
  Page geometry: 2592x1944+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: JPEG
  Quality: 100
  Orientation: Undefined
  Properties:
    date:create: 2016-05-24T08:58:32+00:00
    date:modify: 2016-05-24T08:58:32+00:00
    exif:ApertureValue: 30705/10000
    exif:BrightnessValue: 259/100
    exif:ColorSpace: 1
    exif:ComponentsConfiguration: 1, 2, 3, 0
    exif:Compression: 6
    exif:DateTime: 2016:05:24 08:58:31
    exif:DateTimeDigitized: 2016:05:24 08:58:31
    exif:DateTimeOriginal: 2016:05:24 08:58:31
    exif:ExifImageLength: 1944
    exif:ExifImageWidth: 2592
    exif:ExifOffset: 192
    exif:ExifVersion: 48, 50, 50, 48
    exif:ExposureMode: 0
    exif:ExposureProgram: 3
    exif:ExposureTime: 38012/1000000
    exif:Flash: 0
    exif:FlashPixVersion: 48, 49, 48, 48
    exif:FNumber: 28984/10000
    exif:FocalLength: 35976/10000
    exif:ImageLength: 1944
    exif:ImageWidth: 2592
    exif:InteroperabilityIndex: R98
    exif:InteroperabilityOffset: 910
    exif:ISOSpeedRatings: 160
    exif:JPEGInterchangeFormat: 1046
    exif:JPEGInterchangeFormatLength: 24576
    exif:Make: RaspberryPi
    exif:MakerNote: 101, 118, 61, 45, 49, 32, 109, 108, 117, 120, 61, 45, 49, 32, 101, 120, 112, 61, 51, 56, 48, 49, 50, 32, 97, 103, 61, 51, 56, 52, 32, 102, 111, 99, 117, 115, 61, 50, 53, 53, 32, 103, 97, 105, 110, 95, 114, 61, 49, 46, 55, 49, 48, 32, 103, 97, 105, 110, 95, 98, 61, 48, 46, 57, 56, 52, 32, 103, 114, 101, 101, 110, 110, 101, 115, 115, 61, 45, 54, 32, 99, 99, 109, 61, 49, 48, 50, 51, 52, 44, 45, 52, 51, 54, 52, 44, 45, 49, 55, 54, 54, 44, 45, 49, 52, 53, 54, 44, 54, 50, 48, 54, 44, 45, 54, 52, 50, 44, 55, 48, 48, 44, 45, 52, 51, 57, 50, 44, 55, 55, 57, 52, 44, 48, 44, 48, 44, 48, 32, 109, 100, 61, 48, 32, 116, 103, 61, 50, 53, 56, 32, 50, 54, 50, 32, 111, 116, 104, 61, 48, 32, 48, 32, 98, 61, 48, 32, 102, 61, 50, 53, 56, 32, 50, 54, 50, 32, 102, 105, 61, 48, 32, 73, 83, 80, 32, 66, 117, 105, 108, 100, 32, 68, 97, 116, 101, 58, 32, 79, 99, 116, 32, 50, 51, 32, 50, 48, 49, 53, 44, 32, 49, 54, 58, 50, 55, 58, 51, 54, 32, 86, 67, 95, 66, 85, 73, 76, 68, 95, 73, 68, 95, 86, 69, 82, 83, 73, 79, 78, 58, 32, 99, 49, 97, 56, 98, 54, 52, 51, 54, 55, 55, 48, 49, 49, 55, 57, 49, 97, 98, 101, 101, 97, 49, 102, 53, 100, 99, 51, 97, 52, 55, 51, 56, 51, 52, 57, 101, 97, 53, 53, 32, 40, 99, 108, 101, 97, 110, 41, 32, 86, 67, 95, 66, 85, 73, 76, 68, 95, 73, 68, 95, 85, 83, 69, 82, 58, 32, 100, 99, 52, 32, 86, 67, 95, 66, 85, 73, 76, 68, 95, 73, 68, 95, 66, 82, 65, 78, 67, 72, 58, 32, 109, 97, 115, 116, 101, 114, 32
    exif:MaxApertureValue: 30705/10000
    exif:MeteringMode: 2
    exif:Model: RP_OV5647
    exif:ResolutionUnit: 2
    exif:ShutterSpeedValue: 4717401/1000000
    exif:WhiteBalance: 0
    exif:XResolution: 72/1
    exif:YCbCrPositioning: 1
    exif:YResolution: 72/1
    jpeg:colorspace: 2
    jpeg:sampling-factor: 2x2,1x1,1x1
    signature: 12b87f6ab92c547ed08288034154e2d20150f899f38f59cca0861afd27883da3
  Profiles:
    Profile-exif: 25628 bytes
  Artifacts:
    filename: img.jpg
    verbose: true
  Tainted: False
  Filesize: 2.526MB
  Number pixels: 5.039M
  Pixels per second: 4.164MB
  User time: 1.220u
  Elapsed time: 0:02.210
  Version: ImageMagick 6.7.8-9 2016-05-09 Q16 http://www.imagemagick.org

いい感じ。

参考:
Raspberry Piで赤外線カメラモジュールを使ってみる
[Raspberry Pi] RaspberryPi 2でCentOS7 ことはじめ
[RaspberryPI2] (2016-01-25 updated) CentOSイメージが配布されてた

6
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
3