Hi there,
I`m trying to align two point clouds from kinect 4 azure.
I`m running charuco_detection on the color cameras
i`m able to build board pose matrix in camera space.
“Final 4x4 transform”
So far i`m failing in using this data to align the two cameras.
Given camera A and B
( one of my attempts )
On Camera B point cloud
(CameraA transofrm) * inverse(CameraB transofrm) * PCL
uniform mat4 cam01_transform;
uniform mat4 cam00_transform;
uniform mat4 cv2gl;
out vec4 fragColor;
void main()
{
vec4 color = texture(sTD2DInputs[0], vUV.st);color = cam00_transform * inverse(cam01_transform) * color;
fragColor = TDOutputSwizzle(vec4(color.rgb,1.0));
}
Any tips and hints are welcome.
project file :
Output:
/////// Get and Calculate camera transform //////////////////
Found 4 k4a connected devices:Current device serial number and ID
Serial: 000137392012
ID: 3Camera 3x3 matrix (focal and principal)
[1943.6014, 0, 2042.2634;
0, 1943.634, 1558.2002;
0, 0, 1]Distortion coefficients
[0.56407541;
-2.8563795;
0.00034544262;
9.3485214e-06;
1.7019695;
0.44322005;
-2.6765807;
1.6240268]Number of markerCorners coordinates: 17
translate (tvec) vector generated from estimatePoseCharucoBoard
[-0.321135, 0.023058, 1.421785]rotation (rvec) vector generated from estimatePoseCharucoBoard
[-1.629482, -2.033616, 0.512786]Rodrigues rotation matrix output + transpose
[-0.1750317663359425, 0.9753690835116966, 0.1342349868807432;
0.7951029246634684, 0.2204397962637846, -0.5649934826303578;
-0.5806679085027165, 0.007838823427953889, -0.8141027778372619]transform cv 2 Opengl
[1, 0, 0, 0;
0, -1, 0, 0;
0, 0, -1, 0;
0, 0, 0, 1]Final 4x4 transform from Opencv (3x3 transposed Rodrigues matrix + tvec)
[-0.1750317663359425, 0.9753690835116966, 0.1342349868807432, -0.3211353392539955;
0.7951029246634684, 0.2204397962637846, -0.5649934826303578, 0.02305835302761156;
-0.5806679085027165, 0.007838823427953889, -0.8141027778372619, 1.421785033369236;
0, 0, 0, 1]CV to Opengl matrix * transform4x4 (optional)
[-0.1750317663359425, 0.9753690835116966, 0.1342349868807432, -0.3211353392539955;
-0.7951029246634684, -0.2204397962637846, 0.5649934826303578, -0.02305835302761156;
0.5806679085027165, -0.007838823427953889, 0.8141027778372619, -1.421785033369236;
0, 0, 0, 1]/////// Get and Calculate camera transform //////////////////
Found 4 k4a connected devices:Current device serial number and ID
Serial: 000071692012
ID: 1Camera 3x3 matrix (focal and principal)
[1940.4982, 0, 2043.9741;
0, 1940.4558, 1572.3068;
0, 0, 1]Distortion coefficients
[0.44659063;
-2.823009;
0.00058650092;
9.9364013e-05;
1.7742159;
0.32623905;
-2.6353929;
1.6881952]Number of markerCorners coordinates: 17
translate (tvec) vector generated from estimatePoseCharucoBoard
[-0.259144, -0.038194, 1.264992]rotation (rvec) vector generated from estimatePoseCharucoBoard
[2.358736, 1.123323, 1.093566]Rodrigues rotation matrix output + transpose
[0.4017498951636057, 0.7625208839299694, 0.5071083940408503;
0.527392747049635, -0.6453658146018424, 0.5525937528625711;
0.7486346986985521, 0.04544080670453149, -0.6614236320170073]transform cv 2 Opengl
[1, 0, 0, 0;
0, -1, 0, 0;
0, 0, -1, 0;
0, 0, 0, 1]Final 4x4 transform from Opencv (3x3 transposed Rodrigues matrix + tvec)
[0.4017498951636057, 0.7625208839299694, 0.5071083940408503, -0.2591442373942539;
0.527392747049635, -0.6453658146018424, 0.5525937528625711, -0.03819378849616589;
0.7486346986985521, 0.04544080670453149, -0.6614236320170073, 1.264991775861966;
0, 0, 0, 1]CV to Opengl matrix * transform4x4 (optional)
[0.4017498951636057, 0.7625208839299694, 0.5071083940408503, -0.2591442373942539;
-0.527392747049635, 0.6453658146018424, -0.5525937528625711, 0.03819378849616589;
-0.7486346986985521, -0.04544080670453149, 0.6614236320170073, -1.264991775861966;
0, 0, 0, 1]