นี่เป็นแพ็คเกจตัวอย่างง่ายๆสำหรับการสร้างภาพ 2D ของพื้นผิวทรงกระบอกโดยใช้หลักการของ การถ่ายภาพการเปิดตัว หรือ การสแกนร่อง
แพ็คเกจนี้มีสองฟังก์ชั่นหลัก: การจับ วิดีโอใหม่และ การประมวล ผลสตรีมวิดีโอ นอกจากนี้ยังสามารถใช้ในสองรูปแบบ: เป็นอินเตอร์เฟสบรรทัดคำสั่ง (CLI) หรือเป็นแพ็คเกจ Python สคริปต์ CLI แสดงตัวอย่างของวิธีการใช้ในสคริปต์ Python ของคุณเอง
รหัสได้รับการทดสอบและยืนยันว่าจะทำงานกับ Linux 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
เช่นในการสร้างและประมวลผลวิดีโอ 20s จากนั้นบันทึกใน /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
เช่นในการสร้างและประมวลผล 500 เฟรมโดยใช้อุปกรณ์ /dev/video1
:
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
เช่นที่ความยาวโฟกัส 100 มม. ความกว้างเฟรม 720px ความกว้างของเซ็นเซอร์ 24 มม. ความกว้าง 1 มม. 21px และเฟรมของ 60fps สำหรับขวด 20 มม.:
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