summaryrefslogtreecommitdiffstats
path: root/virtual-programs/camera.folk
diff options
context:
space:
mode:
authorOmar Rizwan <omar@omar.website>2023-06-30 18:11:12 +0000
committerGitHub <noreply@github.com>2023-06-30 18:11:12 +0000
commit8a8a749eb2afbf6b0636c280554c32219fff1dd2 (patch)
treea4fca4989a76d0e17c2d17ffe8ad1ad349111df2 /virtual-programs/camera.folk
parentLeft-align labels, watch for .folk.temp files (diff)
parentFix load librt to work on folk0 also (diff)
downloadfolk-8a8a749eb2afbf6b0636c280554c32219fff1dd2.tar.gz
folk-8a8a749eb2afbf6b0636c280554c32219fff1dd2.zip
Merge pull request #42 from FolkComputer/osnr/camera-pipeline
Run Camera in subprocess
Diffstat (limited to 'virtual-programs/camera.folk')
-rw-r--r--virtual-programs/camera.folk37
1 files changed, 37 insertions, 0 deletions
diff --git a/virtual-programs/camera.folk b/virtual-programs/camera.folk
new file mode 100644
index 00000000..b865392e
--- /dev/null
+++ b/virtual-programs/camera.folk
@@ -0,0 +1,37 @@
+if {$::isLaptop} return
+
+namespace eval ::Camera {
+ variable WIDTH 1280
+ variable HEIGHT 720
+}
+
+On process {
+ source pi/Camera.tcl
+ source pi/AprilTags.tcl
+ Camera::init 1280 720
+ AprilTags::init
+
+ puts "Camera tid: [getTid]"
+
+ while true {
+ set cameraTime [time {
+ set grayFrame [Camera::grayFrame]
+ }]
+ set aprilTime [time {
+ set tags [AprilTags::detect $grayFrame]
+ }]
+
+ Commit {
+ Claim the camera frame is $grayFrame
+
+ Claim the camera time is $cameraTime
+ Claim the AprilTag time is $aprilTime
+
+ foreach tag $tags {
+ Claim tag [dict get $tag id] has center [dict get $tag center] size [dict get $tag size]
+ Claim tag [dict get $tag id] has corners [dict get $tag corners]
+ }
+ }
+ Step
+ }
+}