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

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


사이즈는 이정도!


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


핀 방향을 잘 맞춰서 꼽고


걸쇠를 다시 내려주면 끝!



$ 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 구차니