[vtkusers] Get pixel coordinates of a grid

jose beotegui jmbeotegui at yahoo.es
Fri Oct 4 07:10:09 EDT 2002


I'm working in an Augmented Reality interface (using
Tcl/Tk, VTK 4.0) and I want to 
calibrate the camera.
I've captured a BMP image of a grid and then I've used
a vtkImageThreshold (I'm working 
with two cases: a grid of black stripes over a white
background and a grid
of black circles over a white background too).
I'm trying to get the center pixel coords of every
element to convert
them to vtkPoints. 
I've used vtkImageSkeleton2D and I've obtained a cross
(or a 'X shaped figure'
of 1 pixel wide ) in every intersection of the grid
and I'd like to know if it's 
possible to get the coordinates of the intersection of
the two lines.


Here is the code:

package require vtk

vtkBMPReader imagen1
	imagen1 SetFileName "gridex.bmp"
	imagen1 Update

vtkImageThreshold thresholdd
	threshold SetInput [imagen1 GetOutput]
	threshold ThresholdByUpper  150
	threshold SetInValue 250
	threshold SetOutValue 50
	threshold ReleaseDataFlagOff

vtkImageContinuousErode3D erode
	erode ReleaseDataFlagOff
	erode SetInput [threshold GetOutput]
	erode SetKernelSize  6 6 3
	erode Update

vtkImageContinuousDilate3D dilate
	dilate ReleaseDataFlagOff
	dilate SetInput [erode GetOutput]
	dilate SetKernelSize 11 11 3
	dilate Update

vtkImageVariance3D var
	var SetInput [dilate GetOutput]
	var SetKernelSize 10 10 1

vtkImageSkeleton2D skeleton1
	skeleton1 SetInput [var GetOutput]
	skeleton1 SetPrune 1
	skeleton1 SetNumberOfIterations 10
	skeleton1 ReleaseDataFlagOff

Yahoo! Messenger
Nueva versión: Webcam, voz, y mucho más ¡Gratis! 
Descárgalo ya desde http://messenger.yahoo.es

More information about the vtkusers mailing list