Regarding rectangle button in opencv c++
I am making label tool in opencv with c++. I have made two buttons. If I click on button, the button is selected. The red colored rectangle is displayed around the button. when I click the another button, the previous red colored rectangle should be disappeared. I am posting useful code snipet only. Let me know in case of any information will be reuired.
void callBackFunc1(int event, int x, int y, int flags, void* userdata)
{
Buttons* button = (Buttons*)userdata;
Vec3b selectButton;
if (event == EVENT_LBUTTONDOWN)
{
if (button-> leftHand.contains(Point(x, y)))
{
selectButton = Vec3b(0, 0, 250);
cout << "Select Left Hand ROI\n" << endl;
//drawRect(button->leftHand) = Vec3b(255, 255, 255);
rectangle(drawRect, button->leftHand, selectButton, 5, 8, 0);
}
else if (button->leftElbow.contains(Point(x, y)))
{
selectButton = Vec3b(0, 0, 250);
cout << "Select Left Elbow ROI\n" << endl;
rectangle(drawRect, button->leftElbow, selectButton, 5, 8, 0);
}
imshow("Label Tool", drawRect);
}