Handling of 3d points for every image's pixel
Hi All,
I'm having a hard time to understand how OpenCV handles matrices of 3d vectors. What I have is a grayscale image and additional 3 floating point images with the same size. The float images represent the x,y,z coordinates of each point in the grayscale image. I want to perform angle calculations on these, e.g. the cosine between each pixel location's vector with the normal (0,0,1).
E.g., when filename_0 contains the x coordinate of the vector for every pixel, filename_1 the y-coordinate, filename_2 the z-coordinate, my code looks like this:
std::vector<cv::Mat> inc;
inc.push_back(imread( inc.push_back(imread_geo( argv[1]+string("_0"), CV_32FC1 ));
inc.push_back(imread( inc.push_back(imread_geo( argv[1]+string("_1"), CV_32FC1 ));
inc.push_back(imread( inc.push_back(imread_geo( argv[1]+string("_2"), CV_32FC1 ));
Mat3f mat_inc;
cv::merge(inc,mat_inc);
What I do is to create a std::vector<cv::mat> matrix and convert it to a 3-channel 2D matrix using cv:merge. But how to use functions for angle calculations on mat_inc?
EDIT: The imread_geo function is adapted from this example: https://docs.opencv.org/3.0-beta/doc/tutorials/highgui/raster-gdal/raster_io_gdal.html
Loading the images using cv:imread and cv::IMREAD_LOAD_GDAL did not work with my file types (but should not matter here).
Background: the vectors are the Sun direction (incidence angle) for every pixel and I want to calculate the cosine of the incidence angle in the simplest case.
Any help is greatly appreciated!
Eicoo