17 February 2021 at 14 h 43 min #18701
When I run
everything seems to work correctly. However, when I run
my visual is not correctly updated.
I am working with the v20.12 release (both for SOFA and SP3) and I am using some OpenCV functions (from the OpencvPlugin) that add some visual markers with a mouse click event. The markers are correctly initialized (both when using runSofa or python3) but are not visible when using python3.
Any reason why this happens??
Andrea18 February 2021 at 10 h 44 min #18718
Are you sure you are using the same GUI (qt vs qglviewer) for both python and runSofa?
Can you show us the part of your code that creates the root node, initializes it and starts the GUI?18 February 2021 at 11 h 45 min #18720
I also thought the problem might come from the GUI, but I use qglviewer for both python and runSofa.
When running my scene with python, this is the code that creates the root node and the GUI:
root = Sofa.Core.Node() createScene(root) Sofa.Simulation.init(root) Sofa.Gui.GUIManager.Init("Acquire and register", "qglviewer") Sofa.Gui.GUIManager.createGUI(root, file) Sofa.Gui.GUIManager.SetDimension(640, 480) Sofa.Gui.GUIManager.MainLoop(root)
Andrea18 February 2021 at 14 h 36 min #18722
Does it render something or is it just black? Like, can you see forcefields and OglModels being drawn?
Does it help if you add
J-N18 February 2021 at 15 h 15 min #18723
My scene is a priori rendered correctly. I see my forcefields and ogl models, and also the images acquired by a realsense camera (plugged to my computer).
The issue comes when using the component OpenCVProjectivePointSelector from the OpencvPlugin. In particular when I select markers on the current image with a mouse click, these markers are displayed as red points when using runSofa (which is the expected behavior), but are invisible when using python (and yet they are correctly initialized).
Not sure if it is relate, but adding
Sofa.Simulation.initVisual(root)results in a segfault with the following error:
-> /home/andrea/projects/sofa/build/install/lib/libSofaHelper.so.20.12.00(sofa::helper::BackTrace::dump()+0x27) [0x7fe673a69977] -> /home/andrea/projects/sofa/build/install/lib/libSofaHelper.so.20.12.00(sofa::helper::BackTrace::sig(int)+0x1d6) [0x7fe673a69d16] -> /lib/x86_64-linux-gnu/libc.so.6(+0x46210) [0x7fe677c54210] Segmentation fault (core dumped)
Hope this helps.
Andrea19 February 2021 at 8 h 36 min #18725
Hum, I’m not sure what’s going on here. If forcefields and OglModels are rendering, to me this means that everything is fine on the visual pipeline.
Can you try to debug your component to make sure it succeed to get to the rendering calls? For example, you could put a quick debug message inside the
draw()method of the component just before calling
vparams->drawTool()->drawXXX(). Does it get there? Or does it get stopped by some
if(...)before calling the drawTool?19 February 2021 at 10 h 28 min #18726
It gets without problem to the draw() method.
vparams->drawTool()->drawSphere(point, 0.0038)is effectively called. And the vector
pointis correctly updated.
Andrea1 March 2021 at 9 h 08 min #18773FroyParticipant
- SOFA Consortium
First thing first, your problem seems to be located while using the so-called “OpenCVPlugin” which seems to be a private plugin of yours.
In such cases, it is hard for us to provide appropriate support.
From what I know, it seems the
draw()in OpenCVProjectivePointSelector is conditioned with
if (f_listening.getValue() && d_draw.getValue())
Did these two Data are true while executing with Python3 ?
As stated, this plugin is purely private to your team and not really useful for the whole SOFA community so it may be more appropriate to ask those questions in an other medium. (your team’s gitlab for example?)1 March 2021 at 14 h 05 min #18780bttParticipant
I am very interested in your team’s plugins (SOFACV and imageprocessing). So far, I have successfully compiled Sofacv with SOFA but it is not the case for Imageprocessing plugin. It seems due to the fact that this plugin is no longer compatible with current sofa versions (I suppose). I have tried with v19, v20.06, v20.12 and master branch but not quite successful. I just wonder your team would have a plan to update such plugin (and also sofacv) to be more compatible with SOFA? It would be great if there are such things and I would love to play with them soon. Thank you for your wonderful works anyway and looking forward to your reply soon
best,17 March 2021 at 19 h 17 min #18869HugoKeymaster
- SOFA Consortium
I think @amendiza is using a private plugin named OpenCVPlugin while you are using the SofaCV plugin which is open. I am personnaly in favor of using as much as possible the open-source versions.
If I remember properly from this post you successfully compiled it, right?
Problem solved @amendiza ?
Hugo6 April 2021 at 8 h 33 min #19071Bruno MarquesParticipant
Hi and sorry for the late reply @btt,
As far as I know SofaCV and ImageProcessing aren’t being used in the Mimesis team, which has a different plugin named OpenCVPlugin for these kinds of tasks.
The SofaCV plugin doesn’t have a huge community of users as of today and I was the main developer working on it. I’ve updated the codebase so that it compiles against the master branch of SOFA, and OpenCV 4.2, with the plugin’s default build options.
If you want extra features, such as the opencv_contrib bindings available through the plugin, you’ll have to do the extra work of fixing the compile issues, although with the basic version compiling, looking at the diff should give you clues on how to fix most issues related to SOFA’s & OpenCV’s evolutions:
If you have questions, I’ll try to answer the best I can, although my answers might arrive quite late, as I’m not working on this project anymore.
Best of luck!
- You must be logged in to reply to this topic.