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

too many key frames!!! #276

Closed
EXing opened this issue Mar 12, 2017 · 12 comments
Closed

too many key frames!!! #276

EXing opened this issue Mar 12, 2017 · 12 comments

Comments

@EXing
Copy link

EXing commented Mar 12, 2017

I'm using a calibratied kinect2 with orbslam2. but when I using it, even with a small move of 4cm, it produce so many keyframes(about 14). why? BTW, the dense point cloud is ugly.
temp

@EXing
Copy link
Author

EXing commented Mar 12, 2017

the kinect2 input code:
while(1)
{
if(!running)
return;

	if(!updateCloud)
	{
	  if(!ros::ok())
	  	return;
	}
	else
	{
		lock.lock();
		updateCloud = false;
	  	orbslam->TrackRGBD( color, depth, ros::Time::now().toSec() );
	  	lock.unlock();
	}

}

void callback(const sensor_msgs::Image::ConstPtr imageColor, const sensor_msgs::Image::ConstPtr imageDepth,
const sensor_msgs::CameraInfo::ConstPtr cameraInfoColor, const sensor_msgs::CameraInfo::ConstPtr cameraInfoDepth)
{
cv::Mat color, depth;

readImage(imageColor, color);
readImage(imageDepth, depth);
//readCameraInfo(cameraInfoColor, cameraMatrixColor);
//readCameraInfo(cameraInfoDepth, cameraMatrixDepth);

// IR image input
if(color.type() == CV_16U)
{
  cv::Mat tmp;
  color.convertTo(tmp, CV_8U, 0.02);
  cv::cvtColor(tmp, color, CV_GRAY2BGR);
}

lock.lock();
this->color = color;
this->depth = depth;
updateCloud = true;
lock.unlock();

}

@EXing
Copy link
Author

EXing commented Mar 12, 2017

And when it's running, there will be some warning:
virtual int g2o::SparseOptimizer::optimize(int, bool): 0 vertices to optimize, maybe forgot to call initializeOptimization()

@EXing
Copy link
Author

EXing commented Mar 12, 2017

Camera Parameters:

  • fx: 1061.64
  • fy: 1062.49
  • cx: 956.825
  • cy: 558.988
  • k1: 0
  • k2: 0
  • p1: 0
  • p2: 0
  • fps: 30
  • color order: BGR (ignored if grayscale)

ORB Extractor Parameters:

  • Number of Features: 1000
  • Scale Levels: 8
  • Scale Factor: 1.2
  • Initial Fast Threshold: 20
  • Minimum Fast Threshold: 7

Depth Threshold (Close/Far Points): 2.80001
init done
New map created with 680 points
virtual int g2o::SparseOptimizer::optimize(int, bool): 0 vertices to optimize, maybe forgot to call initializeOptimization()
virtual int g2o::SparseOptimizer::optimize(int, bool): 0 vertices to optimize, maybe forgot to call initializeOptimization()
virtual int g2o::SparseOptimizer::optimize(int, bool): 0 vertices to optimize, maybe forgot to call initializeOptimization()

@EXing
Copy link
Author

EXing commented Mar 13, 2017

it's because of the output of cameraMatrixColor and cameraMatrixDepth in kinect2_bridge of iai_kinect2 is different from calibration data! and I used the original calibration data as parameters! this cause too many keyframes!

@EXing
Copy link
Author

EXing commented Mar 13, 2017

but
virtual int g2o::SparseOptimizer::optimize(int, bool): 0 vertices to optimize, maybe forgot to call initializeOptimization()
I still don't know why!it still happens!

@EXing
Copy link
Author

EXing commented Mar 13, 2017

@raulmur please!!thank you! the same as #211 !

@mtee
Copy link

mtee commented Mar 23, 2017

it's because of the output of cameraMatrixColor and cameraMatrixDepth in kinect2_bridge of iai_kinect2 is different from calibration data! and I used the original calibration data as parameters! this cause too many keyframes!

this is probably the main issue here. Other issues come from that. Are you sure your RGB resolution is 1080p? It does not look like this on the screenshot you provided, but the calibration data is obviously for this resolution (1080p)

@EXing
Copy link
Author

EXing commented Mar 23, 2017

@mtee kinect2 provide hd(1080p),qhd(540×960),sd(smaller). I used qhd.

@mtee
Copy link

mtee commented Mar 23, 2017

@EXing then as I said, you have to use other calibration data, since yours is not suitable at all. Your principal point (cx, cy) is supposed to be somewhat in the centre of the image, but in your case it's actually outside the image:
cx: 956.825
cy: 558.988

It simply cannot work like that. You have to use camera parameters that were acquired with the resolution you use the algorithm with. Good luck!

@EXing
Copy link
Author

EXing commented Mar 23, 2017

@mtee code-iai/iai_kinect2#385 .will it affect camera.bf?

@mtee
Copy link

mtee commented Mar 23, 2017

sure, since qhd-calibration data will most likely have another value for camera.fx.

camera.bf is just camera.fx * baseline.

@EXing
Copy link
Author

EXing commented Mar 23, 2017

@mtee it helps a lot! thank you!

@EXing EXing closed this as completed Mar 23, 2017
@EXing EXing reopened this Mar 23, 2017
@EXing EXing closed this as completed Mar 25, 2017
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

2 participants