From b525480b256f3c9390a2865ceaade35af245905a Mon Sep 17 00:00:00 2001 From: Trutnev Aleksei Date: Fri, 12 Nov 2021 17:17:21 +0300 Subject: [PATCH] Merge pull request #20857 from alexgiving:atrutnev/move_API_samples Move API sample code to tutorial_code location --- modules/gapi/doc/20-kernel-api.markdown | 12 ++++++------ modules/gapi/include/opencv2/gapi/garg.hpp | 8 ++++---- modules/gapi/include/opencv2/gapi/gcommon.hpp | 4 ++-- modules/gapi/include/opencv2/gapi/gcomputation.hpp | 8 ++++---- modules/gapi/include/opencv2/gapi/gkernel.hpp | 2 +- modules/gapi/include/opencv2/gapi/gproto.hpp | 2 +- modules/gapi/include/opencv2/gapi/gscalar.hpp | 2 +- modules/gapi/include/opencv2/gapi/gtyped.hpp | 4 ++-- modules/gapi/include/opencv2/gapi/s11n/base.hpp | 2 +- .../gapi/doc_snippets}/api_ref_snippets.cpp | 0 .../gapi/doc_snippets/dynamic_graph_snippets.cpp | 0 .../gapi/doc_snippets}/kernel_api_snippets.cpp | 0 12 files changed, 22 insertions(+), 22 deletions(-) rename {modules/gapi/samples => samples/cpp/tutorial_code/gapi/doc_snippets}/api_ref_snippets.cpp (100%) rename modules/gapi/samples/dynamic_graph.cpp => samples/cpp/tutorial_code/gapi/doc_snippets/dynamic_graph_snippets.cpp (100%) rename {modules/gapi/samples => samples/cpp/tutorial_code/gapi/doc_snippets}/kernel_api_snippets.cpp (100%) diff --git a/modules/gapi/doc/20-kernel-api.markdown b/modules/gapi/doc/20-kernel-api.markdown index 6ad882eda8..9a7cf39f67 100644 --- a/modules/gapi/doc/20-kernel-api.markdown +++ b/modules/gapi/doc/20-kernel-api.markdown @@ -47,7 +47,7 @@ an external parameter. G-API provides a macro to define a new kernel interface -- G_TYPED_KERNEL(): -@snippet modules/gapi/samples/kernel_api_snippets.cpp filter2d_api +@snippet samples/cpp/tutorial_code/gapi/doc_snippets/kernel_api_snippets.cpp filter2d_api This macro is a shortcut to a new type definition. It takes three arguments to register a new type, and requires type body to be present @@ -81,18 +81,18 @@ Once a kernel is defined, it can be used in pipelines with special, G-API-supplied method "::on()". This method has the same signature as defined in kernel, so this code: -@snippet modules/gapi/samples/kernel_api_snippets.cpp filter2d_on +@snippet samples/cpp/tutorial_code/gapi/doc_snippets/kernel_api_snippets.cpp filter2d_on is a perfectly legal construction. This example has some verbosity, though, so usually a kernel declaration comes with a C++ function wrapper ("factory method") which enables optional parameters, more compact syntax, Doxygen comments, etc: -@snippet modules/gapi/samples/kernel_api_snippets.cpp filter2d_wrap +@snippet samples/cpp/tutorial_code/gapi/doc_snippets/kernel_api_snippets.cpp filter2d_wrap so now it can be used like: -@snippet modules/gapi/samples/kernel_api_snippets.cpp filter2d_wrap_call +@snippet samples/cpp/tutorial_code/gapi/doc_snippets/kernel_api_snippets.cpp filter2d_wrap_call # Extra information {#gapi_kernel_supp_info} @@ -143,7 +143,7 @@ For example, the aforementioned `Filter2D` is implemented in "reference" CPU (OpenCV) plugin this way (*NOTE* -- this is a simplified form with improper border handling): -@snippet modules/gapi/samples/kernel_api_snippets.cpp filter2d_ocv +@snippet samples/cpp/tutorial_code/gapi/doc_snippets/kernel_api_snippets.cpp filter2d_ocv Note how CPU (OpenCV) plugin has transformed the original kernel signature: @@ -174,7 +174,7 @@ point extraction to an STL vector: A compound kernel _implementation_ can be defined using a generic macro GAPI_COMPOUND_KERNEL(): -@snippet modules/gapi/samples/kernel_api_snippets.cpp compound +@snippet samples/cpp/tutorial_code/gapi/doc_snippets/kernel_api_snippets.cpp compound diff --git a/modules/gapi/include/opencv2/gapi/garg.hpp b/modules/gapi/include/opencv2/gapi/garg.hpp index ee6ee81e1c..bfe147f8f0 100644 --- a/modules/gapi/include/opencv2/gapi/garg.hpp +++ b/modules/gapi/include/opencv2/gapi/garg.hpp @@ -171,7 +171,7 @@ using GRunArgs = std::vector; * It's an ordinary overload of addition assignment operator. * * Example of usage: - * @snippet modules/gapi/samples/dynamic_graph.cpp GRunArgs usage + * @snippet samples/cpp/tutorial_code/gapi/doc_snippets/dynamic_graph_snippets.cpp GRunArgs usage * */ inline GRunArgs& operator += (GRunArgs &lhs, const GRunArgs &rhs) @@ -223,7 +223,7 @@ using GRunArgsP = std::vector; * It's an ordinary overload of addition assignment operator. * * Example of usage: - * @snippet modules/gapi/samples/dynamic_graph.cpp GRunArgsP usage + * @snippet samples/cpp/tutorial_code/gapi/doc_snippets/dynamic_graph_snippets.cpp GRunArgsP usage * */ inline GRunArgsP& operator += (GRunArgsP &lhs, const GRunArgsP &rhs) @@ -247,7 +247,7 @@ namespace gapi * it needs to be wrapped by this function. * * Example of usage: - * @snippet modules/gapi/samples/api_ref_snippets.cpp bind after deserialization + * @snippet samples/cpp/tutorial_code/gapi/doc_snippets/api_ref_snippets.cpp bind after deserialization * * @param out_args deserialized GRunArgs. * @return the same GRunArgs wrapped in GRunArgsP. @@ -260,7 +260,7 @@ GAPI_EXPORTS cv::GRunArgsP bind(cv::GRunArgs &out_args); * which this function does. * * Example of usage: - * @snippet modules/gapi/samples/api_ref_snippets.cpp bind before serialization + * @snippet samples/cpp/tutorial_code/gapi/doc_snippets/api_ref_snippets.cpp bind before serialization * * @param out output GRunArgsP available during graph execution. * @return the same GRunArgsP wrapped in serializable GRunArgs. diff --git a/modules/gapi/include/opencv2/gapi/gcommon.hpp b/modules/gapi/include/opencv2/gapi/gcommon.hpp index d3c280816f..dfbd9e3a2a 100644 --- a/modules/gapi/include/opencv2/gapi/gcommon.hpp +++ b/modules/gapi/include/opencv2/gapi/gcommon.hpp @@ -134,12 +134,12 @@ namespace detail { * * For example, if an example computation is executed like this: * - * @snippet modules/gapi/samples/api_ref_snippets.cpp graph_decl_apply + * @snippet samples/cpp/tutorial_code/gapi/doc_snippets/api_ref_snippets.cpp graph_decl_apply * * Extra parameter specifying which kernels to compile with can be * passed like this: * - * @snippet modules/gapi/samples/api_ref_snippets.cpp apply_with_param + * @snippet samples/cpp/tutorial_code/gapi/doc_snippets/api_ref_snippets.cpp apply_with_param */ /** diff --git a/modules/gapi/include/opencv2/gapi/gcomputation.hpp b/modules/gapi/include/opencv2/gapi/gcomputation.hpp index 7e07a587e1..13944c7852 100644 --- a/modules/gapi/include/opencv2/gapi/gcomputation.hpp +++ b/modules/gapi/include/opencv2/gapi/gcomputation.hpp @@ -61,11 +61,11 @@ namespace s11n { * executed. The below example expresses calculation of Sobel operator * for edge detection (\f$G = \sqrt{G_x^2 + G_y^2}\f$): * - * @snippet modules/gapi/samples/api_ref_snippets.cpp graph_def + * @snippet samples/cpp/tutorial_code/gapi/doc_snippets/api_ref_snippets.cpp graph_def * * Full pipeline can be now captured with this object declaration: * - * @snippet modules/gapi/samples/api_ref_snippets.cpp graph_cap_full + * @snippet samples/cpp/tutorial_code/gapi/doc_snippets/api_ref_snippets.cpp graph_cap_full * * Input/output data objects on which a call graph should be * reconstructed are passed using special wrappers cv::GIn and @@ -78,7 +78,7 @@ namespace s11n { * expects that image gradients are already pre-calculated may be * defined like this: * - * @snippet modules/gapi/samples/api_ref_snippets.cpp graph_cap_sub + * @snippet samples/cpp/tutorial_code/gapi/doc_snippets/api_ref_snippets.cpp graph_cap_sub * * The resulting graph would expect two inputs and produce one * output. In this case, it doesn't matter if gx/gy data objects are @@ -130,7 +130,7 @@ public: * Graph can be defined in-place directly at the moment of its * construction with a lambda: * - * @snippet modules/gapi/samples/api_ref_snippets.cpp graph_gen + * @snippet samples/cpp/tutorial_code/gapi/doc_snippets/api_ref_snippets.cpp graph_gen * * This may be useful since all temporary objects (cv::GMats) and * namespaces can be localized to scope of lambda, without diff --git a/modules/gapi/include/opencv2/gapi/gkernel.hpp b/modules/gapi/include/opencv2/gapi/gkernel.hpp index ca942495ab..4d3fbd82c5 100644 --- a/modules/gapi/include/opencv2/gapi/gkernel.hpp +++ b/modules/gapi/include/opencv2/gapi/gkernel.hpp @@ -659,7 +659,7 @@ namespace gapi { * Use this function to pass kernel implementations (defined in * either way) and transformations to the system. Example: * - * @snippet modules/gapi/samples/api_ref_snippets.cpp kernels_snippet + * @snippet samples/cpp/tutorial_code/gapi/doc_snippets/api_ref_snippets.cpp kernels_snippet * * Note that kernels() itself is a function returning object, not * a type, so having `()` at the end is important -- it must be a diff --git a/modules/gapi/include/opencv2/gapi/gproto.hpp b/modules/gapi/include/opencv2/gapi/gproto.hpp index 6271e470b0..a2b5d83bc1 100644 --- a/modules/gapi/include/opencv2/gapi/gproto.hpp +++ b/modules/gapi/include/opencv2/gapi/gproto.hpp @@ -71,7 +71,7 @@ public: * It's an ordinary overload of addition assignment operator. * * Example of usage: - * @snippet modules/gapi/samples/dynamic_graph.cpp GIOProtoArgs usage + * @snippet samples/cpp/tutorial_code/gapi/doc_snippets/dynamic_graph_snippets.cpp GIOProtoArgs usage * */ template diff --git a/modules/gapi/include/opencv2/gapi/gscalar.hpp b/modules/gapi/include/opencv2/gapi/gscalar.hpp index c6edc33b75..7ebededcf0 100644 --- a/modules/gapi/include/opencv2/gapi/gscalar.hpp +++ b/modules/gapi/include/opencv2/gapi/gscalar.hpp @@ -88,7 +88,7 @@ public: * This constructor overload is not marked `explicit` and can be * used in G-API expression code like this: * - * @snippet modules/gapi/samples/api_ref_snippets.cpp gscalar_implicit + * @snippet samples/cpp/tutorial_code/gapi/doc_snippets/api_ref_snippets.cpp gscalar_implicit * * Here operator+(GMat,GScalar) is used to wrap cv::gapi::addC() * and a value-initialized GScalar is created on the fly. diff --git a/modules/gapi/include/opencv2/gapi/gtyped.hpp b/modules/gapi/include/opencv2/gapi/gtyped.hpp index 6fe52a62e1..c1c16d1767 100644 --- a/modules/gapi/include/opencv2/gapi/gtyped.hpp +++ b/modules/gapi/include/opencv2/gapi/gtyped.hpp @@ -57,7 +57,7 @@ namespace detail * * Refer to the following example. Regular (untyped) code is written this way: * - * @snippet modules/gapi/samples/api_ref_snippets.cpp Untyped_Example + * @snippet samples/cpp/tutorial_code/gapi/doc_snippets/api_ref_snippets.cpp Untyped_Example * * Here: * @@ -71,7 +71,7 @@ namespace detail * * Now the same code written with typed API: * - * @snippet modules/gapi/samples/api_ref_snippets.cpp Typed_Example + * @snippet samples/cpp/tutorial_code/gapi/doc_snippets/api_ref_snippets.cpp Typed_Example * * The key difference is: * diff --git a/modules/gapi/include/opencv2/gapi/s11n/base.hpp b/modules/gapi/include/opencv2/gapi/s11n/base.hpp index 11440b27e5..6cea94156e 100644 --- a/modules/gapi/include/opencv2/gapi/s11n/base.hpp +++ b/modules/gapi/include/opencv2/gapi/s11n/base.hpp @@ -40,7 +40,7 @@ struct NotImplemented { * which can be utilized when serializing a custom type. * * Example of usage: - * @snippet modules/gapi/samples/api_ref_snippets.cpp S11N usage + * @snippet samples/cpp/tutorial_code/gapi/doc_snippets/api_ref_snippets.cpp S11N usage * */ template diff --git a/modules/gapi/samples/api_ref_snippets.cpp b/samples/cpp/tutorial_code/gapi/doc_snippets/api_ref_snippets.cpp similarity index 100% rename from modules/gapi/samples/api_ref_snippets.cpp rename to samples/cpp/tutorial_code/gapi/doc_snippets/api_ref_snippets.cpp diff --git a/modules/gapi/samples/dynamic_graph.cpp b/samples/cpp/tutorial_code/gapi/doc_snippets/dynamic_graph_snippets.cpp similarity index 100% rename from modules/gapi/samples/dynamic_graph.cpp rename to samples/cpp/tutorial_code/gapi/doc_snippets/dynamic_graph_snippets.cpp diff --git a/modules/gapi/samples/kernel_api_snippets.cpp b/samples/cpp/tutorial_code/gapi/doc_snippets/kernel_api_snippets.cpp similarity index 100% rename from modules/gapi/samples/kernel_api_snippets.cpp rename to samples/cpp/tutorial_code/gapi/doc_snippets/kernel_api_snippets.cpp