ethz-asl / aerial_mapper

Real-time Dense Point Cloud, Digital Surface Map (DSM) and (Ortho-)Mosaic Generation for UAVs
BSD 3-Clause "New" or "Revised" License
557 stars 157 forks source link

How to generate poses and camera parameters for custom dataset? #40

Closed immuhammadadil closed 5 years ago

immuhammadadil commented 5 years ago

Can anyone guide me to generate poses? Can we do it using VSFM?

hitimo commented 5 years ago

Hi @immuhammadadil

Camera calibration (intrinsics, distortion, camera-imu tansformations):

Pose graph optimization

Depending on your input data, I can recommend one of the following frameworks:

Hope this helps

immuhammadadil commented 5 years ago

Thanks for providing the direction to go forward with the aerial mapper. I have done the above steps successfully. Now, I am about to pass my dataset with the required files to the aerial mapper pipeline. Can you please guide me on how to process custom dataset? Can I place the path of the dataset in the config file in the demo folder and run any demo launch file?

hitimo commented 5 years ago

Yes, the file for the poses expects the following order: https://github.com/ethz-asl/aerial_mapper/blob/a57233db3628629dcd4b4c8b01c43d3ec6f560bc/aerial_mapper_io/src/aerial-mapper-io.cc#L110

immuhammadadil commented 5 years ago

I am using the correct order in pose file. Still, I have a problem in loading the images.

roslaunch aerial_mapper_demos 0-synthetic-cadastre-dense-pcl.launch WARNING: Metapackage "aerial_mapper" should not have other dependencies besides a buildtool_depend on catkin and exec_depends. ... logging to /home/adil/.ros/log/8d9cf734-bb3f-11e9-9748-d4258b48fcce/roslaunch-adil-Y11C-9409.log Checking log directory for disk usage. This may take awhile. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB.

WARNING: Metapackage "aerial_mapper" should not have other dependencies besides a buildtool_depend on catkin and exec_depends. started roslaunch server http://adil-Y11C:33835/

SUMMARY

PARAMETERS

NODES / demo_dense (aerial_mapper_demos/aerial_mapper_demos_dense_pcl) rviz (rviz/rviz)

auto-starting new master process[master]: started with pid [9419] ROS_MASTER_URI=http://localhost:11311

setting /run_id to 8d9cf734-bb3f-11e9-9748-d4258b48fcce WARNING: Metapackage "aerial_mapper" should not have other dependencies besides a buildtool_depend on catkin and exec_depends. process[rosout-1]: started with pid [9430] started core service [/rosout] process[rviz-2]: started with pid [9437] process[demo_dense-3]: started with pid [9438] I0810 12:22:05.728698 9438 main-dense-pcl.cc:47] Loading camera rig from file. I0810 12:22:05.729040 9438 aerial-mapper-io.cc:255] Loading camera calibration from: /home/adil/testaerialmapper/cadastre_gray/camera_fixed_wing.yaml W0810 12:22:05.729691 9438 ncamera-yaml-serialization.cc:30] Unable to get the id for the ncamera. Generating new random id. W0810 12:22:05.729982 9438 camera-yaml-serialization.cc:131] Unable to get the id for the camera. Generating new random id. I0810 12:22:05.730123 9438 main-dense-pcl.cc:54] Loading body poses from file. I0810 12:22:05.730137 9438 aerial-mapper-io.cc:40] Loading body poses via format: 0 I0810 12:22:05.730151 9438 aerial-mapper-io.cc:107] Loading body poses from: /home/adil/testaerialmapper/cadastre_gray/opt_poses.txt I0810 12:22:05.731511 9438 aerial-mapper-io.cc:120] T_G_Bs->size() = 450 I0810 12:22:05.731544 9438 main-dense-pcl.cc:60] Loading images from file. I0810 12:22:05.731554 9438 aerial-mapper-io.cc:211] Loading images from directory+prefix: /home/adil/testaerialmapper/cadastregray/img terminate called after throwing an instance of 'cv::Exception' what(): OpenCV(3.4.2) /home/adil/catkin_ws_aerial_mapper/build/opencv3_catkin/opencv3_src/modules/highgui/src/window.cpp:356: error: (-215:Assertion failed) size.width>0 && size.height>0 in function 'imshow'

Aborted at 1565421725 (unix time) try "date -d @1565421725" if you are using GNU date PC: @ 0x7fcdadec7e97 gsignal SIGABRT (@0x3e8000024de) received by PID 9438 (TID 0x7fcdb0b13440) from PID 9438; stack trace: @ 0x7fcdadec7f20 (unknown) @ 0x7fcdadec7e97 gsignal @ 0x7fcdadec9801 abort @ 0x7fcdae51e957 (unknown) @ 0x7fcdae524ab6 (unknown) @ 0x7fcdae524af1 std::terminate() @ 0x7fcdae524d24 cxa_throw @ 0x7fcdaf78fc8a cv::error() @ 0x7fcdaf790b6f cv::error() @ 0x7fcdaac35423 cv::errorNoReturn() @ 0x7fcdaac36410 cv::imshow() @ 0x7fcdb055f83c io::AerialMapperIO::loadImagesFromFile() @ 0x55b04943c364 (unknown) @ 0x7fcdadeaab97 libc_start_main @ 0x55b04943d33a (unknown) [demo_dense-3] process has died [pid 9438, exit code -6, cmd /home/adil/catkin_ws_aerial_mapper/devel/lib/aerial_mapper_demos/aerial_mapper_demos_dense_pcl --flagfile=/home/adil/catkin_ws_aerial_mapper/src/aerial_mapper/aerial_mapper_demos/flags/0-synthetic-cadastre-dense-pcl.ff name:=demo_dense log:=/home/adil/.ros/log/8d9cf734-bb3f-11e9-9748-d4258b48fcce/demo_dense-3.log]. log file: /home/adil/.ros/log/8d9cf734-bb3f-11e9-9748-d4258b48fcce/demo_dense-3*.log

immuhammadadil commented 5 years ago

My issue is that I images are not loaded. My image size is 640x480. FOrmat is jpg

hitimo commented 5 years ago

What are the filenames of your images? You probably need to modify your config accordingly: https://github.com/ethz-asl/aerial_mapper/blob/master/aerial_mapper_demos/flags/0-synthetic-cadastre-dense-pcl.ff#L1-L8

immuhammadadil commented 5 years ago

Yes, I have crosschecked it and set the prefix as image_ (also set the same in config) and ran it. but images are still not loaded. Neither rgb nor grayscale

hitimo commented 5 years ago

Could you please post your config and the name of the first image?

immuhammadadil commented 5 years ago

Name of 1st image: image_001.jpg

FLag file = 0-synthetic-cadastre-dense-pcl.ff

--alsologtostderr=true --v=200 --data_directory=/home/adil/testaerialmapper/cadastre_gray/ --filename_camera_rig=camera_fixed_wing.yaml --filename_poses=opt_poses.txt --prefiximages=image --dense_pcl_use_every_nth_image=7 --use_BM=true

hitimo commented 5 years ago

The image loader does not expect the leading zeros: https://github.com/ethz-asl/aerial_mapper/blob/master/aerial_mapper_io/src/aerial-mapper-io.cc#L212-L214, i.e. the image names should be named as in the sample datasets: image_1.jpg, image_2.jpg, etc.

If you're allowed to share the dataset it'd easier to see if there are any further issues.

immuhammadadil commented 5 years ago

Alright, thanks. Let me remove the leading zeros and run it. If it fails to run. I'll share dataset.

immuhammadadil commented 5 years ago

I have shortened the dataset with 25 images and removed the leading zero. Still, the problem is the same.

immuhammadadil commented 5 years ago

I have shared google drive link of my dataset through email "hitimo@ethz.ch". If you find any issues, I would like to be informed. And thank you so much for sorting this out.

immuhammadadil commented 5 years ago

Hi, Sorry to disturb you again. Did you find anything wrong with the dataset?

immuhammadadil commented 5 years ago

I have solved the issue. The error was that my images starting with number 1. It is required that image names should start from 0. i.e. image_0.jpg