|
|
@ -62,24 +62,22 @@ class Photography(Bureau):
|
|
|
|
#cmd1 = "uvccapture -d/dev/video1 -x320 -y240 -o /dev/null"
|
|
|
|
#cmd1 = "uvccapture -d/dev/video1 -x320 -y240 -o /dev/null"
|
|
|
|
#cmd2 = "/usr/local/bin/uvccapture -m -x3264 -y2448 -o" + tmpimg.name
|
|
|
|
#cmd2 = "/usr/local/bin/uvccapture -m -x3264 -y2448 -o" + tmpimg.name
|
|
|
|
#subprocess.check_output(cmd1.split())
|
|
|
|
#subprocess.check_output(cmd1.split())
|
|
|
|
print(os.getcwd())
|
|
|
|
|
|
|
|
modpath = os.path.dirname(__file__)
|
|
|
|
modpath = os.path.dirname(__file__)
|
|
|
|
mjpg = os.path.join(modpath, "..", "..", "lib", "mjpg-streamer",
|
|
|
|
mjpg = os.path.join(modpath, "..", "..", "lib", "mjpg-streamer",
|
|
|
|
"mjpg-streamer-experimental", "mjpg_streamer")
|
|
|
|
"mjpg-streamer-experimental", "mjpg_streamer")
|
|
|
|
mjpg_dir = os.path.dirname(mjpg)
|
|
|
|
mjpg_dir = os.path.dirname(mjpg)
|
|
|
|
cmd = mjpg.split() + ["-i", "'input_uvc.so -r 3264x2448 -n'", "-o", "'output_file.so -f /tmp/webcam -d 500 -s 1'"]
|
|
|
|
cmd = mjpg.split() + ["-i", "'input_uvc.so -r 3264x2448 -n'", "-o", "'output_file.so -f /tmp/webcam -d 500 -s 1'"]
|
|
|
|
|
|
|
|
|
|
|
|
print(cmd)
|
|
|
|
|
|
|
|
proc = subprocess.Popen(cmd, shell=True, env={"LD_LIBRARY_PATH": mjpg_dir})
|
|
|
|
proc = subprocess.Popen(cmd, shell=True, env={"LD_LIBRARY_PATH": mjpg_dir})
|
|
|
|
|
|
|
|
time.sleep(2)
|
|
|
|
|
|
|
|
proc.terminate()
|
|
|
|
|
|
|
|
time.sleep(1)
|
|
|
|
|
|
|
|
|
|
|
|
# copy last image to the tmpfile
|
|
|
|
# copy last image to the tmpfile
|
|
|
|
filelist = os.listdir()
|
|
|
|
filelist = os.listdir()
|
|
|
|
newest = max(filelist, key=lambda x: os.stat(x).st_mtime)
|
|
|
|
newest = max(filelist, key=lambda x: os.stat(x).st_mtime)
|
|
|
|
shutil.copyfile(newest, tmpimg.name)
|
|
|
|
shutil.copyfile(newest, tmpimg.name)
|
|
|
|
|
|
|
|
|
|
|
|
time.sleep(2)
|
|
|
|
|
|
|
|
proc.terminate()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self._doc_light_off()
|
|
|
|
self._doc_light_off()
|
|
|
|
return {"photo": tmpimg.name}
|
|
|
|
return {"photo": tmpimg.name}
|
|
|
|
|
|
|
|
|
|
|
|