Tango: updated UI

This commit is contained in:
matlabbe
2017-06-28 13:59:20 -04:00
parent 64fc9f203e
commit ebada30984
19 changed files with 323 additions and 98 deletions
+18 -1
View File
@@ -298,7 +298,11 @@ int RTABMapApp::openDatabase(const std::string & databasePath, bool databaseInMe
optTexture_ = cv::Mat(); optTexture_ = cv::Mat();
cv::Mat cloudMat; cv::Mat cloudMat;
std::vector<std::vector<std::vector<unsigned int> > > polygons; std::vector<std::vector<std::vector<unsigned int> > > polygons;
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > texCoords;
#else
std::vector<std::vector<Eigen::Vector2f> > texCoords; std::vector<std::vector<Eigen::Vector2f> > texCoords;
#endif
cv::Mat textures; cv::Mat textures;
std::map<int, rtabmap::Transform> optPoses; std::map<int, rtabmap::Transform> optPoses;
if(!databaseSource.empty()) if(!databaseSource.empty())
@@ -1051,6 +1055,7 @@ int RTABMapApp::Render()
pcl::fromPCLPointCloud2(optMesh_->cloud, *mesh.cloud); pcl::fromPCLPointCloud2(optMesh_->cloud, *mesh.cloud);
pcl::fromPCLPointCloud2(optMesh_->cloud, *mesh.normals); pcl::fromPCLPointCloud2(optMesh_->cloud, *mesh.normals);
mesh.polygons = optMesh_->tex_polygons[0]; mesh.polygons = optMesh_->tex_polygons[0];
mesh.pose.setIdentity();
if(optMesh_->tex_coordinates.size()) if(optMesh_->tex_coordinates.size())
{ {
mesh.texCoords = optMesh_->tex_coordinates[0]; mesh.texCoords = optMesh_->tex_coordinates[0];
@@ -1568,7 +1573,7 @@ int RTABMapApp::Render()
if(rtabmapEvents.size()) if(rtabmapEvents.size())
{ {
// send statistics to GUI // send statistics to GUI
LOGW("Posting PostRenderEvent! %fs", renderingTime_); LOGI("New data added to map, rendering time: %fs", renderingTime_);
UEventsManager::post(new PostRenderEvent(rtabmapEvents.back())); UEventsManager::post(new PostRenderEvent(rtabmapEvents.back()));
rtabmapEvents.pop_back(); rtabmapEvents.pop_back();
@@ -1740,6 +1745,10 @@ void RTABMapApp::setOrthoCropFactor(float value)
{ {
main_scene_.setOrthoCropFactor(value); main_scene_.setOrthoCropFactor(value);
} }
void RTABMapApp::setGridRotation(float value)
{
main_scene_.setGridRotation(value);
}
void RTABMapApp::setLighting(bool enabled) void RTABMapApp::setLighting(bool enabled)
{ {
main_scene_.setLighting(enabled); main_scene_.setLighting(enabled);
@@ -2764,7 +2773,11 @@ bool RTABMapApp::postExportation(bool visualize)
{ {
cv::Mat cloudMat; cv::Mat cloudMat;
std::vector<std::vector<std::vector<unsigned int> > > polygons; std::vector<std::vector<std::vector<unsigned int> > > polygons;
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > texCoords;
#else
std::vector<std::vector<Eigen::Vector2f> > texCoords; std::vector<std::vector<Eigen::Vector2f> > texCoords;
#endif
cv::Mat textures; cv::Mat textures;
std::map<int, rtabmap::Transform> optPoses; std::map<int, rtabmap::Transform> optPoses;
if(rtabmap_ && rtabmap_->getMemory()) if(rtabmap_ && rtabmap_->getMemory())
@@ -2801,7 +2814,11 @@ bool RTABMapApp::writeExportedMesh(const std::string & directory, const std::str
pcl::TextureMesh::Ptr textureMesh(new pcl::TextureMesh); pcl::TextureMesh::Ptr textureMesh(new pcl::TextureMesh);
cv::Mat cloudMat; cv::Mat cloudMat;
std::vector<std::vector<std::vector<unsigned int> > > polygons; std::vector<std::vector<std::vector<unsigned int> > > polygons;
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > texCoords;
#else
std::vector<std::vector<Eigen::Vector2f> > texCoords; std::vector<std::vector<Eigen::Vector2f> > texCoords;
#endif
cv::Mat textures; cv::Mat textures;
std::map<int, rtabmap::Transform> optPoses; std::map<int, rtabmap::Transform> optPoses;
if(rtabmap_ && rtabmap_->getMemory()) if(rtabmap_ && rtabmap_->getMemory())
+1
View File
@@ -121,6 +121,7 @@ class RTABMapApp : public UEventsHandler {
void setPointSize(float value); void setPointSize(float value);
void setFOV(float angle); void setFOV(float angle);
void setOrthoCropFactor(float value); void setOrthoCropFactor(float value);
void setGridRotation(float value);
void setLighting(bool enabled); void setLighting(bool enabled);
void setBackfaceCulling(bool enabled); void setBackfaceCulling(bool enabled);
void setWireframe(bool enabled); void setWireframe(bool enabled);
+6
View File
@@ -180,6 +180,12 @@ Java_com_introlab_rtabmap_RTABMapLib_setOrthoCropFactor(
return app.setOrthoCropFactor(value); return app.setOrthoCropFactor(value);
} }
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_com_introlab_rtabmap_RTABMapLib_setGridRotation(
JNIEnv*, jobject, float value)
{
return app.setGridRotation(value);
}
JNIEXPORT void JNICALL
Java_com_introlab_rtabmap_RTABMapLib_setLighting( Java_com_introlab_rtabmap_RTABMapLib_setLighting(
JNIEnv*, jobject, bool enabled) JNIEnv*, jobject, bool enabled)
{ {
+2
View File
@@ -70,6 +70,7 @@ private:
bool isVisible() const {return visible_;} bool isVisible() const {return visible_;}
bool hasMesh() const {return polygons_.size()!=0;} bool hasMesh() const {return polygons_.size()!=0;}
bool hasTexture() const {return textures_ != 0;} bool hasTexture() const {return textures_ != 0;}
float getMinHeight() const {return minHeight_;}
const pcl::PointXYZ & aabbMinModel() const {return aabbMinModel_;} const pcl::PointXYZ & aabbMinModel() const {return aabbMinModel_;}
const pcl::PointXYZ & aabbMaxModel() const {return aabbMaxModel_;} const pcl::PointXYZ & aabbMaxModel() const {return aabbMaxModel_;}
const pcl::PointXYZ & aabbMinWorld() const {return aabbMinWorld_;} const pcl::PointXYZ & aabbMinWorld() const {return aabbMinWorld_;}
@@ -126,6 +127,7 @@ private:
bool visible_; bool visible_;
bool hasNormals_; bool hasNormals_;
std::vector<unsigned int> organizedToDenseIndices_; std::vector<unsigned int> organizedToDenseIndices_;
float minHeight_; // odom frame
float gainR_; float gainR_;
float gainG_; float gainG_;
+71 -2
View File
@@ -16,12 +16,16 @@
#include <tango-gl/conversions.h> #include <tango-gl/conversions.h>
#include <tango-gl/gesture_camera.h> #include <tango-gl/gesture_camera.h>
#include <tango-gl/util.h>
#include <rtabmap/utilite/ULogger.h> #include <rtabmap/utilite/ULogger.h>
#include <rtabmap/utilite/UStl.h> #include <rtabmap/utilite/UStl.h>
#include <rtabmap/utilite/UTimer.h> #include <rtabmap/utilite/UTimer.h>
#include <rtabmap/core/util3d_filtering.h> #include <rtabmap/core/util3d_filtering.h>
#include <rtabmap/core/util3d_transforms.h>
#include <rtabmap/core/util3d_surface.h>
#include <pcl/common/transforms.h> #include <pcl/common/transforms.h>
#include <pcl/common/common.h>
#include <glm/gtx/transform.hpp> #include <glm/gtx/transform.hpp>
@@ -32,7 +36,7 @@
// add an offset in z to our origin. We'll set this offset to 1.3 meters based // add an offset in z to our origin. We'll set this offset to 1.3 meters based
// on the average height of a human standing with a Tango device. This allows us // on the average height of a human standing with a Tango device. This allows us
// to place a grid roughly on the ground for most users. // to place a grid roughly on the ground for most users.
const glm::vec3 kHeightOffset = glm::vec3(0.0f, 1.3f, 0.0f); const glm::vec3 kHeightOffset = glm::vec3(0.0f, -1.3f, 0.0f);
// Color of the motion tracking trajectory. // Color of the motion tracking trajectory.
const tango_gl::Color kTraceColor(0.66f, 0.66f, 0.66f); const tango_gl::Color kTraceColor(0.66f, 0.66f, 0.66f);
@@ -130,7 +134,7 @@ void Scene::InitGLContent()
trace_->ClearVertexArray(); trace_->ClearVertexArray();
trace_->SetColor(kTraceColor); trace_->SetColor(kTraceColor);
grid_->SetColor(kGridColor); grid_->SetColor(kGridColor);
grid_->SetPosition(-kHeightOffset); grid_->SetPosition(kHeightOffset);
box_->SetShader(); box_->SetShader();
box_->SetColor(1,0,0); box_->SetColor(1,0,0);
@@ -194,6 +198,10 @@ void Scene::clear()
graph_ = 0; graph_ = 0;
} }
pointClouds_.clear(); pointClouds_.clear();
if(grid_)
{
grid_->SetPosition(kHeightOffset);
}
} }
//Should only be called in OpenGL thread! //Should only be called in OpenGL thread!
@@ -565,6 +573,15 @@ void Scene::setOrthoCropFactor(float value)
{ {
gesture_camera_->SetOrthoCropFactor(value); gesture_camera_->SetOrthoCropFactor(value);
} }
void Scene::setGridRotation(float angleDeg)
{
float angleRad = angleDeg * DEGREE_2_RADIANS;
if(grid_)
{
glm::quat rot = glm::rotate(glm::quat(1,0,0,0), angleRad, glm::vec3(0, 1, 0));
grid_->SetRotation(rot);
}
}
rtabmap::Transform Scene::GetOpenGLCameraPose(float * fov) const rtabmap::Transform Scene::GetOpenGLCameraPose(float * fov) const
{ {
@@ -669,6 +686,58 @@ void Scene::addMesh(
PointCloudDrawable * drawable = new PointCloudDrawable(mesh, createWireframe); PointCloudDrawable * drawable = new PointCloudDrawable(mesh, createWireframe);
drawable->setPose(pose); drawable->setPose(pose);
pointClouds_.insert(std::make_pair(id, drawable)); pointClouds_.insert(std::make_pair(id, drawable));
if(!mesh.pose.isNull() && mesh.cloud->size() && (!mesh.cloud->isOrganized() || mesh.indices->size()))
{
UTimer time;
float height = 0.0f;
Eigen::Affine3f affinePose = mesh.pose.toEigen3f();
if(mesh.polygons.size())
{
for(unsigned int i=0; i<mesh.polygons.size(); ++i)
{
for(unsigned int j=0; j<mesh.polygons[i].vertices.size(); ++j)
{
pcl::PointXYZRGB pt = pcl::transformPoint(mesh.cloud->at(mesh.polygons[i].vertices[j]), affinePose);
if(pt.z < height)
{
height = pt.z;
}
}
}
}
else
{
if(mesh.cloud->isOrganized())
{
for(unsigned int i=0; i<mesh.indices->size(); ++i)
{
pcl::PointXYZRGB pt = pcl::transformPoint(mesh.cloud->at(mesh.indices->at(i)), affinePose);
if(pt.z < height)
{
height = pt.z;
}
}
}
else
{
for(unsigned int i=0; i<mesh.cloud->size(); ++i)
{
pcl::PointXYZRGB pt = pcl::transformPoint(mesh.cloud->at(i), affinePose);
if(pt.z < height)
{
height = pt.z;
}
}
}
}
if(grid_->GetPosition().y == kHeightOffset.y || grid_->GetPosition().y > height)
{
grid_->SetPosition(glm::vec3(0,height,0));
}
LOGD("compute min height %f s", time.ticks());
}
} }
+1
View File
@@ -129,6 +129,7 @@ class Scene {
void setPointSize(float size) {pointSize_ = size;} void setPointSize(float size) {pointSize_ = size;}
void setFOV(float angle); void setFOV(float angle);
void setOrthoCropFactor(float value); void setOrthoCropFactor(float value);
void setGridRotation(float angleDeg);
void setLighting(bool enabled) {lighting_ = enabled;} void setLighting(bool enabled) {lighting_ = enabled;}
void setBackfaceCulling(bool enabled) {backfaceCulling_ = enabled;} void setBackfaceCulling(bool enabled) {backfaceCulling_ = enabled;}
void setWireframe(bool enabled) {wireFrame_ = enabled;} void setWireframe(bool enabled) {wireFrame_ = enabled;}
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape>
<gradient
android:endColor="#00ffffff"
android:startColor="#ff686868"
android:useLevel="false" />
</shape>
</item>
</layer-list>
+32 -44
View File
@@ -25,7 +25,7 @@
<RelativeLayout <RelativeLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:fitsSystemWindows="true"> android:fitsSystemWindows="true">
<ToggleButton <ToggleButton
@@ -35,7 +35,7 @@
android:layout_above="@+id/light_button" android:layout_above="@+id/light_button"
android:layout_alignLeft="@+id/light_button" android:layout_alignLeft="@+id/light_button"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_marginBottom="15dp" android:layout_marginBottom="5dp"
android:layout_marginRight="5dp" android:layout_marginRight="5dp"
android:paddingRight="5dp" android:paddingRight="5dp"
android:textOff="@string/wireframe" android:textOff="@string/wireframe"
@@ -48,7 +48,7 @@
android:layout_above="@+id/backface_button" android:layout_above="@+id/backface_button"
android:layout_alignLeft="@+id/backface_button" android:layout_alignLeft="@+id/backface_button"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_marginBottom="15dp" android:layout_marginBottom="5dp"
android:layout_marginRight="5dp" android:layout_marginRight="5dp"
android:paddingRight="5dp" android:paddingRight="5dp"
android:textOff="@string/light_off" android:textOff="@string/light_off"
@@ -58,56 +58,33 @@
android:id="@+id/backface_button" android:id="@+id/backface_button"
android:layout_width="100dp" android:layout_width="100dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_above="@+id/first_person_button" android:layout_above="@+id/camera_button"
android:layout_alignLeft="@+id/first_person_button" android:layout_alignRight="@+id/camera_button"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_marginBottom="5dp" android:layout_marginBottom="15dp"
android:layout_marginRight="5dp" android:layout_marginRight="5dp"
android:paddingRight="5dp" android:paddingRight="5dp"
android:textOff="@string/backface_off" android:textOff="@string/backface_off"
android:textOn="@string/backface_on" /> android:textOn="@string/backface_on" />
<ToggleButton <com.introlab.rtabmap.NDSpinner
android:id="@+id/first_person_button" android:id="@+id/camera_button"
android:layout_width="100dp" android:layout_width="140dp"
android:layout_height="wrap_content" android:layout_height="40dp"
android:layout_above="@+id/third_person_button"
android:layout_alignLeft="@+id/third_person_button"
android:layout_alignParentRight="true"
android:layout_marginBottom="5dp"
android:layout_marginRight="5dp"
android:paddingRight="5dp"
android:textOff="@string/first_person"
android:textOn="@string/first_person" />
<ToggleButton
android:id="@+id/third_person_button"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_above="@+id/top_down_button"
android:layout_alignParentRight="true"
android:layout_marginBottom="5dp"
android:layout_marginRight="5dp"
android:paddingRight="5dp"
android:textOff="@string/third_person"
android:textOn="@string/third_person" />
<ToggleButton
android:id="@+id/top_down_button"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_marginRight="5dp" android:layout_marginRight="5dp"
android:layout_marginBottom="10dp"
android:paddingRight="5dp" android:paddingRight="5dp"
android:textOff="@string/top_down" android:paddingBottom="10dp"
android:textOn="@string/top_down" /> android:text="@string/camera_button"
android:spinnerMode="dropdown"/>
<ToggleButton <ToggleButton
android:id="@+id/pause_button" android:id="@+id/pause_button"
android:layout_width="100dp" android:layout_width="100dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignLeft="@+id/first_person_button" android:layout_marginRight="5dp"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_marginTop="61dp" android:layout_marginTop="61dp"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
@@ -135,10 +112,8 @@
android:id="@+id/close_visualization_button" android:id="@+id/close_visualization_button"
android:layout_width="200dp" android:layout_width="200dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/top_down_button" android:layout_above="@+id/camera_button"
android:layout_alignBottom="@+id/top_down_button"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:paddingLeft="5dp"
android:text="@string/close_visualization" /> android:text="@string/close_visualization" />
<SeekBar <SeekBar
@@ -146,10 +121,23 @@
android:layout_width="200dp" android:layout_width="200dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:rotation="270" android:rotation="270"
android:layout_above="@+id/light_button"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_alignBaseline="@+id/first_person_button"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginLeft="-50dp" /> android:layout_marginLeft="-50dp"
android:progressDrawable="@drawable/custom_seekbar" />
<SeekBar
android:id="@+id/seekBar_grid"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignBottom="@+id/camera_button"
android:layout_marginLeft="35dp"
android:paddingBottom="10dp"
android:progressDrawable="@drawable/custom_seekbar" />
</RelativeLayout> </RelativeLayout>
</RelativeLayout> </RelativeLayout>
+9
View File
@@ -0,0 +1,9 @@
<resources>
<string-array name="camera_view_array">
<item>First View</item>
<item>Third-P. View</item>
<item>Top View</item>
<item>Ortho View</item>
</string-array>
</resources>
+2 -4
View File
@@ -8,9 +8,7 @@
<string name="sketchfab">Upload to Sketchfab&#8230;</string> <string name="sketchfab">Upload to Sketchfab&#8230;</string>
<string name="status">"Status: "</string> <string name="status">"Status: "</string>
<string name="words">"Words: "</string> <string name="words">"Words: "</string>
<string name="first_person">First</string> <string name="camera_button">First View</string>
<string name="third_person">Third</string>
<string name="top_down">Top</string>
<string name="pause">Pause</string> <string name="pause">Pause</string>
<string name="resume">Resume</string> <string name="resume">Resume</string>
<string name="backface_on">Backface</string> <string name="backface_on">Backface</string>
@@ -36,7 +34,7 @@
<string name="memory">"Used Memory (MB): "</string> <string name="memory">"Used Memory (MB): "</string>
<string name="hypothesis">"Hypothesis (%): "</string> <string name="hypothesis">"Hypothesis (%): "</string>
<string name="fps">"FPS (rendering): "</string> <string name="fps">"FPS (rendering): "</string>
<!-- Preference keys: BEGIN --> <!-- Preference keys: BEGIN -->
<string name="pref_key_tags">pref_key_tags</string> <string name="pref_key_tags">pref_key_tags</string>
<string name="pref_default_tags">rtabmap 3dscan tango</string> <string name="pref_default_tags">rtabmap 3dscan tango</string>
@@ -0,0 +1,43 @@
package com.introlab.rtabmap;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.Spinner;
/** Spinner extension that calls onItemSelected even when the selection is the same as its previous value
Author: Mattia Ruggiero
https://stackoverflow.com/questions/5335306/how-can-i-get-an-event-in-android-spinner-when-the-current-selected-item-is-sele
*/
public class NDSpinner extends Spinner {
public NDSpinner(Context context)
{ super(context); }
public NDSpinner(Context context, AttributeSet attrs)
{ super(context, attrs); }
public NDSpinner(Context context, AttributeSet attrs, int defStyle)
{ super(context, attrs, defStyle); }
@Override
public void setSelection(int position, boolean animate) {
boolean sameSelected = position == getSelectedItemPosition();
super.setSelection(position, animate);
if (sameSelected) {
// Spinner does not call the OnItemSelectedListener if the same item is selected, so do it manually now
//getOnItemSelectedListener().onItemSelected(this, getSelectedView(), position, getSelectedItemId());
}
}
@Override
public void setSelection(int position) {
boolean sameSelected = position == getSelectedItemPosition();
super.setSelection(position);
if (sameSelected) {
// Spinner does not call the OnItemSelectedListener if the same item is selected, so do it manually now
getOnItemSelectedListener().onItemSelected(this, getSelectedView(), position, getSelectedItemId());
}
}
}
@@ -89,6 +89,9 @@ import android.view.WindowManager;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
import android.webkit.WebView; import android.webkit.WebView;
import android.webkit.WebViewClient; import android.webkit.WebViewClient;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.LinearLayout; import android.widget.LinearLayout;
@@ -96,6 +99,7 @@ import android.widget.NumberPicker;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import android.widget.SeekBar; import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener; import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import android.widget.ToggleButton; import android.widget.ToggleButton;
@@ -104,7 +108,7 @@ import com.google.atap.tangoservice.Tango;
// The main activity of the application. This activity shows debug information // The main activity of the application. This activity shows debug information
// and a glSurfaceView that renders graphic content. // and a glSurfaceView that renders graphic content.
public class RTABMapActivity extends Activity implements OnClickListener { public class RTABMapActivity extends Activity implements OnClickListener, OnItemSelectedListener {
// Tag for debug logging. // Tag for debug logging.
public static final String TAG = RTABMapActivity.class.getSimpleName(); public static final String TAG = RTABMapActivity.class.getSimpleName();
@@ -134,7 +138,6 @@ public class RTABMapActivity extends Activity implements OnClickListener {
public static final long NOTOUCH_TIMEOUT = 5000; // 5 sec public static final long NOTOUCH_TIMEOUT = 5000; // 5 sec
private boolean mHudVisible = true; private boolean mHudVisible = true;
private boolean mTipOrthoShown_ = false;
private int mSavedRenderingType = 0; private int mSavedRenderingType = 0;
private boolean mMenuOpened = false; private boolean mMenuOpened = false;
@@ -182,9 +185,7 @@ public class RTABMapActivity extends Activity implements OnClickListener {
private MenuItem mItemStatusVisibility; private MenuItem mItemStatusVisibility;
private MenuItem mItemDebugVisibility; private MenuItem mItemDebugVisibility;
private ToggleButton mButtonFirst; private NDSpinner mButtonCameraView;
private ToggleButton mButtonThird;
private ToggleButton mButtonTop;
private ToggleButton mButtonPause; private ToggleButton mButtonPause;
private ToggleButton mButtonLighting; private ToggleButton mButtonLighting;
private ToggleButton mButtonWireframe; private ToggleButton mButtonWireframe;
@@ -193,6 +194,7 @@ public class RTABMapActivity extends Activity implements OnClickListener {
private Button mButtonSaveOnDevice; private Button mButtonSaveOnDevice;
private Button mButtonShareOnSketchfab; private Button mButtonShareOnSketchfab;
private SeekBar mSeekBarFov; private SeekBar mSeekBarFov;
private SeekBar mSeekBarGrid;
private String mOpenedDatabasePath = ""; private String mOpenedDatabasePath = "";
private String mWorkingDirectory = ""; private String mWorkingDirectory = "";
@@ -267,9 +269,7 @@ public class RTABMapActivity extends Activity implements OnClickListener {
mActionBarHeight = getActionBarHeight(); mActionBarHeight = getActionBarHeight();
// Buttons for selecting camera view and Set up button click listeners. // Buttons for selecting camera view and Set up button click listeners.
mButtonFirst = (ToggleButton)findViewById(R.id.first_person_button); mButtonCameraView = (NDSpinner)findViewById(R.id.camera_button);
mButtonThird = (ToggleButton)findViewById(R.id.third_person_button);
mButtonTop = (ToggleButton)findViewById(R.id.top_down_button);
mButtonPause = (ToggleButton)findViewById(R.id.pause_button); mButtonPause = (ToggleButton)findViewById(R.id.pause_button);
mButtonLighting = (ToggleButton)findViewById(R.id.light_button); mButtonLighting = (ToggleButton)findViewById(R.id.light_button);
mButtonWireframe = (ToggleButton)findViewById(R.id.wireframe_button); mButtonWireframe = (ToggleButton)findViewById(R.id.wireframe_button);
@@ -277,9 +277,7 @@ public class RTABMapActivity extends Activity implements OnClickListener {
mButtonCloseVisualization = (Button)findViewById(R.id.close_visualization_button); mButtonCloseVisualization = (Button)findViewById(R.id.close_visualization_button);
mButtonSaveOnDevice = (Button)findViewById(R.id.button_saveOnDevice); mButtonSaveOnDevice = (Button)findViewById(R.id.button_saveOnDevice);
mButtonShareOnSketchfab = (Button)findViewById(R.id.button_shareToSketchfab); mButtonShareOnSketchfab = (Button)findViewById(R.id.button_shareToSketchfab);
mButtonFirst.setOnClickListener(this); mButtonCameraView.setOnItemSelectedListener(this);
mButtonThird.setOnClickListener(this);
mButtonTop.setOnClickListener(this);
mButtonPause.setOnClickListener(this); mButtonPause.setOnClickListener(this);
mButtonLighting.setOnClickListener(this); mButtonLighting.setOnClickListener(this);
mButtonWireframe.setOnClickListener(this); mButtonWireframe.setOnClickListener(this);
@@ -287,7 +285,6 @@ public class RTABMapActivity extends Activity implements OnClickListener {
mButtonCloseVisualization.setOnClickListener(this); mButtonCloseVisualization.setOnClickListener(this);
mButtonSaveOnDevice.setOnClickListener(this); mButtonSaveOnDevice.setOnClickListener(this);
mButtonShareOnSketchfab.setOnClickListener(this); mButtonShareOnSketchfab.setOnClickListener(this);
mButtonFirst.setChecked(true);
mButtonLighting.setChecked(false); mButtonLighting.setChecked(false);
mButtonLighting.setVisibility(View.INVISIBLE); mButtonLighting.setVisibility(View.INVISIBLE);
mButtonWireframe.setChecked(false); mButtonWireframe.setChecked(false);
@@ -300,17 +297,28 @@ public class RTABMapActivity extends Activity implements OnClickListener {
mButtonBackfaceShown.setVisibility(mItemRenderingMesh.isChecked() || mItemRenderingTextureMesh.isChecked()?View.VISIBLE:View.INVISIBLE); mButtonBackfaceShown.setVisibility(mItemRenderingMesh.isChecked() || mItemRenderingTextureMesh.isChecked()?View.VISIBLE:View.INVISIBLE);
} }
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.camera_view_array, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mButtonCameraView.setAdapter(adapter);
mButtonCameraView.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
resetNoTouchTimer();
return false;
}
});
mSeekBarFov = (SeekBar)findViewById(R.id.seekBar_fov); mSeekBarFov = (SeekBar)findViewById(R.id.seekBar_fov);
mSeekBarFov.setMax(45); mSeekBarFov.setMax(45);
mSeekBarFov.setProgress(20); mSeekBarFov.setProgress(20);
mSeekBarFov.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { mSeekBarFov.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override @Override
public void onProgressChanged(SeekBar seekBar, int progressValue, boolean fromUser) { public void onProgressChanged(SeekBar seekBar, int progressValue, boolean fromUser) {
if(mButtonFirst.isChecked()) if(mButtonCameraView.getSelectedItemPosition() == 0)
{ {
RTABMapLib.setFOV((float)progressValue+45.0f); RTABMapLib.setFOV((float)progressValue+45.0f);
} }
else if(mButtonTop.isChecked()) else if(mButtonCameraView.getSelectedItemPosition() == 3)
{ {
RTABMapLib.setOrthoCropFactor((float)(120-progressValue)/20.0f - 3.0f); RTABMapLib.setOrthoCropFactor((float)(120-progressValue)/20.0f - 3.0f);
} }
@@ -325,6 +333,25 @@ public class RTABMapActivity extends Activity implements OnClickListener {
public void onStopTrackingTouch(SeekBar seekBar) { public void onStopTrackingTouch(SeekBar seekBar) {
} }
}); });
mSeekBarGrid = (SeekBar)findViewById(R.id.seekBar_grid);
mSeekBarGrid.setMax(180);
mSeekBarGrid.setProgress(90);
mSeekBarGrid.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progressValue, boolean fromUser) {
RTABMapLib.setGridRotation(((float)progressValue-90.0f)/2.0f);
resetNoTouchTimer();
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
mToast = Toast.makeText(getApplicationContext(), "", Toast.LENGTH_SHORT); mToast = Toast.makeText(getApplicationContext(), "", Toast.LENGTH_SHORT);
@@ -714,13 +741,9 @@ public class RTABMapActivity extends Activity implements OnClickListener {
updateStatusTexts(); updateStatusTexts();
RTABMapLib.setCamera(type); RTABMapLib.setCamera(type);
mButtonFirst.setChecked(type==0); mButtonCameraView.setSelection(type, true);
mButtonThird.setChecked(type==1);
mButtonTop.setChecked(type==2 || type==3);
mButtonTop.setText(type==3?"Ortho":"Top");
mButtonTop.setTextOn(type==3?"Ortho":"Top");
mButtonTop.setTextOff(type==3?"Ortho":"Top");
mSeekBarFov.setVisibility(type!=0 && type!=3?View.INVISIBLE:View.VISIBLE); mSeekBarFov.setVisibility(type!=0 && type!=3?View.INVISIBLE:View.VISIBLE);
mSeekBarGrid.setVisibility(mSeekBarGrid.isEnabled() && type==3?View.VISIBLE:View.INVISIBLE);
if(type==0) if(type==0)
{ {
mSeekBarFov.setMax(45); mSeekBarFov.setMax(45);
@@ -731,28 +754,12 @@ public class RTABMapActivity extends Activity implements OnClickListener {
mSeekBarFov.setMax(120); mSeekBarFov.setMax(120);
mSeekBarFov.setProgress(80); mSeekBarFov.setProgress(80);
} }
if(type==2 && !mTipOrthoShown_)
{
mToast.makeText(this, "Tip: Click again on Top to set Ortho mode.", mToast.LENGTH_LONG).show();
mTipOrthoShown_ = true;
}
} }
@Override @Override
public void onClick(View v) { public void onClick(View v) {
// Handle button clicks. // Handle button clicks.
switch (v.getId()) { switch (v.getId()) {
case R.id.first_person_button:
setCamera(0);
break;
case R.id.third_person_button:
setCamera(1);
break;
case R.id.top_down_button:
setCamera(mButtonFirst.isChecked() || mButtonThird.isChecked() || mButtonTop.getTextOn().equals("Ortho")?2:3);
break;
case R.id.pause_button: case R.id.pause_button:
pauseMapping(); pauseMapping();
break; break;
@@ -792,6 +799,15 @@ public class RTABMapActivity extends Activity implements OnClickListener {
} }
resetNoTouchTimer(); resetNoTouchTimer();
} }
public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
setCamera(pos);
resetNoTouchTimer();
}
public void onNothingSelected(AdapterView<?> parent) {
resetNoTouchTimer();
}
private void setAndroidOrientation() { private void setAndroidOrientation() {
Display display = getWindowManager().getDefaultDisplay(); Display display = getWindowManager().getDefaultDisplay();
@@ -1146,9 +1162,9 @@ public class RTABMapActivity extends Activity implements OnClickListener {
} }
updateState(State.STATE_VISUALIZING_WHILE_LOADING); updateState(State.STATE_VISUALIZING_WHILE_LOADING);
if(mButtonFirst.isChecked()) if(mButtonCameraView.getSelectedItemPosition() == 0)
{ {
setCamera(1); setCamera(2);
} }
mToast.makeText(getActivity(), String.format("Optimized mesh detected in the database, it is shown while the database is loading..."), mToast.LENGTH_LONG).show(); mToast.makeText(getActivity(), String.format("Optimized mesh detected in the database, it is shown while the database is loading..."), mToast.LENGTH_LONG).show();
mProgressDialog.dismiss(); mProgressDialog.dismiss();
@@ -1438,11 +1454,10 @@ public class RTABMapActivity extends Activity implements OnClickListener {
mItemDataRecorderMode.setEnabled(mButtonPause.isChecked()); mItemDataRecorderMode.setEnabled(mButtonPause.isChecked());
break; break;
} }
mButtonFirst.setVisibility(mHudVisible?View.VISIBLE:View.INVISIBLE); mButtonCameraView.setVisibility(mHudVisible?View.VISIBLE:View.INVISIBLE);
mButtonThird.setVisibility(mHudVisible?View.VISIBLE:View.INVISIBLE);
mButtonTop.setVisibility(mHudVisible?View.VISIBLE:View.INVISIBLE);
mButtonBackfaceShown.setVisibility(mHudVisible && (mItemRenderingMesh.isChecked() || mItemRenderingTextureMesh.isChecked())?View.VISIBLE:View.INVISIBLE); mButtonBackfaceShown.setVisibility(mHudVisible && (mItemRenderingMesh.isChecked() || mItemRenderingTextureMesh.isChecked())?View.VISIBLE:View.INVISIBLE);
mSeekBarFov.setVisibility(mHudVisible && (mButtonFirst.isChecked() || (mButtonTop.isChecked() && mButtonTop.getTextOn().equals("Ortho")))?View.VISIBLE:View.INVISIBLE); mSeekBarFov.setVisibility(mHudVisible && (mButtonCameraView.getSelectedItemPosition() == 0 || mButtonCameraView.getSelectedItemPosition() == 3)?View.VISIBLE:View.INVISIBLE);
mSeekBarGrid.setVisibility(mHudVisible && mSeekBarGrid.isEnabled() && mButtonCameraView.getSelectedItemPosition() == 3?View.VISIBLE:View.INVISIBLE);
} }
private void pauseMapping() { private void pauseMapping() {
@@ -1682,6 +1697,8 @@ public class RTABMapActivity extends Activity implements OnClickListener {
else if(itemId == R.id.grid_visible) else if(itemId == R.id.grid_visible)
{ {
item.setChecked(!item.isChecked()); item.setChecked(!item.isChecked());
mSeekBarGrid.setEnabled(item.isChecked());
mSeekBarGrid.setVisibility(mHudVisible && mSeekBarGrid.isEnabled()&&mButtonCameraView.getSelectedItemPosition() == 3?View.VISIBLE:View.INVISIBLE);
RTABMapLib.setGridVisible(item.isChecked()); RTABMapLib.setGridVisible(item.isChecked());
} }
else if (itemId == R.id.save) else if (itemId == R.id.save)
@@ -2069,7 +2086,7 @@ public class RTABMapActivity extends Activity implements OnClickListener {
} }
updateState(State.STATE_VISUALIZING); updateState(State.STATE_VISUALIZING);
RTABMapLib.postExportation(true); RTABMapLib.postExportation(true);
if(mButtonFirst.isChecked()) if(mButtonCameraView.getSelectedItemPosition() == 0)
{ {
setCamera(2); setCamera(2);
} }
@@ -2441,9 +2458,9 @@ public class RTABMapActivity extends Activity implements OnClickListener {
} }
else if(!mItemTrajectoryMode.isChecked()) else if(!mItemTrajectoryMode.isChecked())
{ {
if(mButtonFirst.isChecked()) if(mButtonCameraView.getSelectedItemPosition() == 0)
{ {
setCamera(1); setCamera(2);
} }
// creating meshes... // creating meshes...
updateState(State.STATE_IDLE); updateState(State.STATE_IDLE);
@@ -80,6 +80,7 @@ public class RTABMapLib
public static native void setPointSize(float value); public static native void setPointSize(float value);
public static native void setFOV(float value); public static native void setFOV(float value);
public static native void setOrthoCropFactor(float value); public static native void setOrthoCropFactor(float value);
public static native void setGridRotation(float value);
public static native void setLighting(boolean enabled); public static native void setLighting(boolean enabled);
public static native void setBackfaceCulling(boolean enabled); public static native void setBackfaceCulling(boolean enabled);
public static native void setWireframe(boolean enabled); public static native void setWireframe(boolean enabled);
+16
View File
@@ -104,12 +104,20 @@ public:
const cv::Mat & cloud, const cv::Mat & cloud,
const std::map<int, Transform> & poses = std::map<int, Transform>(), // if we want to do localization afterward using optimized mesh const std::map<int, Transform> & poses = std::map<int, Transform>(), // if we want to do localization afterward using optimized mesh
const std::vector<std::vector<std::vector<unsigned int> > > & polygons = std::vector<std::vector<std::vector<unsigned int> > >(), // Textures -> polygons -> vertices const std::vector<std::vector<std::vector<unsigned int> > > & polygons = std::vector<std::vector<std::vector<unsigned int> > >(), // Textures -> polygons -> vertices
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
const std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > & texCoords = std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > >(), // Textures -> uv coords for each vertex of the polygons
#else
const std::vector<std::vector<Eigen::Vector2f> > & texCoords = std::vector<std::vector<Eigen::Vector2f> >(), // Textures -> uv coords for each vertex of the polygons const std::vector<std::vector<Eigen::Vector2f> > & texCoords = std::vector<std::vector<Eigen::Vector2f> >(), // Textures -> uv coords for each vertex of the polygons
#endif
const cv::Mat & textures = cv::Mat()) const; // concatenated textures (assuming square textures with all same size); const cv::Mat & textures = cv::Mat()) const; // concatenated textures (assuming square textures with all same size);
cv::Mat loadOptimizedMesh( cv::Mat loadOptimizedMesh(
std::map<int, Transform> * poses = 0, std::map<int, Transform> * poses = 0,
std::vector<std::vector<std::vector<unsigned int> > > * polygons = 0, std::vector<std::vector<std::vector<unsigned int> > > * polygons = 0,
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > * texCoords = 0,
#else
std::vector<std::vector<Eigen::Vector2f> > * texCoords = 0, std::vector<std::vector<Eigen::Vector2f> > * texCoords = 0,
#endif
cv::Mat * textures = 0) const; cv::Mat * textures = 0) const;
public: public:
@@ -219,12 +227,20 @@ private:
const cv::Mat & cloud, const cv::Mat & cloud,
const std::map<int, Transform> & poses, const std::map<int, Transform> & poses,
const std::vector<std::vector<std::vector<unsigned int> > > & polygons, const std::vector<std::vector<std::vector<unsigned int> > > & polygons,
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
const std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > & texCoords,
#else
const std::vector<std::vector<Eigen::Vector2f> > & texCoords, const std::vector<std::vector<Eigen::Vector2f> > & texCoords,
#endif
const cv::Mat & textures) const = 0; const cv::Mat & textures) const = 0;
virtual cv::Mat loadOptimizedMeshQuery( virtual cv::Mat loadOptimizedMeshQuery(
std::map<int, Transform> * poses, std::map<int, Transform> * poses,
std::vector<std::vector<std::vector<unsigned int> > > * polygons, std::vector<std::vector<std::vector<unsigned int> > > * polygons,
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > * texCoords,
#else
std::vector<std::vector<Eigen::Vector2f> > * texCoords, std::vector<std::vector<Eigen::Vector2f> > * texCoords,
#endif
cv::Mat * textures) const = 0; cv::Mat * textures) const = 0;
// Load objects // Load objects
+9
View File
@@ -42,6 +42,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "rtabmap/utilite/UStl.h" #include "rtabmap/utilite/UStl.h"
#include <opencv2/core/core.hpp> #include <opencv2/core/core.hpp>
#include <opencv2/features2d/features2d.hpp> #include <opencv2/features2d/features2d.hpp>
#include <pcl/pcl_config.h>
namespace rtabmap { namespace rtabmap {
@@ -98,12 +99,20 @@ public:
const cv::Mat & cloud, const cv::Mat & cloud,
const std::map<int, Transform> & poses = std::map<int, Transform>(), // if we want to do localization afterward using optimized mesh const std::map<int, Transform> & poses = std::map<int, Transform>(), // if we want to do localization afterward using optimized mesh
const std::vector<std::vector<std::vector<unsigned int> > > & polygons = std::vector<std::vector<std::vector<unsigned int> > >(), // Textures -> polygons -> vertices const std::vector<std::vector<std::vector<unsigned int> > > & polygons = std::vector<std::vector<std::vector<unsigned int> > >(), // Textures -> polygons -> vertices
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
const std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > & texCoords = std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > >(), // Textures -> uv coords for each vertex of the polygons
#else
const std::vector<std::vector<Eigen::Vector2f> > & texCoords = std::vector<std::vector<Eigen::Vector2f> >(), // Textures -> uv coords for each vertex of the polygons const std::vector<std::vector<Eigen::Vector2f> > & texCoords = std::vector<std::vector<Eigen::Vector2f> >(), // Textures -> uv coords for each vertex of the polygons
#endif
const cv::Mat & textures = cv::Mat()) const; // concatenated textures (assuming square textures with all same size) const cv::Mat & textures = cv::Mat()) const; // concatenated textures (assuming square textures with all same size)
cv::Mat loadOptimizedMesh( cv::Mat loadOptimizedMesh(
std::map<int, Transform> * poses = 0, std::map<int, Transform> * poses = 0,
std::vector<std::vector<std::vector<unsigned int> > > * polygons = 0, std::vector<std::vector<std::vector<unsigned int> > > * polygons = 0,
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > * texCoords = 0,
#else
std::vector<std::vector<Eigen::Vector2f> > * texCoords = 0, std::vector<std::vector<Eigen::Vector2f> > * texCoords = 0,
#endif
cv::Mat * textures = 0) const; cv::Mat * textures = 0) const;
void emptyTrash(); void emptyTrash();
void joinTrashThread(); void joinTrashThread();
+8
View File
@@ -1043,7 +1043,11 @@ void DBDriver::saveOptimizedMesh(
const cv::Mat & cloud, const cv::Mat & cloud,
const std::map<int, Transform> & poses, const std::map<int, Transform> & poses,
const std::vector<std::vector<std::vector<unsigned int> > > & polygons, const std::vector<std::vector<std::vector<unsigned int> > > & polygons,
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
const std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > & texCoords,
#else
const std::vector<std::vector<Eigen::Vector2f> > & texCoords, const std::vector<std::vector<Eigen::Vector2f> > & texCoords,
#endif
const cv::Mat & textures) const const cv::Mat & textures) const
{ {
_dbSafeAccessMutex.lock(); _dbSafeAccessMutex.lock();
@@ -1054,7 +1058,11 @@ void DBDriver::saveOptimizedMesh(
cv::Mat DBDriver::loadOptimizedMesh( cv::Mat DBDriver::loadOptimizedMesh(
std::map<int, Transform> * poses, std::map<int, Transform> * poses,
std::vector<std::vector<std::vector<unsigned int> > > * polygons, std::vector<std::vector<std::vector<unsigned int> > > * polygons,
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f>> > * texCoords,
#else
std::vector<std::vector<Eigen::Vector2f> > * texCoords, std::vector<std::vector<Eigen::Vector2f> > * texCoords,
#endif
cv::Mat * textures) const cv::Mat * textures) const
{ {
_dbSafeAccessMutex.lock(); _dbSafeAccessMutex.lock();
+12
View File
@@ -3833,7 +3833,11 @@ void DBDriverSqlite3::saveOptimizedMeshQuery(
const cv::Mat & cloud, const cv::Mat & cloud,
const std::map<int, Transform> & poses, const std::map<int, Transform> & poses,
const std::vector<std::vector<std::vector<unsigned int> > > & polygons, const std::vector<std::vector<std::vector<unsigned int> > > & polygons,
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
const std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > & texCoords,
#else
const std::vector<std::vector<Eigen::Vector2f> > & texCoords, const std::vector<std::vector<Eigen::Vector2f> > & texCoords,
#endif
const cv::Mat & textures) const const cv::Mat & textures) const
{ {
UDEBUG(""); UDEBUG("");
@@ -4049,7 +4053,11 @@ void DBDriverSqlite3::saveOptimizedMeshQuery(
cv::Mat DBDriverSqlite3::loadOptimizedMeshQuery( cv::Mat DBDriverSqlite3::loadOptimizedMeshQuery(
std::map<int, Transform> * poses, std::map<int, Transform> * poses,
std::vector<std::vector<std::vector<unsigned int> > > * polygons, std::vector<std::vector<std::vector<unsigned int> > > * polygons,
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > * texCoords,
#else
std::vector<std::vector<Eigen::Vector2f> > * texCoords, std::vector<std::vector<Eigen::Vector2f> > * texCoords,
#endif
cv::Mat * textures) const cv::Mat * textures) const
{ {
UDEBUG(""); UDEBUG("");
@@ -4158,7 +4166,11 @@ cv::Mat DBDriverSqlite3::loadOptimizedMeshQuery(
for(int t=0; t<serializedTexCoords.cols; ++t) for(int t=0; t<serializedTexCoords.cols; ++t)
{ {
UASSERT(int(serializedTexCoords.at<float>(t)) > 0); UASSERT(int(serializedTexCoords.at<float>(t)) > 0);
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > materialtexCoords(int(serializedTexCoords.at<float>(t)));
#else
std::vector<Eigen::Vector2f> materialtexCoords(int(serializedTexCoords.at<float>(t))); std::vector<Eigen::Vector2f> materialtexCoords(int(serializedTexCoords.at<float>(t)));
#endif
++t; ++t;
UASSERT(t < serializedTexCoords.cols); UASSERT(t < serializedTexCoords.cols);
UDEBUG("materialtexCoords=%d", (int)materialtexCoords.size()); UDEBUG("materialtexCoords=%d", (int)materialtexCoords.size());
+10 -2
View File
@@ -91,8 +91,8 @@ private:
const cv::Point3f & viewpoint) const; const cv::Point3f & viewpoint) const;
virtual void updateDepthImageQuery( virtual void updateDepthImageQuery(
int nodeId, int nodeId,
const cv::Mat & image) const; const cv::Mat & image) const;
virtual void addStatisticsQuery(const Statistics & statistics) const; virtual void addStatisticsQuery(const Statistics & statistics) const;
virtual void savePreviewImageQuery(const cv::Mat & image) const; virtual void savePreviewImageQuery(const cv::Mat & image) const;
@@ -101,12 +101,20 @@ private:
const cv::Mat & cloud, const cv::Mat & cloud,
const std::map<int, Transform> & poses, const std::map<int, Transform> & poses,
const std::vector<std::vector<std::vector<unsigned int> > > & polygons, const std::vector<std::vector<std::vector<unsigned int> > > & polygons,
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
const std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > & texCoords,
#else
const std::vector<std::vector<Eigen::Vector2f> > & texCoords, const std::vector<std::vector<Eigen::Vector2f> > & texCoords,
#endif
const cv::Mat & textures) const; const cv::Mat & textures) const;
virtual cv::Mat loadOptimizedMeshQuery( virtual cv::Mat loadOptimizedMeshQuery(
std::map<int, Transform> * poses, std::map<int, Transform> * poses,
std::vector<std::vector<std::vector<unsigned int> > > * polygons, std::vector<std::vector<std::vector<unsigned int> > > * polygons,
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > * texCoords,
#else
std::vector<std::vector<Eigen::Vector2f> > * texCoords, std::vector<std::vector<Eigen::Vector2f> > * texCoords,
#endif
cv::Mat * textures) const; cv::Mat * textures) const;
// Load objects // Load objects
+8
View File
@@ -1671,7 +1671,11 @@ void Memory::saveOptimizedMesh(
const cv::Mat & cloud, const cv::Mat & cloud,
const std::map<int, Transform> & poses, const std::map<int, Transform> & poses,
const std::vector<std::vector<std::vector<unsigned int> > > & polygons, const std::vector<std::vector<std::vector<unsigned int> > > & polygons,
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
const std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f> > > & texCoords,
#else
const std::vector<std::vector<Eigen::Vector2f> > & texCoords, const std::vector<std::vector<Eigen::Vector2f> > & texCoords,
#endif
const cv::Mat & textures) const const cv::Mat & textures) const
{ {
if(_dbDriver) if(_dbDriver)
@@ -1683,7 +1687,11 @@ void Memory::saveOptimizedMesh(
cv::Mat Memory::loadOptimizedMesh( cv::Mat Memory::loadOptimizedMesh(
std::map<int, Transform> * poses, std::map<int, Transform> * poses,
std::vector<std::vector<std::vector<unsigned int> > > * polygons, std::vector<std::vector<std::vector<unsigned int> > > * polygons,
#if PCL_VERSION_COMPARE(>=, 1, 8, 0)
std::vector<std::vector<Eigen::Vector2f, Eigen::aligned_allocator<Eigen::Vector2f>> > * texCoords,
#else
std::vector<std::vector<Eigen::Vector2f> > * texCoords, std::vector<std::vector<Eigen::Vector2f> > * texCoords,
#endif
cv::Mat * textures) const cv::Mat * textures) const
{ {
if(_dbDriver) if(_dbDriver)