I'm creating a simple configuration panel window to modify some HSV values for an OpenCV program. This is the specific code:
int HUE_MIN = 0;
int HUE_MAX = 256;
int SAT_MIN = 0;
int SAT_MAX = 256;
int VAL_MIN = 0;
int VAL_MAX = 256;
const string configPanelWindowName = "Configuration panel";
void createTrackbars()
{
namedWindow(configPanelWindowName, 0);
cv::createTrackbar( "HUE_MIN", configPanelWindowName, &HUE_MIN, HUE_MAX );
cv::createTrackbar( "HUE_MAX", configPanelWindowName, &HUE_MAX, HUE_MAX );
cv::createTrackbar( "SAT_MIN", configPanelWindowName, &SAT_MIN, SAT_MAX );
cv::createTrackbar( "SAT_MAX", configPanelWindowName, &SAT_MAX, SAT_MAX );
cv::createTrackbar( "VAL_MIN", configPanelWindowName, &VAL_MIN, VAL_MAX );
cv::createTrackbar( "VAL_MAX", configPanelWindowName, &VAL_MAX, VAL_MAX );
}
void createTrackbars();
I've followed some video demos and in most of them the trackbar shows its current value in integer numbers but in my case the numbers don't appear and I don't know why I can implement them. I've tried to update trackbar labels through the onChange
parameter but it doesn't work because the label
parameter should be a constant.
I don't want to use cv::putText()
function because I'm not using an image into the config panel window and I'm currently using a workaround with cv::putText
in a different window to show the current values of trackbars.
Finally I don't know if this is related, but all the envirements of the demos I've seen are different to mine. I'm using Mac OS X 10.10 and they instead use Ubuntu and Windows so I think that can cause this behavior.
So I want to know why this feature doesn't work for me and if there's a workaround different to use cv::putText