Ask Your Question

Darker's profile - activity

2021-07-15 02:35:34 -0600 received badge  Famous Question (source)
2019-05-04 09:55:42 -0600 received badge  Notable Question (source)
2018-09-01 20:18:39 -0600 received badge  Popular Question (source)
2017-09-18 10:50:18 -0600 received badge  Notable Question (source)
2016-06-14 05:52:45 -0600 received badge  Popular Question (source)
2013-02-26 01:27:48 -0600 received badge  Student (source)
2013-02-23 06:49:12 -0600 commented question Calculate font scale to fit text in the box

But I'm only trying to fit height. Width must be fit by user - correct button width must be defined, or the font overflows.

2013-02-23 06:41:59 -0600 commented answer Opencv fails to capture click down early after previous

Thank you, I'd never have figured this out! :D

2013-02-23 06:41:57 -0600 received badge  Scholar (source)
2013-02-22 18:46:45 -0600 asked a question Calculate font scale to fit text in the box

I have a button created in openCV and I need to fit a text in it. How do I compute the font scale if I want to fit it by width and I know the width of the box?

int font = CV_FONT_HERSHEY_COMPLEX_SMALL;  //defining font
double scale = ((float)(height-3))/20.0;   //So far, I just try to divide height by 20
Size textSize = getTextSize(value, font, scale, 1, &bottom);  //Geting text rect
Point textOrg((width - textSize.width)/2+x, (height + textSize.height)/2+y); //Computing point to center the text in the button
putText(*screen, value, textOrg, font, scale, Scalar(0,0,255), 1);//Printing txt in RED color

Now, I do simple height division, which works, but doesn't really make text fit - and in extreme cases (too small, to large box) the text either overflows or does not use desired 95% of boxes height.

2013-02-22 18:14:30 -0600 asked a question Configuring camera properties in new OCV 2.4.3

I may just be googling wrong, but I cannot find out a way (read function) to change properties of camera in the new Open CV. I need to disable auto exposure and auto gain of the camera.
Is that even possible?

2013-02-22 17:31:23 -0600 commented question What Bollywood film holds a record in Guinness?

Off topic. Are you making fun of us man? This almost seems like some "like to be troll"...

2013-02-22 17:29:02 -0600 asked a question Opencv fails to capture click down early after previous

I have written a very simple UI class for open CV (based on drawing buttons on OpenCV matrices), but it seems, that OpenCV has some sort of event handler bug:
When I click down, up and down second down click event is not captured, if I click too fast. However, if I click down, up, down and up though the second down remains ignored the second up event is captured, no matter how fast I try to click.
Debug output (1 = down, -1 = up):

Button: 1    //slow clicks
Button: -1
Button: 1
Button: -1
Button: 1
Button: -1
Button: 1
Button: -1
Button: 1   //started clicking fast
Button: -1
Button: -1
Button: 1
Button: -1
Button: -1
Button: 1
Button: -1
Button: -1
Button: 1

Because I already happened to be downvoted for posting questions without code, here is some code:

void Opencv_UI::event_process(int evt, int x, int y, int flags) 
{
    int button = 0;
    switch(evt) 
    {
        case CV_EVENT_LBUTTONDOWN : button=1; break;
        case CV_EVENT_LBUTTONUP : button=-1; break;
        case CV_EVENT_RBUTTONDOWN : button=3; break;
        case CV_EVENT_RBUTTONUP : button=-3; break;
    }
    if(button==1||button==-1)
      std::cout<<"Button: "<<button<<"\n";
        //Code below does not affect event performance, I tryed the script with all this commented out
    int button_count = buttons.size();
    for(int i=0; i<button_count; i++) //Informs buttons about mouse event
    {
        buttons[i]->mouse(x, y, button);
    }
    this->render();    //Renders buttons affected by click/mousemove
}
2013-02-21 12:43:34 -0600 received badge  Supporter (source)