Could anyone explain this optical probing concept? We don't have Digital 
Machinist here, but if it is what I imagine (basically a magnifying 
camera setup with crosshairs to align on an edge), it is fairly easily 
accomplished. Over here, we've just used an industrial camera connected 
to a cheap v4l-compatible framegrabber card. This can then be used 
through a program like tvtime (in synaptic). For the crosshairs, I 
couldn't find any software to superimpose them on a camera image. 
Instead, I've just used a solid red toplevel window in tcl/tk, which is 
then shaped like a crosshair. Code can be found at the tcl/tl wiki 
(http://wiki.tcl.tk/13409). The code I've used is this:

<<< Start crosshairs.tcl >>>

#!/usr/bin/wish
package require Tk
wm withdraw .
load wmx.so
#package require Img

wm title . "Crosshairs"

set bgimg [image create photo -file [file join shape.gif]]
#label .l -bd 0 -bg maroon -image $bgimg
set iwid [image width $bgimg]
set ihei [image height $bgimg]
. config -width $iwid -height $ihei
. configure -bg green

button .b -text quit -command exit
text .t -width 40 -height 5
button .b1 -text script -command {show lib app-wmx wmx.tcl}
#place .l -x 0 -y 0 -anchor nw

bind . <1> {
    set x [expr [winfo rootx .]-%X]
    set y [expr [winfo rooty .]-%Y]
}

bind . <B1-Motion> {
     wm geometry . +[expr %X+$x]+[expr %Y+$y]
}

bind all <Control-c> exit
wm geometry . 1x1
wm deiconify .
# IMPORTANT: we must do an "update idle" to let the window manager
# reparent our toplevel before issuing the setXwinshape command.
update idle
wm geometry . ${iwid}x$ihei+600+100
setXwinshape . $bgimg

<<< End crosshairs.tcl >>>



In this code, the transparent parts of the image shape.gif are 'cut out' 
from the window, thus leaving the desired shape. This way of generating 
crosshairs and the like prevents flicker and uses a very low overhead, 
as everything required is already included in X. It should even be 
possible to change the shape of the image on the fly, so perhaps this 
could be used to add readouts etc. to the overlay image.

Good luck,

Marc.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to