Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Displaying depth map #1

Open
Minimartian opened this issue Oct 4, 2017 · 16 comments
Open

Displaying depth map #1

Minimartian opened this issue Oct 4, 2017 · 16 comments

Comments

@Minimartian
Copy link

Heya,

has a solution been found for displaying the depth map?

I am getting the following output which seems to be the same for most people in the tum_vision version

QObject::killTimer: Timers cannot be stopped from another thread
QObject::startTimer: Timers cannot be started from another thread
^CQObject::~QObject: Timers cannot be stopped from another thread

I followed the instructions on your Wiki

Thanks

@kevin-george
Copy link
Owner

Are you talking about the grayed out DepthMap window that pops up?
If yes, I haven't gotten that to work either. I have been using the library as a visual odometry source with ROS and it's working as expected.

@Minimartian
Copy link
Author

Thanks for the quick reply!

I was interested in observing the depth map to see if we could use lsd_slam for our project which is set up on kinetic.

Not to worry! I'll see if i can install lsd on indigo just to test it, or use Rviz in some way.

Thanks again

@OAkyildiz
Copy link

The windows version of that code had no concept of reference frames or a viewport and it looked like a placeholder. I think RViz is your best bet to test the KeyFrames. As far as I can remember, the keyframes and frames (and their clouds) are being processed and transformed from world to camera properly or at least it is easy to handle that with a few calls to ros.tf in ROS

@fulkast
Copy link

fulkast commented Feb 6, 2018

@kevin-george I have gotten the DepthMap to work on my machine. This is a similar issue that has been faced by ORB-SLAM on Ubuntu 16.04 as well.

While I don't know the exact low-level issue, from a higher level, I think this happens because of clashes between different Qt threads. One such thread is the one in charge of displaying the depthMap. I traced the Util::displayImage method which displays the depthMap and it eventually led to the cv::namedWindow method. I think that if your OpenCV was compiled with Qt, then calling namedWindow would generate a Qt thread. This then would clash with some other Qt thread in charge of another SLAM task.

This is my hypothesis. The things I haven't check are the follows:

  1. Is ros-kinetic-opencv3 built with Qt?
  2. Which qt threads are active in other LSD-SLAM tasks?

For now this one thing is certain. I have removed my ros-kinetic-opencv3, pulled cv-bridge from github into my catkin_ws and also built and installed OpenCV 3 from source without Qt.

The depthMap display works on my machine Ubuntu 16.04 and I don't get any errors regarding QObject.

@kevin-george
Copy link
Owner

@fulkast Thank you for that tip! I'll be trying to fix this without having to re-install opencv. If you find a way to do that, please do let me know :)

@fulkast
Copy link

fulkast commented Feb 12, 2018

@kevin-george Good call! Installing OpenCV from source takes quite some time. I lucked out as I already had a version of OpenCV installed which didn't have Qt.

Are you using OpenCV 3 installed through the ros-kinetic-opencv3 package?

@kevin-george
Copy link
Owner

Yeah, ROS ported over to opencv3 and I'm using the default package.
I wonder if we can get away with not installing Qt and use the one installed with ROS instead? Seems like the easiest fix(no code fixes that is)

@sujaymanb
Copy link

Has anyone found a way to fix this? I am trying to use lsd slam as a vision based odometry solution (for drone). How did you use the odometry? I keep losing trace after a few seconds of starting lsd slam.

@abdur4373
Copy link

Hello! @kevin-george Did you find any solution for displaying depth map without removing ros-kinetic-opencv3?

@abdur4373
Copy link

Hello! @kevin-george @fulkast
I have found a solution to DepthMap window greyed out issue. Got a hint of the issue from herehttp://answers.opencv.org/question/174121/v33-imshow-no-response/.
With issue#2 resolved from the pull request#8, i have added cv::waitKey();
here:- void displayThreadLoop() . . } cv::imshow(displayQueue.back().name, displayQueue.back().img); cv::waitKey(); displayQueue.pop_back(); } . . printf("ended image display thread!\n"); }
in file "~/catkin_ws/src/lsd_slam/lsd_slam_core/src/IOWrapper/OpenCV/ImageDisplay_OpenCV.cpp".
And pressing hotkey "d" or "e" while DepthMap window is selected. DepthMap as well as Point Cloud both gets updated.

Now if you can help me out why there is need to press this hotkey for this to work? What can i add to the code so it can run by itself?
Thanks

@fulkast
Copy link

fulkast commented Feb 18, 2019

@abdur4373 if you just added an integer to the cv::waitKey() function , that isn't 0.

That is for example, use:

cv::waitKey(1);

Here's a detailed explanation of the waitKey function: https://stackoverflow.com/questions/5217519/what-does-opencvs-cvwaitkey-function-do

@abdur4373
Copy link

Yup @fulkast usage was the issue... Just did cv::waitKey(30); and both windows worked like a charm... Thanks a lot for the tip.
DebugWindow Depth result
screenshot from 2019-02-19 11-32-49
PointCloud Viewer Result
screenshot from 2019-02-19 11-33-05

abdur4373 referenced this issue in FirefoxMetzger/lsd_slam Feb 19, 2019
For some reason displaying the depth map during SLAM causes LSD-SLAM to
crash. The temporary fix is to disable it for now until I have time to
thoroughly investigate this issue
@vyi
Copy link

vyi commented Oct 7, 2019

@abdur4373 Didn't work for me :(
Tried with different values but no luck!
I'm on kinetic.

@zhangliyun9120
Copy link

@abdur4373 Didn't work for me :(
Tried with different values but no luck!
I'm on kinetic.


same to yours, have you found the solution? thx

@kanishkanarch
Copy link

kanishkanarch commented Mar 1, 2021

Yup, @fulkast usage was the issue... I just did cv::waitKey(30); and both windows worked like a charm... Thanks a lot for the tip.
DebugWindow Depth result
screenshot from 2019-02-19 11-32-49
PointCloud Viewer Result
screenshot from 2019-02-19 11-33-05

@abdur4373, writing cv::waitKey(30) there got my depth window working, but it seems like it 'refreshes' only when a key is pressed. How do I get it working automatically? Any leads?

@OAkyildiz
Copy link

@Kanishk598 that should not be the case, cv::waitKey(30) will wait for a key for 30 ms. Somehow you are waiting for a key forever, then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants