From d715fa296f96b3f21edbc53dbac5786d2754f5e7 Mon Sep 17 00:00:00 2001 From: Omar Rizwan Date: Thu, 17 Nov 2022 21:18:08 -0500 Subject: Start working on image folk file --- virtual-programs/image.folk | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 virtual-programs/image.folk (limited to 'virtual-programs') diff --git a/virtual-programs/image.folk b/virtual-programs/image.folk new file mode 100644 index 00000000..7aff5305 --- /dev/null +++ b/virtual-programs/image.folk @@ -0,0 +1,25 @@ +Wish $this has filename "image.folk" + +namespace eval ::image { + proc width {im} { dict get $im width } + proc height {im} { dict get $im height } + proc subimage {im x y subwidth subheight} { + dict with im { + set subdata [expr {$data + ($y * $width + $x) * $components}] + dict create \ + width $subwidth height $subheight \ + components $components \ + bytesPerRow $bytesPerRow \ + data [format 0x%x $subdata] + } + } + namespace export * + namespace ensemble create +} + +When the camera frame is /f/ { + When $this has region /r/ { + # Wish $this is labelled [regionToBbox $r] + } + Wish $this is labelled "$f\n[image subimage $f 0 0 100 100]" +} \ No newline at end of file -- cgit v1.2.3