put 3D world coordinates in 2D array
Question: I'm working with 3D image processing using OpenCV and Python.

I can make from two points in two images (left and right) a world coordinate
(X, Y, Z).

For my remainder of the program: It’s important to have a 2D array that
corresponds to the left (or right) image pixels.

He needs to recognize objects in a normal 2D image. When that is done giving
the x, y, z world coordinate of the founded object. This he does giving the
(x, y) of the image en with this (x, y) getting the x, y, z world coordinate.

My question is: Is there a special function for it or how can I do this?


Answer: If you want to use glm you can try this:

    
    
    glm::vec3 array[image_resolution_y][image_resolution_x];
    
    array[0][0][0] = x;
    array[0][0][1] = y;
    array[0][0][2] = z;
    

In Linux you can install glm with apt-get install libglm-dev

But of your course you can just create a point struct / class and use this.

    
    
    struct Point3D
    {
    float x;
    float y;
    float z;
    };
    
    Point3D array [image_resolution_y][image_resolution_x];
    array[0][0].x = x;
    array[0][0].y = y;
    array[0][0].z = z;
    

