Ask Your Question
1

StereoSGBM Help

asked 2013-11-26 09:10:27 -0500

ed3dalltime gravatar image ed3dalltime
11 2

updated 2013-11-26 09:12:22 -0500

Hello everybody. I have a problem in compiling StereoSGBM class.

I am trying to create one instance of the SGBM class. I found some tutorials on Google, but it seems that I misunderstood something:

The problem are these lines:

StereoSGBM sgbm;
sgbm(g1, g2, disp);

where g1 and g2 are the CV_8UC1 images and disp is the disparity map. The error I get from the compiler is

/home/name/NetBeansProjects/ED3D/main.cpp: In function ‘int main(int, char**)’:
/home/name/NetBeansProjects/ED3D/main.cpp:122:16: error: cannot declare variable ‘sgbm’ to be of abstract type ‘cv::StereoSGBM’

Thank you for any advice ;)

delete close flag offensive retag edit

Comments

could you clarify, which opencv version you are using ?

i.e. in 3.0 you'd have to use:

Ptr<StereoSGBM> sgbm = createStereoBM();

sgbm->compute(g1,g2,disp);

berak ( 2013-11-26 13:46:11 -0500 )edit

It was exactly my problem. Thank you ;)

ed3dalltime ( 2013-11-26 15:13:13 -0500 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2013-11-26 13:07:10 -0500

xaffeine gravatar image xaffeine
735 4 17

The following works for me.

#include "opencv2/calib3d/calib3d.hpp"
void foo()
{
  cv::StereoSGBM sgbm;
  sgbm( cv::Mat(), cv::Mat(), cv::Mat() );
}

The error you got is a little surprising. Without calib3d.hpp, StereoSGBM should be an undefined symbol. Maybe you have a forward declaration getting in the way.

link delete flag offensive edit

Login/Signup to Answer

Question tools

Follow

subscribe to rss feed

Stats

Asked: 2013-11-26 09:10:27 -0500

Seen: 137 times

Last updated: Nov 26 '13