Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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.

image description

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);
  }

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.

image description

int main() { Buttons button; Colours colour; Mat3b image(600, 600, Vec3b(0, 0, 0));

// Define buttons and colours
button.leftHand = Rect(300, 0, image.cols - 300, 30);
colour.LeftHand = Rect(0, 0, image.cols - 400, 30);

    drawRect(button.leftHand) = Vec3b(200, 200, 200);
drawRect(colour.LeftHand) = Vec3b(255, 0, 0); //blue
putText(drawRect(button.leftHand), "Left hand ROI", Point(button.leftHand.width*0.35, button.leftHand.height*0.70), FONT_HERSHEY_PLAIN, 1, Scalar(0, 0, 0), 1.5);

}

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);
  }

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.

image description

int main() { Buttons button; Colours colour; Mat3b image(600, 600, Vec3b(0, 0, 0));

// Define buttons and colours
button.leftHand = Rect(300, 0, image.cols - 300, 30);
colour.LeftHand = Rect(0, 0, image.cols - 400, 30);

    drawRect(button.leftHand) = Vec3b(200, 200, 200);
drawRect(colour.LeftHand) = Vec3b(255, 0, 0); //blue
putText(drawRect(button.leftHand), "Left hand ROI", Point(button.leftHand.width*0.35, button.leftHand.height*0.70), FONT_HERSHEY_PLAIN, 1, Scalar(0, 0, 0), 1.5);

}

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);
  }