What the difference between function pattern and substitute defined in GAPI_TRANSFORM

Recently, I meet a fail case named "PatternMatchingIntegrationE2E.ChainTransformationsApplied " while execute opencv_test_gapi. So I do some research on this test program, but can’t understand this gapi pipeline very well.

This test program use a Macro called GAPI_TRANSFORM to define a image transform action, every defined transform include two member function called pattern and substitute.

Someone can tell me what these two functions do while execute gapi pipeline?
Thankyou.

1 Like

If this test fails in plain OpenCV (either “master” or some specific version) with no modifications done to OpenCV, please feel free to report it as an issue on github.

Regarding transformations, this feature allows to define some graph transformations at the user level - where you can find matches in the graph (via method pattern) and replace it with another subgraph (as defined in substitute).

Examples: opencv/gapi_int_perform_substitution_test.cpp at master · opencv/opencv · GitHub

The idea behind that feature is that on some platforms you may have superfunctions which can replace parts of the graph with some single unit (e.g. a combination of resize + color space conversion operations to be replaced by a single block). In this case, rather than changing the graph structure, one can define a transformation and map a subgraph to some smaller (or other) block.

1 Like

Have you worked it out