Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
playground:doxycode [2024/01/06 23:22] lprobsth1playground:doxycode [2024/01/21 15:06] (current) – fix language lprobsth1
Line 1: Line 1:
-<doxycode tagfiles="canopen_dictionary_lib" test2.c>+|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. || 
 +| <file c test.c>
 #include "canopen_dictionary.h" #include "canopen_dictionary.h"
    
Line 22: Line 25:
     TEST_ASSERT_MESSAGE(error==CANOPEN_DICTIONARY_LIB_ERROR_NONE,"the callback could not be registered");     TEST_ASSERT_MESSAGE(error==CANOPEN_DICTIONARY_LIB_ERROR_NONE,"the callback could not be registered");
 } }
-</doxycode> +</file<doxycode tagfiles="canopen_dictionary_libtest.c
- +#include "canopen_dictionary.h" 
-<doxycode tagfiles="opencv4.8.0linenumbers opencv.cpp+  
-#include <opencv2/aruco.hpp> +  
-cv::VideoCapture inputVideo; +/** 
-inputVideo.open(0); + * @brief Intialize the configuration and check that no error is in the OD. 
-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); +void test_demo_init() { 
- +    CANopenDictionary_enum_errors error = CANOPEN_DICTIONARY_LIB_ERROR_NONE; 
-while (inputVideo.grab()) { +  
-    cv::Mat image, imageCopy+    size_t length = sizeof(dictionary_storage)/sizeof(dictionary_storage[0]); 
-    inputVideo.retrieve(image)+    error = canopen_dictionary_init(&col_conf,dictionary_storage,length); 
-    image.copyTo(imageCopy); +  
-    std::vector<int> ids; +    if(error != CANOPEN_DICTIONARY_LIB_ERROR_NONE{ 
-    std::vector<std::vector<cv::Point2f>> corners, rejected; +        // error handling 
-    detector.detectMarkers(imagecornersids, rejected); +        TEST_FAIL_MESSAGE("library could not be initialized!"); 
-    // if at least one marker detected +    
-    if (ids.size() > 0+  
-        cv::aruco::drawDetectedMarkers(imageCopy, corners, ids); +    error canopen_dictionary_registerCallbackFind(&col_conf,CANOPEN_IDX_LOW_NUMBER_001,CANOPEN_SUBIDX_LOW_NUMBER_001,&write_callback); 
-    cv::imshow("out", imageCopy); +  
-    char key = (char) cv::waitKey(waitTime); +    TEST_ASSERT_MESSAGE(error==CANOPEN_DICTIONARY_LIB_ERROR_NONE,"the callback could not be registered");
-    if (key == 27) +
-        break;+
 } }
-</doxycode> +</doxycode> | 
- +| Here the same example - but with linenumbers enabled. The doxycode code snippet uses the same XML cache file as the example above. || 
-<file c [enable_line_numbers="true"test.c>+<file c [enable_line_numbers="true"test2.c>
 #include "canopen_dictionary.h" #include "canopen_dictionary.h"
    
Line 72: Line 73:
     TEST_ASSERT_MESSAGE(error==CANOPEN_DICTIONARY_LIB_ERROR_NONE,"the callback could not be registered");     TEST_ASSERT_MESSAGE(error==CANOPEN_DICTIONARY_LIB_ERROR_NONE,"the callback could not be registered");
 } }
-</file> +</file> <doxycode tagfiles="canopen_dictionary_liblinenumbers test2.c>
- +
- +
-<code c [enable_line_numbers="true"]>+
 #include "canopen_dictionary.h" #include "canopen_dictionary.h"
    
Line 98: Line 96:
     TEST_ASSERT_MESSAGE(error==CANOPEN_DICTIONARY_LIB_ERROR_NONE,"the callback could not be registered");     TEST_ASSERT_MESSAGE(error==CANOPEN_DICTIONARY_LIB_ERROR_NONE,"the callback could not be registered");
 } }
-</code>+</doxycode>
 +| <WRAP> 
 +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. 
 +</WRAP> || 
 +| <code c> 
 +#include <opencv2/aruco.hpp> 
 +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<int> ids; 
 +    std::vector<std::vector<cv::Point2f>> 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; 
 +
 +</code> | <doxycode tagfiles="opencv4.8.0" language=cpp> 
 +#include <opencv2/aruco.hpp> 
 +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<int> ids; 
 +    std::vector<std::vector<cv::Point2f>> 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; 
 +
 +</doxycode|
  
QR Code
QR Code playground:doxycode (generated for current page)