xref: /Universal-ctags/Units/parser-cxx.r/bug-github-1781.cpp.d/input.cpp (revision 046f6c50ebdc16b1e8d5432eeaba13da84086424)
1 // Bug reported by reidakdumont on 2018/07/05
2 
copyMatrix(const::cv::Mat source_p,LaGenMatDouble * destination_p_p)3 void copyMatrix(const ::cv::Mat source_p, LaGenMatDouble *destination_p_p)
4 {
5     if (destination_p_p->rows() != source_p.rows || destination_p_p->cols() != source_p.cols)
6         *destination_p_p = LaGenMatDouble(source_p.rows, source_p.cols);
7     for (int i_l = 0; i_l < source_p.rows; ++i_l)
8     {
9         for (int j_l = 0; j_l < source_p.cols; ++j_l)
10         {
11             if (source_p.type() == CV_32F)
12                 (*destination_p_p)(i_l,j_l) = source_p.at<float>(i_l,j_l);
13             else if (source_p.type() == CV_64F)
14                 (*destination_p_p)(i_l,j_l) = source_p.at<double>(i_l,j_l);
15         }
16     }
17 }
18 
copyMatrix(const LaGenMatDouble source_p,::cv::Mat * destination_p_p)19 void copyMatrix(const LaGenMatDouble source_p, ::cv::Mat *destination_p_p)
20 {
21     if (destination_p_p->rows != source_p.rows() || destination_p_p->cols != source_p.cols())
22         *destination_p_p = ::cv::Mat(source_p.rows(), source_p.cols(), CV_64F);
23     for (int i_l = 0; i_l < source_p.rows(); ++i_l)
24     {
25         for (int j_l = 0; j_l < source_p.cols(); ++j_l)
26         {
27             if (destination_p_p->type() == CV_32F)
28                 destination_p_p->at<float>(i_l,j_l) = (source_p)(i_l,j_l);
29             else if (destination_p_p->type() == CV_64F)
30                 destination_p_p->at<double>(i_l,j_l) = (source_p)(i_l,j_l);
31         }
32     }
33 }