when i use sfm::reconstruct to extract the point cloud out of set of images it gives faulty 3D points (i already calibrated my camera and found the camera matrix) could the images be the problem and if so what should be done ?

asked 2018-06-12 02:51:18 -0600

gaber gravatar image

updated 2018-06-12 02:58:09 -0600

Generating point cloud from set of images

edit retag flag offensive close merge delete

Comments

How many images have you got in the set ?

LBerger gravatar imageLBerger ( 2018-06-12 08:44:22 -0600 )edit

6 images..

gaber gravatar imagegaber ( 2018-06-13 02:23:07 -0600 )edit

can you try with images here?

LBerger gravatar imageLBerger ( 2018-06-13 02:30:17 -0600 )edit

thank you so much i will try with them and then tell you the results

gaber gravatar imagegaber ( 2018-06-13 03:57:41 -0600 )edit

still the same problem could be a problem with the build of the library ?! it should give me a point cloud representing the scene , isnt it !? or there is something i miss understand ?

gaber gravatar imagegaber ( 2018-06-13 04:45:37 -0600 )edit

i build ceres without SuiteSparse , would that be the problem !?

gaber gravatar imagegaber ( 2018-06-13 08:15:05 -0600 )edit

I don't think so. Have yo run sample example_sfm_scene_reconstruction.exe ?

LBerger gravatar imageLBerger ( 2018-06-13 08:29:38 -0600 )edit

How to build sfm using cmake and my getbuilinformation it's here

LBerger gravatar imageLBerger ( 2018-06-13 08:52:47 -0600 )edit

i didnt build the examples i will build it again and build examples and show you my build information

gaber gravatar imagegaber ( 2018-06-13 18:16:39 -0600 )edit

thank you so much for your concern i really appreciate it

gaber gravatar imagegaber ( 2018-06-13 18:17:11 -0600 )edit

here are my build informationhere

gaber gravatar imagegaber ( 2018-06-13 18:34:16 -0600 )edit

when i run the example it gives me this errors ERROR: In e:\library\vtk\vtk-8.1.1\rendering\opengl2\vtkwin32openglrenderwindow.cxx, line 685 vtkWin32OpenGLRenderWindow (000001C8D871B360): failed to get wglChoosePixelFormatARB

ERROR: In e:\library\vtk\vtk-8.1.1\rendering\opengl2\vtkwin32openglrenderwindow.cxx, line 769 vtkWin32OpenGLRenderWindow (000001C8D871B360): failed to get valid pixel format.

ERROR: In e:\library\vtk\vtk-8.1.1\rendering\opengl2\vtkopenglrenderwindow.cxx, line 785 vtkWin32OpenGLRenderWindow (000001C8D871B360): GLEW could not be initialized.

gaber gravatar imagegaber ( 2018-06-13 21:16:59 -0600 )edit

Sorry for delay. I think error given is a problem with vtk lib mixed release and debug (you cannot run vtk with opencv releaese and debug you have to choose)

LBerger gravatar imageLBerger ( 2018-06-14 12:17:48 -0600 )edit

it is okay so i have to build vtk lib only with debug or release(lets say release ) then build opencv in release ?

gaber gravatar imagegaber ( 2018-06-14 19:23:47 -0600 )edit

Yes release with release

LBerger gravatar imageLBerger ( 2018-06-15 01:20:07 -0600 )edit

okay i will do so and tell you the updates thank you so much

gaber gravatar imagegaber ( 2018-06-15 10:10:28 -0600 )edit

iam really sorry for bothering you but there is still no resuts here is sample of my code and here are the results i would really appreciate it if you would check them for me and thank you in advance

gaber gravatar imagegaber ( 2018-06-16 18:09:31 -0600 )edit

Can you change source code in opencv_contrib file reconstruct.cpp : reconstruct_(images, Rs, Ts, K, points3d); try with reconstruct_(images, Rs, Ts, K, points3d,false);

You must rebuild opencv_contrib

LBerger gravatar imageLBerger ( 2018-06-17 02:36:01 -0600 )edit

i will do so but i have just discovered that my laptop doesnt support opencl could this be the problem !?

gaber gravatar imagegaber ( 2018-06-17 05:33:38 -0600 )edit

" laptop doesnt support opencl " it's weird because you have got some results in vtk windows wrong results but results : see my comment in PR

LBerger gravatar imageLBerger ( 2018-06-17 05:39:19 -0600 )edit

vtk depends on open GL not open CL which i have to go down from 8.1 to 6.3 in order to see these results because of some compatibility issues and in the opening window it says that it initialize open CL run time which i dont support so could it be ?!

gaber gravatar imagegaber ( 2018-06-17 05:49:24 -0600 )edit

If you think problem is OpenCL then build opencv with Test and you will get many program to check opencl

LBerger gravatar imageLBerger ( 2018-06-17 05:53:42 -0600 )edit

thank you so much but let me try your solution about changing the source code i didnt get it well could you just explain to me what to do exactly ?

gaber gravatar imagegaber ( 2018-06-17 05:57:07 -0600 )edit

Change source code and rebuild opencv with opencv_contrib

LBerger gravatar imageLBerger ( 2018-06-17 06:39:10 -0600 )edit

add the false parameter in the line you specified in the source code ?

gaber gravatar imagegaber ( 2018-06-17 06:45:45 -0600 )edit

yes only false

LBerger gravatar imageLBerger ( 2018-06-17 06:46:59 -0600 )edit

okay , thank you so much

gaber gravatar imagegaber ( 2018-06-17 07:12:17 -0600 )edit

still it doesnt work and i changed the laptop and the same results appeared so it must be something in my build well i had to add

define CERES_FOUND 1

in order to use the reconstruct function and i didnt include any thing concerning ceres solver in my solution could be this is the problem ?! should i add the ceres solver include and library files to the solution ?!

gaber gravatar imagegaber ( 2018-06-20 10:12:09 -0600 )edit

You must add ceres lib : it is the solver without solver no result. Run this script : https://gist.github.com/LaurentBerger... to install sfm on windows

LBerger gravatar imageLBerger ( 2018-06-20 10:27:10 -0600 )edit

i already installed it successfully but the reconstruct function should have worked without the define right ?!

gaber gravatar imagegaber ( 2018-06-20 10:33:56 -0600 )edit

and iam using cmake GUI i really dont know how to run this script

gaber gravatar imagegaber ( 2018-06-20 10:34:59 -0600 )edit

you must install git-bash

LBerger gravatar imageLBerger ( 2018-06-20 10:38:40 -0600 )edit

to run the script ?

gaber gravatar imagegaber ( 2018-06-20 10:41:19 -0600 )edit

you are using opencv 4 pre and iam using 3.4.1 ? should i upgrade ?!

gaber gravatar imagegaber ( 2018-06-20 10:43:57 -0600 )edit

yes script start at line and last line is 73 ( update eigen repo with https://github.com/eigenteam/eigen-gi...)

LBerger gravatar imageLBerger ( 2018-06-20 10:45:40 -0600 )edit

and the part of define ceres_found 1 is this right ?!

gaber gravatar imagegaber ( 2018-06-20 10:46:48 -0600 )edit

No you mustn't change ceres_found because cmake set this variable if ceres is found

LBerger gravatar imageLBerger ( 2018-06-20 10:52:44 -0600 )edit

okay thank you so much for helping me and here are the steps that i will follow : upgrade eigen from the repository you sent to me upgrade to opencv 4 download latest version of ceres glog and gflags ( any version is okay ?! ) then run the script , anything missing ?!

gaber gravatar imagegaber ( 2018-06-20 10:58:52 -0600 )edit

opencv 3.4.1 or master it does not matter

LBerger gravatar imageLBerger ( 2018-06-20 11:01:23 -0600 )edit

and the version of ceres , glog and gflag wouldnt matter too ?!

gaber gravatar imagegaber ( 2018-06-20 11:05:13 -0600 )edit

use the script everything is manage in the script

LBerger gravatar imageLBerger ( 2018-06-20 11:07:11 -0600 )edit

okay thank you so much

gaber gravatar imagegaber ( 2018-06-20 11:08:24 -0600 )edit

this script is written for visual studio 2015 and mine is 2017 would this be a problem ?!

gaber gravatar imagegaber ( 2018-06-20 15:18:50 -0600 )edit

and it gives me this error at echo $CMAKE CONFIG GENERATOR ,command not found

gaber gravatar imagegaber ( 2018-06-20 15:34:15 -0600 )edit

change CMAKE_CONFIG_GENERATOR="Visual Studio 14 2015 Win64" in CMAKE_CONFIG_GENERATOR="Visual Studio 15 2017 Win64"

LBerger gravatar imageLBerger ( 2018-06-20 15:42:47 -0600 )edit

line 29 , line 32 , line 34 command not found

gaber gravatar imagegaber ( 2018-06-20 16:05:33 -0600 )edit

cmake must be in path

LBerger gravatar imageLBerger ( 2018-06-20 16:12:06 -0600 )edit

well thank thank you so much for your kind patience

gaber gravatar imagegaber ( 2018-06-20 16:16:37 -0600 )edit

it worked thank you so much i will return to my build now

gaber gravatar imagegaber ( 2018-06-20 16:20:47 -0600 )edit