3

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

Alex Guerrero
  • 2,109
  • 1
  • 19
  • 28
  • Did you ever figure this one out? – Coder1 Jun 12 '15 at 04:26
  • @Coder1 sorry for delay in response, I haven't found a solution yet but use `cv::putText` with references to my trackbar values works for me as a workaround and helps me to forget the problem – Alex Guerrero Jun 16 '15 at 09:38
  • 2
    I believe this is a Mac OS X issue. I was working with my opencv3 code on ubuntu and saw the trackbar values, but running the same code on my Mac I see no values by the trackbar. – DowntownDev Nov 01 '16 at 05:35

0 Answers0