Ask Your Question
0

Update opencv viz3d window after calling spin() (event loop)

asked 2017-05-22 15:08:42 -0500

Esraa gravatar image

I made a program based on the user inputs some widgets appear inside viz3d window. the problem is I want the widget's pose to get updated real time so the program should do the following: 1- take inputs from the user from GUI 2- pop up a window with the wanted widget. 3- the user can ask for more widgets to add 4-update the window with the new widgets i can't figure out a way to update viz3d window any widget I add after calling window. spin() or window.spinonce() doesn't appear

edit retag flag offensive close merge delete

Comments

Do you know this code ?

LBerger gravatar imageLBerger ( 2017-05-23 09:16:00 -0500 )edit

yeah, what if after I created all the widgets and started the event loop, the user wanted to change any previous inputs did he(the user) need to close the window and run the program again ? or can he/she alter the existed widgets? (Given that the user uses GUI to enter the inputs which doesn't close when viz3d window appears) Thanks alot and forgive me i'm a bit new to opencv viz.

Esraa gravatar imageEsraa ( 2017-05-23 10:53:24 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-05-23 13:40:25 -0500

LBerger gravatar image

Copy and paste example given in this link there is no problem :

void ClavierViz(const viz::KeyboardEvent    &k,void *c)
{
    int *i=(int*)c;
    if (k.code=='1')
        *i=*i-1;
    else if (k.code == '2')
        *i = *i + 1;
}

.....

int indCam=0,indRef=indCam;
fen3D.setViewerPose(path[indCam]);
fen3D.registerKeyboardCallback(ClavierViz, &indCam);
do 
{
    if (indRef==indCam)
        fen3D.spinOnce(1,false);
    else
    {
        if (indCam>= path.size())
            indCam=0;
        else if (indCam <0)
            indCam = path.size()-1;
        indRef=indCam;
        fen3D.setViewerPose(path[indCam]);
        fen3D.spinOnce(1,true);
    }
} while (!fen3D.wasStopped());
edit flag offensive delete link more

Comments

Thanks a lot, but can you explain it a bit, I'm sorry I can't get it

Esraa gravatar imageEsraa ( 2017-05-23 14:21:42 -0500 )edit

@Esraa Have you solved your problem ?

LBerger gravatar imageLBerger ( 2017-05-24 08:31:54 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-05-22 15:08:42 -0500

Seen: 232 times

Last updated: May 23 '17