OpenCV version 4.5.4
When a cv::Mat variable is created in a certain constructor, u, a member of cv::Mat, becomes NULL.
The following code is a simple example.
#include <opencv2/opencv.hpp>
#include <iostream>
int main() {
cv::Mat a = cv::Mat::zeros(3, 3, CV_8UC3);
cv::Mat b = cv::Mat(a.rows, a.cols, CV_8UC3, a.data);
std::cout << a << std::endl;
std::cout << b << std::endl;
std::cout << a.u << std::endl;
std::cout << b.u << std::endl;
return 0;
}
The results of this program are as follows.
[ 0, 0, 0, 0, 0, 0, 0, 0, 0;
0, 0, 0, 0, 0, 0, 0, 0, 0;
0, 0, 0, 0, 0, 0, 0, 0, 0]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0;
0, 0, 0, 0, 0, 0, 0, 0, 0;
0, 0, 0, 0, 0, 0, 0, 0, 0]
00000203AC74C3A0
0000000000000000
Is this a constructor bug?
Also, is there any problem with u being NULL?
Thanks.