jbehley / point_labeler

My awesome point cloud labeling tool
MIT License
647 stars 161 forks source link

Show additional ground truth Scan in Viewport #27

Closed fakleingithub closed 3 years ago

fakleingithub commented 3 years ago

Hello Mr. Behley,

I really appreciate your point labler, and the brush function is very cool and the camera really smooth!

My goal was to adapt the point labeler, to read in an additional folder with .bin files that serve as ground truth or reference points while labeling the points in the velodyne folder. The points should be displayed in the background with a light color additional to the normal scans that I want to label.

All went well, I adaped the KittiReader function and can port it to the ui.mViewportXYZ->setPoints function in Mainframe.cpp

Mainframe.cpp:

reader_.retrieve(i, j, indexes, points, gtpoints, labels, gtlabels, images);

  indexes_ = indexes;
  points_ = points;
  gtpoints_ = gtpoints;
  labels_ = labels;
  gtlabels_ = gtlabels;

...

  ui.mViewportXYZ->setPoints(gtpoints_, gtlabels_);
  ui.mViewportXYZ->setPoints(points_, labels_);

But then in Viewport.cpp, I don't know how to adapt the void Viewport::setPoints function, so the additional points (that I dont want to label, just to display in backround as a reference) can be displayed.

I guess I have to fill another POINTS array so I can use the glDrawArrays(GL_POINTS, 0, 1) function.

Do you have a recommendation how make this happen?

Best Regards, Fabian

jbehley commented 3 years ago

Hi @fakleingithub,

Thanks for your interest in our point labeling tool.

For the specified use case it might be the simplest solution to just implement a setGroundTruthPoints() in line witht he setPoints() method. Similar tot the orignal points, these points are then copied to a GlBuffer, which is bound to a GlVertexArray. When you now want to draw the "ground truth" labeling, you have to bind the correct buffer and call the glDrawArrays(GL_POINTS, 0, num_points). I'm not sure if point rendering supports alphavalues, but you definitely have then to activate the blending of OpenGL, i.e., glEnable(GL_BLEND). I think I used this for the plane of the point removal.

An advatage of having two buffers would also be that the labeling code needs not to be modified at all, since it uses the original point buffer.

For more information on how the modern OpenGL pipeline works, see the excelent tutorials on learnopengl.com.

if you have still concerns, don't hesitate to write me.

fakleingithub commented 3 years ago

Hello @jbehley

thank you for your great response! Because of your input I finally managed to display both.

It was a little challenging to find out how the vao_points_ are filled in my new setPoints() function called setGroundTruthPoints() and that these are used to draw the points in prgDrawPoints

But now everything works fine :smile: and I am happy.

Thank you Mr. Behley!

Kind Regards, Fabian