embeded/raspberry pi2015. 8. 8. 19:37

Camera Serial Interface - CSI

Mobile Industry Processor Interface - MIPI

[링크 : https://en.wikipedia.org/wiki/MIPI_Alliance]


라즈베리 파이에 장착된 인터페이스로 CSI DSI중에

DSI는 구하기 드럽게 힘들고 -_-a

아무튼 카메라는 구할 수 있으니 일단 이녀석부터!


사이즈는 이정도!

SAMSUNG | SHV-E120K | Aperture priority | Center-weighted average | 1/30sec | F/2.6 | 0.00 EV | 4.0mm | ISO-160 | Off Compulsory | 2015:08:08 19:04:44


CAMERA 라고 써있는 녀석을 손톱으로 톡! 해서 들어 올리고

SAMSUNG | SHV-E120K | Aperture priority | Center-weighted average | 1/30sec | F/2.6 | 0.00 EV | 4.0mm | ISO-400 | Off Compulsory | 2015:08:08 19:05:26


핀 방향을 잘 맞춰서 꼽고

SAMSUNG | SHV-E120K | Aperture priority | Center-weighted average | 1/30sec | F/2.6 | 0.00 EV | 4.0mm | ISO-400 | Off Compulsory | 2015:08:08 19:05:37


걸쇠를 다시 내려주면 끝!

SAMSUNG | SHV-E120K | Aperture priority | Center-weighted average | 1/30sec | F/2.6 | 0.00 EV | 4.0mm | ISO-400 | Off Compulsory | 2015:08:08 19:05:50



$ sudo raspi-config


┌─────────┤ Raspberry Pi Software Configuration Tool (raspi-config) ├──────────┐

│                                                                              │

│    1 Expand Filesystem              Ensures that all of the SD card s        │

│    2 Change User Password           Change password for the default u        │

│    3 Enable Boot to Desktop/Scratch Choose whether to boot into a des        │

│    4 Internationalisation Options   Set up language and regional sett        │

│    5 Enable Camera                  Enable this Pi to work with the R        │

│    6 Add to Rastrack                Add this Pi to the online Raspber        │

│    7 Overclock                      Configure overclocking for your P        │

│    8 Advanced Options               Configure advanced settings              │

│    9 About raspi-config             Information about this configurat        │

│                                                                              │

│                                                                              │

│                                                                              │

│                     <Select>                     <Finish>                    │

│                                                                              │

└──────────────────────────────────────────────────────────────────────────────┘ 


          ┌──────────────────────────────────────────────────────────┐

          │                                                          │

          │ Enable support for Raspberry Pi camera?                  │

          │                                                          │

          │                                                          │

          │                                                          │

          │                                                          │

          │                                                          │

          │                                                          │

          │                                                          │

          │                                                          │

          │                                                          │

          │                                                          │

          │                                                          │

          │                                                          │

          │                                                          │

          │                                                          │

          │               <Disable>              <Enable>            │

          │                                                          │

          └──────────────────────────────────────────────────────────┘ 


Enable 해주고 나면 강제로 리부팅 된다.


pi@raspberrypi ~ $ raspi

raspi-config  raspistill    raspivid      raspiyuv

pi@raspberrypi ~ $ whereis raspistill

raspistill: /usr/bin/raspistill /usr/bin/X11/raspistill /opt/vc/bin/raspistill

pi@raspberrypi ~ $ whereis raspivid

raspivid: /usr/bin/raspivid /usr/bin/X11/raspivid /opt/vc/bin/raspivid


raspivid는 5초간만 출력하는것이 기본값이니 -t 0 으로 해주면 종료되지 않고 계속 출력된다.


pi@raspberrypi ~ $ raspistill

raspistill Camera App v1.3.8


Runs camera for specific time, and take JPG capture at end if requested


usage: raspistill [options]


Image parameter commands


-?, --help      : This help information

-w, --width     : Set image width <size>

-h, --height    : Set image height <size>

-q, --quality   : Set jpeg quality <0 to 100>

-r, --raw       : Add raw bayer data to jpeg metadata

-o, --output    : Output filename <filename> (to write to stdout, use '-o -'). If not specified, no file is saved

-l, --latest    : Link latest complete image to filename <filename>

-v, --verbose   : Output verbose information during run

-t, --timeout   : Time (in ms) before takes picture and shuts down (if not specified, set to 5s)

-th, --thumb    : Set thumbnail parameters (x:y:quality) or none

-d, --demo      : Run a demo mode (cycle through range of camera options, no capture)

-e, --encoding  : Encoding to use for output file (jpg, bmp, gif, png)

-x, --exif      : EXIF tag to apply to captures (format as 'key=value') or none

-tl, --timelapse        : Timelapse mode. Takes a picture every <t>ms

-fp, --fullpreview      : Run the preview using the still capture resolution (may reduce preview fps)

-k, --keypress  : Wait between captures for a ENTER, X then ENTER to exit

-s, --signal    : Wait between captures for a SIGUSR1 from another process

-g, --gl        : Draw preview to texture instead of using video render component

-gc, --glcapture        : Capture the GL frame-buffer instead of the camera image

-set, --settings        : Retrieve camera settings and write to stdout

-cs, --camselect        : Select camera <number>. Default 0

-bm, --burst    : Enable 'burst capture mode'

-md, --mode     : Force sensor mode. 0=auto. See docs for other modes available

-dt, --datetime : Replace frame number in file name with DateTime (YearMonthDayHourMinSec)

-ts, --timestamp        : Replace frame number in file name with unix timestamp (seconds since 1900)


Preview parameter commands


-p, --preview   : Preview window settings <'x,y,w,h'>

-f, --fullscreen        : Fullscreen preview mode

-op, --opacity  : Preview window opacity (0-255)

-n, --nopreview : Do not display a preview window


Image parameter commands


-sh, --sharpness        : Set image sharpness (-100 to 100)

-co, --contrast : Set image contrast (-100 to 100)

-br, --brightness       : Set image brightness (0 to 100)

-sa, --saturation       : Set image saturation (-100 to 100)

-ISO, --ISO     : Set capture ISO

-vs, --vstab    : Turn on video stabilisation

-ev, --ev       : Set EV compensation

-ex, --exposure : Set exposure mode (see Notes)

-awb, --awb     : Set AWB mode (see Notes)

-ifx, --imxfx   : Set image effect (see Notes)

-cfx, --colfx   : Set colour effect (U:V)

-mm, --metering : Set metering mode (see Notes)

-rot, --rotation        : Set image rotation (0-359)

-hf, --hflip    : Set horizontal flip

-vf, --vflip    : Set vertical flip

-roi, --roi     : Set region of interest (x,y,w,d as normalised coordinates [0.0-1.0])

-ss, --shutter  : Set shutter speed in microseconds

-awbg, --awbgains       : Set AWB gains - AWB mode must be off

-drc, --drc     : Set DRC Level

-st, --stats    : Force recomputation of statistics on stills capture pass

-a, --annotate  : Enable/Set annotate flags or text

-3d, --stereo   : Select stereoscopic mode

-dec, --decimate        : Half width/height of stereo image

-3dswap, --3dswap       : Swap camera order for stereoscopic

-ae, --annotateex       : Set extra annotation parameters (text size, text colour(hex YUV), bg colour(hex YUV))



Notes


Exposure mode options :

auto,night,nightpreview,backlight,spotlight,sports,snow,beach,verylong,fixedfps,antishake,fireworks


AWB mode options :

off,auto,sun,cloud,shade,tungsten,fluorescent,incandescent,flash,horizon


Image Effect mode options :

none,negative,solarise,sketch,denoise,emboss,oilpaint,hatch,gpen,pastel,watercolour,film,blur,saturation,colourswap,washedout,posterise,colourpoint,colourbalance,cartoon


Metering Mode options :

average,spot,backlit,matrix


Dynamic Range Compression (DRC) options :

off,low,med,high


Preview parameter commands


-gs, --glscene  : GL scene square,teapot,mirror,yuv,sobel

-gw, --glwin    : GL window settings <'x,y,w,h'> 


pi@raspberrypi ~ $ raspivid


raspivid Camera App v1.3.12


Display camera output to display, and optionally saves an H264 capture at requested bitrate



usage: raspivid [options]


Image parameter commands


-?, --help      : This help information

-w, --width     : Set image width <size>. Default 1920

-h, --height    : Set image height <size>. Default 1080

-b, --bitrate   : Set bitrate. Use bits per second (e.g. 10MBits/s would be -b 10000000)

-o, --output    : Output filename <filename> (to write to stdout, use '-o -')

-v, --verbose   : Output verbose information during run

-t, --timeout   : Time (in ms) to capture for. If not specified, set to 5s. Zero to disable

-d, --demo      : Run a demo mode (cycle through range of camera options, no capture)

-fps, --framerate       : Specify the frames per second to record

-e, --penc      : Display preview image *after* encoding (shows compression artifacts)

-g, --intra     : Specify the intra refresh period (key frame rate/GoP size). Zero to produce an initial I-frame and then just P-frames.

-pf, --profile  : Specify H264 profile to use for encoding

-td, --timed    : Cycle between capture and pause. -cycle on,off where on is record time and off is pause time in ms

-s, --signal    : Cycle between capture and pause on Signal

-k, --keypress  : Cycle between capture and pause on ENTER

-i, --initial   : Initial state. Use 'record' or 'pause'. Default 'record'

-qp, --qp       : Quantisation parameter. Use approximately 10-40. Default 0 (off)

-ih, --inline   : Insert inline headers (SPS, PPS) to stream

-sg, --segment  : Segment output file in to multiple files at specified interval <ms>

-wr, --wrap     : In segment mode, wrap any numbered filename back to 1 when reach number

-sn, --start    : In segment mode, start with specified segment number

-sp, --split    : In wait mode, create new output file for each start event

-c, --circular  : Run encoded data through circular buffer until triggered then save

-x, --vectors   : Output filename <filename> for inline motion vectors

-cs, --camselect        : Select camera <number>. Default 0

-set, --settings        : Retrieve camera settings and write to stdout

-md, --mode     : Force sensor mode. 0=auto. See docs for other modes available

-if, --irefresh : Set intra refresh type



H264 Profile options :

baseline,main,high



H264 Intra refresh options :

cyclic,adaptive,both,cyclicrows


Preview parameter commands


-p, --preview   : Preview window settings <'x,y,w,h'>

-f, --fullscreen        : Fullscreen preview mode

-op, --opacity  : Preview window opacity (0-255)

-n, --nopreview : Do not display a preview window


Image parameter commands


-sh, --sharpness        : Set image sharpness (-100 to 100)

-co, --contrast : Set image contrast (-100 to 100)

-br, --brightness       : Set image brightness (0 to 100)

-sa, --saturation       : Set image saturation (-100 to 100)

-ISO, --ISO     : Set capture ISO

-vs, --vstab    : Turn on video stabilisation

-ev, --ev       : Set EV compensation

-ex, --exposure : Set exposure mode (see Notes)

-awb, --awb     : Set AWB mode (see Notes)

-ifx, --imxfx   : Set image effect (see Notes)

-cfx, --colfx   : Set colour effect (U:V)

-mm, --metering : Set metering mode (see Notes)

-rot, --rotation        : Set image rotation (0-359)

-hf, --hflip    : Set horizontal flip

-vf, --vflip    : Set vertical flip

-roi, --roi     : Set region of interest (x,y,w,d as normalised coordinates [0.0-1.0])

-ss, --shutter  : Set shutter speed in microseconds

-awbg, --awbgains       : Set AWB gains - AWB mode must be off

-drc, --drc     : Set DRC Level

-st, --stats    : Force recomputation of statistics on stills capture pass

-a, --annotate  : Enable/Set annotate flags or text

-3d, --stereo   : Select stereoscopic mode

-dec, --decimate        : Half width/height of stereo image

-3dswap, --3dswap       : Swap camera order for stereoscopic

-ae, --annotateex       : Set extra annotation parameters (text size, text colour(hex YUV), bg colour(hex YUV))



Notes


Exposure mode options :

auto,night,nightpreview,backlight,spotlight,sports,snow,beach,verylong,fixedfps,antishake,fireworks


AWB mode options :

off,auto,sun,cloud,shade,tungsten,fluorescent,incandescent,flash,horizon


Image Effect mode options :

none,negative,solarise,sketch,denoise,emboss,oilpaint,hatch,gpen,pastel,watercolour,film,blur,saturation,colourswap,washedout,posterise,colourpoint,colourbalance,cartoon


Metering Mode options :

average,spot,backlit,matrix


Dynamic Range Compression (DRC) options :

off,low,med,high


지원가능한 해상도는 아래와 같은데..

5M에서도 15fps가 나오나보네? ㄷㄷㄷ



[링크 : http://www.ovt.com/uploads/parts/OV5647.pdf]


120 프레임 보고 싶은데.. 잘 안되는거 같네..

fps를 1로 해도 부드럽게 나온다.. 30fps 고정인가?

pi@raspberrypi ~ $ raspivid -w 320 -h 230 -t 0 -f -v -fps 120


raspivid Camera App v1.3.12


Width 320, Height 230, filename (null)

bitrate 17000000, framerate 120, time delay 0

H264 Profile high

H264 Quantisation level 0, Inline headers No

H264 Intra refresh type (null), period -1

Wait method : Capture forever

Initial state 'record'



Preview Yes, Full screen Yes

Preview window 0,0,1024,768

Opacity 255

Sharpness 0, Contrast 0, Brightness 50

Saturation 0, ISO 0, Video Stabilisation No, Exposure compensation 0

Exposure Mode 'auto', AWB Mode 'auto', Image Effect 'none'

Metering Mode 'average', Colour Effect Enabled No with U = 128, V = 128

Rotation 0, hflip No, vflip No

ROI x 0.000000, y 0.000000, w 1.000000 h 1.000000

Camera component done

Encoder component done

Starting component connection stage

Connecting camera preview port to preview input port

Starting video preview

Connecting camera stills port to encoder input port

Enabling encoder output port 


엘레파츠의 자료내에 포함된 예제 옵션

$ raspistill -o image.jpg

$ raspivid -o video.h264 -t 10000

[링크 : http://eleparts.co.kr/EPXD4BBD]


csi의 경우 /dev/video 처럼 v4l로 인식이 되지 않아 콘솔상에서 파이프라인을 통해 보내야 할 듯 하다.

$ raspivid -o - -t 9999999 -w 640 -h 360 -fps 25 | tee videofilename.h264 | cvlc stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:8090}' :demux=h264


[링크 : http://raspi.tv/.../how-to-stream-vlc-from-a-raspberry-pi-with-gpio-control-but-without-being-root] 


라즈베리 쪽 설정

pi@raspberrypi ~ $ raspivid -o - -t 0 |cvlc -vvv stream:///dev/stdin --sout '#standard{access=http,mux=ts,dst=:8090}' :demux=h264


클라이언트 쪽 설정/windows + vlc


vlc의 캐쉬를 0으로 설정해도 1초 정도의 지연이 생긴다 -_ㅠ


[링크 : https://www.raspberrypi.org/forums/viewtopic.php?f=43&t=43969] 




+

2015.08.24


Basically the cable specifications are :

Type : FFC / FPC (Flat Flex)

Wires : 15 

Pitch : 1mm

Contacts : Type B (This means you have the contacts at opposite sides of the cable. So one is at the top and the other at the bottom)

[링크 : https://www.raspberrypi.org/forums/viewtopic.php?f=43&t=43737]



+

2015.09.15


$ raspivid -o - -t 0 -n | cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/}' :demux=h264

[링크 : http://www.raspberry-projects.com/pi/pi-hardware/raspberry-pi-camera/streaming-video-using-vlc-player]

Posted by 구차니

댓글을 달아 주세요

  1. 안녕하세요? 늦었지만 결혼 축하드립니다. 다름이아니라 계속해서 눈팅만 하다가 이번에 용기 내어 문의 드리고 싶은것이 있는데요 . 엘레파츠에서 저도 같은 제품을 구입하려고하는데요. 감사합니다. 혹시 이제품 15pin ffc 인터페이스가 어떻게 구성되어 있는지 알수가 있을까요? 아무리 찾아봐도 이제품(엘레파츠)의 schemetic도 제공이 안되는것 같고 전화를 해도 잘 모른다고하고 좀 애매합니다.

    i2c초기 세팅 값도 제공이 안되는것 같은데요..혹시 도움좀 부탁드려도 될까요?

    2015.09.02 15:03 [ ADDR : EDIT/ DEL : REPLY ]
    • 에겅.. 연락처가 없네요 minimonk@tistory.com 으로 메일 부탁드립니다.
      일단.. 저도 엘레파츠에 질문을 해보았으나.. 동일 제품은 없는 것으로 답변을 들었습니다. devicemart에서 30핀 짜리 B 타입(서로 반대반향)으로 FFC가 있으나.. 돈이 없어서(흑!) 아직 구매하지 못했습니다.
      30핀을 사면.. 실력껏(-_-a) 반으로 자르면 2개가 나오는 마법을 구사할 수 있지 않을까 합니다만.. 아직 사용이 가능해서 구매는 잠시 보류중입니다(택배비라던가...)

      http://www.devicemart.co.kr/15174

      그리고 i2c는 제가 해본글이
      http://minimonk.net/5734 에 있습니다.
      raspi-config 에서 i2c 올리고 나서도
      /etc/modules에
      i2c-dev
      i2c-bcm2708
      두개를 올려주셔야 정상 작동 할겁니다.

      2015.09.02 15:43 신고 [ ADDR : EDIT/ DEL ]