|< 100% min:1000px 50% 50%>| ^ Dokuwiki/GeSHi ^ Doxycode ^ | The following example shows some C code from our custom library. Unfortunately the doxygen instance is not publicly available. || | #include "canopen_dictionary.h" /** * @brief Intialize the configuration and check that no error is in the OD. * */ void test_demo_init() { CANopenDictionary_enum_errors error = CANOPEN_DICTIONARY_LIB_ERROR_NONE; size_t length = sizeof(dictionary_storage)/sizeof(dictionary_storage[0]); error = canopen_dictionary_init(&col_conf,dictionary_storage,length); if(error != CANOPEN_DICTIONARY_LIB_ERROR_NONE) { // error handling TEST_FAIL_MESSAGE("library could not be initialized!"); } error = canopen_dictionary_registerCallbackFind(&col_conf,CANOPEN_IDX_LOW_NUMBER_001,CANOPEN_SUBIDX_LOW_NUMBER_001,&write_callback); TEST_ASSERT_MESSAGE(error==CANOPEN_DICTIONARY_LIB_ERROR_NONE,"the callback could not be registered"); } | #include "canopen_dictionary.h" /** * @brief Intialize the configuration and check that no error is in the OD. * */ void test_demo_init() { CANopenDictionary_enum_errors error = CANOPEN_DICTIONARY_LIB_ERROR_NONE; size_t length = sizeof(dictionary_storage)/sizeof(dictionary_storage[0]); error = canopen_dictionary_init(&col_conf,dictionary_storage,length); if(error != CANOPEN_DICTIONARY_LIB_ERROR_NONE) { // error handling TEST_FAIL_MESSAGE("library could not be initialized!"); } error = canopen_dictionary_registerCallbackFind(&col_conf,CANOPEN_IDX_LOW_NUMBER_001,CANOPEN_SUBIDX_LOW_NUMBER_001,&write_callback); TEST_ASSERT_MESSAGE(error==CANOPEN_DICTIONARY_LIB_ERROR_NONE,"the callback could not be registered"); } | | Here the same example - but with linenumbers enabled. The doxycode code snippet uses the same XML cache file as the example above. || | #include "canopen_dictionary.h" /** * @brief Intialize the configuration and check that no error is in the OD. * */ void test_demo_init() { CANopenDictionary_enum_errors error = CANOPEN_DICTIONARY_LIB_ERROR_NONE; size_t length = sizeof(dictionary_storage)/sizeof(dictionary_storage[0]); error = canopen_dictionary_init(&col_conf,dictionary_storage,length); if(error != CANOPEN_DICTIONARY_LIB_ERROR_NONE) { // error handling TEST_FAIL_MESSAGE("library could not be initialized!"); } error = canopen_dictionary_registerCallbackFind(&col_conf,CANOPEN_IDX_LOW_NUMBER_001,CANOPEN_SUBIDX_LOW_NUMBER_001,&write_callback); TEST_ASSERT_MESSAGE(error==CANOPEN_DICTIONARY_LIB_ERROR_NONE,"the callback could not be registered"); } | #include "canopen_dictionary.h" /** * @brief Intialize the configuration and check that no error is in the OD. * */ void test_demo_init() { CANopenDictionary_enum_errors error = CANOPEN_DICTIONARY_LIB_ERROR_NONE; size_t length = sizeof(dictionary_storage)/sizeof(dictionary_storage[0]); error = canopen_dictionary_init(&col_conf,dictionary_storage,length); if(error != CANOPEN_DICTIONARY_LIB_ERROR_NONE) { // error handling TEST_FAIL_MESSAGE("library could not be initialized!"); } error = canopen_dictionary_registerCallbackFind(&col_conf,CANOPEN_IDX_LOW_NUMBER_001,CANOPEN_SUBIDX_LOW_NUMBER_001,&write_callback); TEST_ASSERT_MESSAGE(error==CANOPEN_DICTIONARY_LIB_ERROR_NONE,"the callback could not be registered"); } | | The following example is taken from [[https://docs.opencv.org/4.x/d5/dae/tutorial_aruco_detection.html]]. \\ The tag file from [[https://docs.opencv.org/4.8.0/opencv.tag]] is used for referencing the documentation. \\ Building the snippet through the task runner is enabled globally for the tag file. || | #include cv::VideoCapture inputVideo; inputVideo.open(0); cv::aruco::DetectorParameters detectorParams = cv::aruco::DetectorParameters(); cv::aruco::Dictionary dictionary = cv::aruco::getPredefinedDictionary(cv::aruco::DICT_6X6_250); cv::aruco::ArucoDetector detector(dictionary, detectorParams); while (inputVideo.grab()) { cv::Mat image, imageCopy; inputVideo.retrieve(image); image.copyTo(imageCopy); std::vector ids; std::vector> corners, rejected; detector.detectMarkers(image, corners, ids, rejected); // if at least one marker detected if (ids.size() > 0) cv::aruco::drawDetectedMarkers(imageCopy, corners, ids); cv::imshow("out", imageCopy); char key = (char) cv::waitKey(waitTime); if (key == 27) break; } | #include cv::VideoCapture inputVideo; inputVideo.open(0); cv::aruco::DetectorParameters detectorParams = cv::aruco::DetectorParameters(); cv::aruco::Dictionary dictionary = cv::aruco::getPredefinedDictionary(cv::aruco::DICT_6X6_250); cv::aruco::ArucoDetector detector(dictionary, detectorParams); while (inputVideo.grab()) { cv::Mat image, imageCopy; inputVideo.retrieve(image); image.copyTo(imageCopy); std::vector ids; std::vector> corners, rejected; detector.detectMarkers(image, corners, ids, rejected); // if at least one marker detected if (ids.size() > 0) cv::aruco::drawDetectedMarkers(imageCopy, corners, ids); cv::imshow("out", imageCopy); char key = (char) cv::waitKey(waitTime); if (key == 27) break; } |