#include typedef unsigned char uchar; namespace cv { struct Mat { int depth() const { return 0; } }; } class PaintByLevelAlgorithm { public: void execute(const cv::Mat* input, cv::Mat* dst); template <typename T> void executeC1(const cv::Mat* input, cv::Mat* dst); }; void PaintByLevelAlgorithm::execute(const cv::Mat* input, cv::Mat* dst) { switch ((*input).depth()) { case /*CV_8U*/ 1: executeC1(input, dst); break; case /*CV_32S*/ 2: executeC1(input, dst); break; default : std::cout << "default" << std::endl; } } template <typename T> void PaintByLevelAlgorithm::executeC1(const cv::Mat*, cv::Mat*) { std::cout << "ok" << std::endl; } int main() { cv::Mat a; cv::Mat b; PaintByLevelAlgorithm algo; algo.execute(&a, &b); return 0; }
error: prototype for ‘void PaintByLevelAlgorithm::executeC1(const cv::Mat*, cv::Mat*)’ does not match any in class ‘PaintByLevelAlgorithm’
void PaintByLevelAlgorithm::execute(const cv::Mat *input, cv::Mat *dst) { // Parse by type switch ((*input).depth()) { case CV_8U : PaintByLevelAlgorithm::executeC1(input, dst); break; case CV_32S : PaintByLevelAlgorithm::executeC1(input, dst); break; default : std::cout << "default" << std::endl; } } template <typename T> void PaintByLevelAlgorithm::executeC1(const cv::Mat *input, cv::Mat *dst) { cv::Point point; int greyValue; for (point.x=0; point.x<(*input).size().width; point.x++) { for (point.y=0; point.y<(*input).size().height; point.y++) { if ((*input).at<T>(point) > 0) { greyValue = (*input).at<T>(point); line(*dst, point, point, cv::Scalar((50+greyValue*5)%255, 50+greyValue*51%255, 255-(greyValue*13%255)), 1, 8, 0); } } } }
src/paintByLevelAlgorithm.cpp: In static member function ‘static void PaintByLevelAlgorithm::execute(const cv::Mat*, cv::Mat*)’:
src/paintByLevelAlgorithm.cpp:10: error: expected primary-expression before ‘>’ token
PaintByLevelAlgorithm::executeC1(input, dst);
src/paintByLevelAlgorithm.cpp:14: error: expected primary-expression before ‘int’
src/paintByLevelAlgorithm.cpp:14: error: expected `;' before ‘int’
PaintByLevelAlgorithm::executeC1(input, dst);
src/paintByLevelAlgorithm.cpp: At global scope:
src/paintByLevelAlgorithm.cpp:23: error: prototype for ‘void PaintByLevelAlgorithm::executeC1(const cv::Mat*, cv::Mat*)’ does not match any in class ‘PaintByLevelAlgorithm’
src/paintByLevelAlgorithm.hpp:13: error: candidate is: static void PaintByLevelAlgorithm::executeC1(const cv::Mat*, cv::Mat*)
src/paintByLevelAlgorithm.cpp:23: error: template definition of non-template ‘void PaintByLevelAlgorithm::executeC1(const cv::Mat*, cv::Mat*)’
template <typename T> void PaintByLevelAlgorithm::executeC1(const cv::Mat *input, cv::Mat *dst)
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionT'as un tuto plutôt bien foutu?