Created
May 28, 2019 09:15
-
-
Save iiey/936af791253faff2e5202ddde2ea59de to your computer and use it in GitHub Desktop.
handle static method createTrackbar of opencv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A | |
{ | |
public: | |
void handleTrackbar(int value) | |
{ | |
// real work here, can use 'this' | |
} | |
//workaround not to declare static var used inside | |
static void onTrackbar(int value, void* ptr) | |
{ | |
auto obj = static_cast<A*>(ptr); | |
obj->handleTrackbar(value); | |
} | |
}; | |
createTrackbar(trck_name, | |
wnd_name, | |
&setting, | |
(int)out_max, | |
A::onTrackbar, //now a static member | |
this); //this one must be given |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment