Created
August 7, 2021 04:05
-
-
Save shimat/cacf19ffb2ec3d64c20909f7799c4e35 to your computer and use it in GitHub Desktop.
OpenCV 空のMatに対するMat.cloneではdepthがセットされない
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <opencv2/opencv.hpp> | |
int main() | |
{ | |
{ | |
cv::Mat src(0, 0, CV_32SC1); | |
auto dst = src.clone(); | |
std::cout << "Mat" << std::endl | |
<< "src: depth=" << src.depth() << ", channels=" << src.channels() << std::endl | |
<< "dst: depth=" << dst.depth() << ", channels=" << dst.channels() << std::endl; | |
} | |
{ | |
cv::Mat_<int> src(0, 0); | |
auto dst = src.clone(); | |
std::cout << "Mat_<T>" << std::endl | |
<< "src: depth=" << src.depth() << ", channels=" << src.channels() << std::endl | |
<< "dst: depth=" << dst.depth() << ", channels=" << dst.channels() << std::endl; | |
} | |
return 0; | |
} |
Author
shimat
commented
Aug 7, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment