Skip to content

Commit

Permalink
perf: disable webp, because save it use too much time
Browse files Browse the repository at this point in the history
  • Loading branch information
rise0chen committed Jul 30, 2024
1 parent 3cef3ab commit 61d003b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion apriltag/bin/src/apriltag.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def main():
tag_size = float(tag_size)

at_detector = apriltag.Detector(families=tag_family)
img = cv2.imread(os.path.join(images_dir, "img.webp"), cv2.IMREAD_GRAYSCALE)
img = cv2.imread(os.path.join(images_dir, "img.jpg"), cv2.IMREAD_GRAYSCALE)
img = cv2.undistort(img, np.array(camera_matrix), np.array(dist_coeffs))
#_, img = cv2.threshold(img, 128, 255, cv2.THRESH_BINARY)
if img.size == 0:
Expand Down
4 changes: 2 additions & 2 deletions camera/bin/src/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ def main():
frame = cv2.GaussianBlur(frame, (5, 5), 0)
cv2.imwrite(os.path.join(images_dir, "img.tmp.jpg"), frame, [cv2.IMWRITE_JPEG_QUALITY, 50])
shutil.move(os.path.join(images_dir, "img.tmp.jpg"), os.path.join(images_dir, "img.jpg"))
cv2.imwrite(os.path.join(images_dir, "img.tmp.webp"), frame, [cv2.IMWRITE_WEBP_QUALITY, 50])
shutil.move(os.path.join(images_dir, "img.tmp.webp"), os.path.join(images_dir, "img.webp"))
# cv2.imwrite(os.path.join(images_dir, "img.tmp.webp"), frame, [cv2.IMWRITE_WEBP_QUALITY, 50])
# shutil.move(os.path.join(images_dir, "img.tmp.webp"), os.path.join(images_dir, "img.webp"))
if cmd == "reinit":
cap.release()
cap = init_camera()
Expand Down
4 changes: 2 additions & 2 deletions camera/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<button onclick="save()">save</button>
<button onclick="get()">refresh</button>
<br>
<img src="../images/img.webp" id="pic">
<img src="../images/img.jpg" id="pic">
</body>

<script>
Expand Down Expand Up @@ -114,7 +114,7 @@
"value": "shoot"
};
ws.send(JSON.stringify(rpc_data));
document.getElementById("pic").src = "../images/img.webp?" + Date.now();
document.getElementById("pic").src = "../images/img.jpg?" + Date.now();
}
setInterval(() => {
shoot();
Expand Down
4 changes: 2 additions & 2 deletions camera_calibrater/bin/src/camera_calibrater.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def main():
continue
if cmd == "preview":
shoot_img()
img = cv2.imread(os.path.join(images_dir, "img.webp"))
img = cv2.imread(os.path.join(images_dir, "img.jpg"))
if img.size == 0:
lebai.set_item("plugin_camera_calibrater_cmd_preview", "")
continue
Expand All @@ -106,7 +106,7 @@ def main():
lebai_real = lebai_sdk.connect(get_ip(), False)
i = get_i()+1
lebai.set_item("plugin_camera_calibrater_i", str(i))
shutil.copy(os.path.join(images_dir, "img.webp"), os.path.join(images_dir, "camera_calibrater.{}.webp".format(i)))
shutil.copy(os.path.join(images_dir, "img.jpg"), os.path.join(images_dir, "camera_calibrater.{}.webp".format(i)))
pose = (lebai_real.get_kin_data())["actual_flange_pose"]
lebai.set_item("plugin_camera_calibrater_pose_{}".format(i), json.dumps(pose))
if cmd == "clear":
Expand Down

0 comments on commit 61d003b

Please sign in to comment.