In the meantime, I calculated the transformation matrix outside of bonsai to go ahead and use the result to transform points.
Ultimately, this would be OK because I expect I will have to calibrate only once per day or so and then I can save the transformation for use in bonsai.
Next, I want to transform (x,y) points according to this matrix (not an image).
Outside of bonsai, I can use the following python code:
h, status = cv2.findHomography(src, dst)
src_transformed=cv2.perspectiveTransform(np.array([src.astype('float32')]), h)[0]
this results in 'corrected' src coordinates.
In bonsai, I am again stuck figuring out the appropriate data types:
in a python node, I tried the following
clr.AddReference("OpenCV.Net")
from OpenCV.Net import *
values = Array[float]([ 9.48648092e-01, 1.53330831e-02, 1.97974600e+01,
-2.32614180e-02, 9.52525799e-01, 5.03506020e+01,
-6.44805411e-06, 6.25636499e-06, 1.00000000e+00])
h = Mat.FromArray(values, 3, 3, Depth.F32, 1)
values = Array[float]([207,243])
point = Mat.FromArray(values, 3, 3, Depth.F32, 1)
out = point
CV.PerspectiveTransform(point,out,h)
This fails, because PerspectiveTransform expects 'vec' and 'out' to be of data type 'Arr' and I can't figure out how to generate that type.