revile
1.0.0
这是一个简单的示例软件包,用于使用推出摄影或缝隙扫描的主体来生成圆柱体表面的2D图像。
该软件包具有两个主要功能:捕获新视频和处理视频流。它也可以以两种形式使用:作为命令行接口(CLI)或python软件包。 CLI脚本显示了如何在您自己的Python脚本中使用它的示例。
该代码仅经过测试并确认可以在Linux OS上使用,但可能对其他OS起作用。
使用PIP安装:
pip install git+git://github.com/NaturalHistoryMuseum/revile.git#egg=revile
相机需要从A /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,传感器宽度为24mm,宽度为21px的1mm宽度和60fps的Framerate,适用于20mm VIAL:
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