이것은 롤아웃 사진 또는 슬릿 스캐닝 의 원칙을 사용하여 원통형 표면의 2D 이미지를 생성하기위한 간단한 예제 패키지입니다.
이 패키지에는 새로운 비디오 캡처 및 비디오 스트림 처리의 두 가지 주요 기능이 있습니다. 또한 명령 줄 인터페이스 (CLI) 또는 파이썬 패키지로서 두 가지 형태로 사용할 수 있습니다. CLI 스크립트는 자신의 파이썬 스크립트에서 어떻게 사용될 수 있는지에 대한 예를 보여줍니다.
이 코드는 테스트 및 Linux OS에서만 작동하는 것으로 확인되었지만 다른 사람들에게는 작동 할 수 있습니다.
PIP를 사용하여 설치 :
pip install git+git://github.com/NaturalHistoryMuseum/revile.git#egg=revile
카메라는 /dev/video
장치에서 스트리밍해야합니다. 모든 카메라에서는 불가능할 수 있습니다. 사양을 확인하십시오. 사용 가능한 미리보기 모드로 USB를 통해 연결된 카메라의 경우 v4l2loopback
사용하여이를 수행 할 수 있습니다. v4l2loopback
설치 한 후 :
modprobe v4l2loopback
find /dev -name ' video* ' | sort | tail -n 1 # to find the device
gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p -threads 8 -r 60 -f v4l2 /dev/video[DEVICE NUMBER HERE]
revile video --help
Usage: revile video [OPTIONS]
Takes a video and spins the motor at the same time, then processes the
frames of the video file.
Options:
-l, --length INTEGER The length of the video/rotation (in seconds).
--servo Use a servo instead of a stepper motor
-o, --outputdir TEXT
-r, --rotation INTEGER angle (in degrees clockwise) of the camera from
horizontal ; will be rounded to the nearest multiple
of 90
예를 들어 20 년대 비디오를 만들고 처리 한 다음 /data/videos
에 저장하십시오.
revile video --length 20 --outputdir /data/videos
revile stream --help
Usage: revile stream [OPTIONS]
Uses the preview frames from a camera connected in USB mode to create the
image.
Options:
-f, --frames INTEGER The number of frames to capture (also ; the width of
the final image).
--stream-port INTEGER The /dev/video device to read from.
--servo Use a servo instead of a stepper motor
예를 들어 장치 /dev/video1
사용하여 500 프레임을 생성하고 처리합니다.
revile stream --frames 500 --stream-port 1
revile estimate --help
Usage: revile estimate [OPTIONS] DIAMETER
Estimate the optimum length of rotation in frames and seconds.
Options:
-l, --focal-length INTEGER Focal length in mm
-x, --frame-x INTEGER Size of the image/frame across the x axis of the
vial (i.e. width if shooting landscape, height
if portrait) in pixels
-s, --sensor-x INTEGER Size of the sensor across the x axis of the vial
(i.e. width if shooting landscape, height if
portrait) in mm
-w, --ppmm INTEGER Approximate width of 1mm, in pixels, at the
centre of rotation
-r, --fps INTEGER Stream/video framerate
예를 들어 100mm의 초점 길이, 프레임 너비는 720px의 프레임 너비, 센서 너비, 21px의 1mm 너비, 60fps의 프레임 속도 : 20mm 바이알의 경우 :
revile estimate -l 100 -x 720 -s 24 -w 21 -r 60 20
Try 23.6 seconds or 1419 frames:
revile video --length 23.6
revile stream --frames 1419
비디오 파일/스트림 처리에 대한 추가 요구 사항은 없습니다.
revile process --help
Usage: revile process [OPTIONS] FILEPATH
Options:
-r, --rotate INTEGER angle (in degrees clockwise) of the image from
horizontal ; will be rounded to the nearest multiple of
90
-o, --outputdir TEXT A directory to save the files to
예를 들어 examplevideo.mov
처리하고 초상화 방향으로 촬영하고 /data/revile/
에 대한 출력
revile process examplevideo.mov -r 270 -o /data/revile