kevin-george / lsd_slam

LSD-SLAM
GNU General Public License v3.0
47 stars 38 forks source link

Displaying depth map #1

Open Minimartian opened 7 years ago

Minimartian commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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 commented 6 years ago

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 commented 6 years ago

@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 commented 6 years ago

@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 commented 6 years ago

@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 commented 6 years ago

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 commented 6 years ago

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 commented 5 years ago

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

abdur4373 commented 5 years ago

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 commented 5 years ago

@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 commented 5 years ago

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

vyi commented 5 years ago

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

zhangliyun9120 commented 4 years ago

@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 commented 3 years ago

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 commented 3 years ago

@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