mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-01 17:10:26 +08:00
Tango: added gain radius and min cluster size parameters
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<fileset dir="${srcdir}/libs" includes="**/*.jar" excludes="**/*sources.jar, **/*javadoc.jar" />
|
||||
</copy>
|
||||
<copy todir="${native.libs.dir}/${android.abi}">
|
||||
<fileset dir="${srcdir}/libs-c" includes="**/*.so"/>
|
||||
<fileset dir="${srcdir}/jni/third-party/lib" includes="**/*.so"/>
|
||||
</copy>
|
||||
</target>
|
||||
</project>
|
||||
@@ -57,7 +57,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <pcl/surface/vtk_smoothing/vtk_mesh_quadric_decimation.h>
|
||||
|
||||
|
||||
const int g_minPolygonClusterSize = 200;
|
||||
const int g_exportedMeshId = -100;
|
||||
|
||||
static JavaVM *jvm;
|
||||
@@ -140,6 +139,8 @@ RTABMapApp::RTABMapApp() :
|
||||
meshDecimation_(1),
|
||||
meshTrianglePix_(1),
|
||||
meshAngleToleranceDeg_(15.0),
|
||||
minClusterSize_(200),
|
||||
maxGainRadius_(0.02f),
|
||||
paused_(false),
|
||||
dataRecorderMode_(false),
|
||||
clearSceneOnNextRender_(false),
|
||||
@@ -823,7 +824,8 @@ int RTABMapApp::Render()
|
||||
}
|
||||
}
|
||||
|
||||
rtabmap::GainCompensator compensator;
|
||||
UASSERT(maxGainRadius_>0.0f);
|
||||
rtabmap::GainCompensator compensator(maxGainRadius_);
|
||||
if(clouds.size() > 1 && links.size())
|
||||
{
|
||||
compensator.feed(clouds, indices, links);
|
||||
@@ -866,7 +868,7 @@ int RTABMapApp::Render()
|
||||
notifyDataLoaded = true;
|
||||
}
|
||||
|
||||
if(filterPolygonsOnNextRender_)
|
||||
if(filterPolygonsOnNextRender_ && minClusterSize_>0)
|
||||
{
|
||||
LOGI("Polygon filtering...");
|
||||
filterPolygonsOnNextRender_ = false;
|
||||
@@ -885,7 +887,7 @@ int RTABMapApp::Render()
|
||||
vertexToPolygons);
|
||||
std::list<std::list<int> > clusters = rtabmap::util3d::clusterPolygons(
|
||||
neighbors,
|
||||
g_minPolygonClusterSize);
|
||||
minClusterSize_);
|
||||
std::vector<pcl::Vertices> filteredPolygons(iter->second.polygons.size());
|
||||
int oi=0;
|
||||
for(std::list<std::list<int> >::iterator jter=clusters.begin(); jter!=clusters.end(); ++jter)
|
||||
@@ -1132,7 +1134,17 @@ void RTABMapApp::setMeshAngleTolerance(float value)
|
||||
|
||||
void RTABMapApp::setMeshTriangleSize(int value)
|
||||
{
|
||||
meshTrianglePix_ = value;
|
||||
meshTrianglePix_ = value;
|
||||
}
|
||||
|
||||
void RTABMapApp::setMinClusterSize(int value)
|
||||
{
|
||||
minClusterSize_ = value;
|
||||
}
|
||||
|
||||
void RTABMapApp::setMaxGainRadius(float value)
|
||||
{
|
||||
maxGainRadius_ = value;
|
||||
}
|
||||
|
||||
int RTABMapApp::setMappingParameter(const std::string & key, const std::string & value)
|
||||
@@ -1588,7 +1600,7 @@ bool RTABMapApp::exportMesh(
|
||||
textureMesh->tex_polygons.pop_back();
|
||||
textureMesh->tex_materials.pop_back();
|
||||
|
||||
if(g_minPolygonClusterSize>0)
|
||||
if(minClusterSize_>0)
|
||||
{
|
||||
LOGI("Filter small polygon clusters...");
|
||||
|
||||
@@ -1617,7 +1629,7 @@ bool RTABMapApp::exportMesh(
|
||||
vertexToPolygons);
|
||||
std::list<std::list<int> > clusters = rtabmap::util3d::clusterPolygons(
|
||||
neighbors,
|
||||
g_minPolygonClusterSize);
|
||||
minClusterSize_);
|
||||
|
||||
std::set<int> validPolygons;
|
||||
for(std::list<std::list<int> >::iterator kter=clusters.begin(); kter!=clusters.end(); ++kter)
|
||||
|
||||
@@ -131,6 +131,8 @@ class RTABMapApp : public UEventsHandler {
|
||||
void setMeshDecimation(int value);
|
||||
void setMeshAngleTolerance(float value);
|
||||
void setMeshTriangleSize(int value);
|
||||
void setMinClusterSize(int value);
|
||||
void setMaxGainRadius(float value);
|
||||
int setMappingParameter(const std::string & key, const std::string & value);
|
||||
|
||||
void resetMapping();
|
||||
@@ -179,6 +181,8 @@ class RTABMapApp : public UEventsHandler {
|
||||
int meshDecimation_;
|
||||
int meshTrianglePix_;
|
||||
float meshAngleToleranceDeg_;
|
||||
int minClusterSize_;
|
||||
float maxGainRadius_;
|
||||
|
||||
rtabmap::ParametersMap mappingParameters_;
|
||||
|
||||
|
||||
@@ -246,6 +246,18 @@ Java_com_introlab_rtabmap_RTABMapLib_setMeshTriangleSize(
|
||||
{
|
||||
return app.setMeshTriangleSize(value);
|
||||
}
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_introlab_rtabmap_RTABMapLib_setMinClusterSize(
|
||||
JNIEnv*, jobject, int value)
|
||||
{
|
||||
return app.setMinClusterSize(value);
|
||||
}
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_introlab_rtabmap_RTABMapLib_setMaxGainRadius(
|
||||
JNIEnv*, jobject, float value)
|
||||
{
|
||||
return app.setMaxGainRadius(value);
|
||||
}
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_introlab_rtabmap_RTABMapLib_setMappingParameter(
|
||||
JNIEnv* env, jobject, jstring key, jstring value)
|
||||
|
||||
@@ -186,9 +186,25 @@
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
</PreferenceCategory>
|
||||
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/pref_title_general">
|
||||
|
||||
<ListPreference
|
||||
android:key="@string/pref_key_gain_max_radius"
|
||||
android:title="@string/pref_title_gain_max_radius"
|
||||
android:summary="@string/pref_summary_gain_max_radius"
|
||||
android:entries="@array/pref_gain_max_radius_keys"
|
||||
android:entryValues="@array/pref_gain_max_radius_values"
|
||||
android:defaultValue="@string/pref_default_gain_max_radius"/>
|
||||
<ListPreference
|
||||
android:key="@string/pref_key_min_cluster_size"
|
||||
android:title="@string/pref_title_min_cluster_size"
|
||||
android:summary="@string/pref_summary_min_cluster_size"
|
||||
android:entries="@array/pref_min_cluster_size_values"
|
||||
android:entryValues="@array/pref_min_cluster_size_values"
|
||||
android:defaultValue="@string/pref_default_min_cluster_size"/>
|
||||
|
||||
<Preference android:title="@string/pref_title_reset_button"
|
||||
android:key="@string/pref_key_reset_button"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
@@ -57,6 +57,9 @@
|
||||
<string name="pref_key_opt_decimation_factor">pref_key_opt_decimation_factor</string><string name="pref_default_opt_decimation_factor">80</string>
|
||||
<string name="pref_key_opt_color_radius">pref_key_opt_color_radius</string> <string name="pref_default_opt_color_radius">0.0</string>
|
||||
<string name="pref_key_opt_clean_white">pref_key_opt_clean_white</string> <string name="pref_default_opt_clean_white">true</string>
|
||||
|
||||
<string name="pref_key_gain_max_radius">pref_key_gain_max_radius</string> <string name="pref_default_gain_max_radius">0.02</string>
|
||||
<string name="pref_key_min_cluster_size">pref_key_min_cluster_size</string> <string name="pref_default_min_cluster_size">200</string>
|
||||
<!-- Preference keys: END-->
|
||||
|
||||
<string name="pref_title_rendering">Rendering</string>
|
||||
@@ -413,6 +416,37 @@
|
||||
</string-array>
|
||||
|
||||
<string name="pref_title_general">General</string>
|
||||
|
||||
<string name="pref_title_gain_max_radius">Color Correction Radius</string>
|
||||
<string name="pref_summary_gain_max_radius">Radius used to find pixel correspondences for color correction.</string>
|
||||
<string name="pref_title_min_cluster_size">Min Cluster Size</string>
|
||||
<string name="pref_summary_min_cluster_size">Minimum number of polygons for a cluster to be kept after Noise Filtering optimization.</string>
|
||||
|
||||
<string-array name="pref_gain_max_radius_keys">
|
||||
<item>"0.3 m"</item>
|
||||
<item>"0.2 m"</item>
|
||||
<item>"0.1 m"</item>
|
||||
<item>"0.05 m"</item>
|
||||
<item>"0.02 m"</item>
|
||||
<item>"0.01 m"</item>
|
||||
</string-array>
|
||||
<string-array name="pref_gain_max_radius_values">
|
||||
<item>"0.3"</item>
|
||||
<item>"0.2"</item>
|
||||
<item>"0.1"</item>
|
||||
<item>"0.05"</item>
|
||||
<item>"0.02"</item>
|
||||
<item>"0.01"</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="pref_min_cluster_size_values">
|
||||
<item>"500"</item>
|
||||
<item>"200"</item>
|
||||
<item>"100"</item>
|
||||
<item>"50"</item>
|
||||
<item>"10"</item>
|
||||
</string-array>
|
||||
|
||||
<string name="pref_title_reset_button">Restore All Default Settings</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -283,6 +283,9 @@ public class RTABMapActivity extends Activity implements OnClickListener {
|
||||
RTABMapLib.setPointSize(Float.parseFloat(sharedPref.getString(getString(R.string.pref_key_point_size), getString(R.string.pref_default_point_size))));
|
||||
RTABMapLib.setMeshAngleTolerance(Float.parseFloat(sharedPref.getString(getString(R.string.pref_key_angle), getString(R.string.pref_default_angle))));
|
||||
RTABMapLib.setMeshTriangleSize(Integer.parseInt(sharedPref.getString(getString(R.string.pref_key_triangle), getString(R.string.pref_default_triangle))));
|
||||
|
||||
RTABMapLib.setMinClusterSize(Integer.parseInt(sharedPref.getString(getString(R.string.pref_key_min_cluster_size), getString(R.string.pref_default_min_cluster_size))));
|
||||
RTABMapLib.setMaxGainRadius(Float.parseFloat(sharedPref.getString(getString(R.string.pref_key_gain_max_radius), getString(R.string.pref_default_gain_max_radius))));
|
||||
|
||||
if(mItemRenderingPointCloud != null)
|
||||
{
|
||||
|
||||
@@ -77,6 +77,8 @@ public class RTABMapLib
|
||||
public static native void setMeshDecimation(int value);
|
||||
public static native void setMeshAngleTolerance(float value);
|
||||
public static native void setMeshTriangleSize(int value);
|
||||
public static native void setMinClusterSize(int value);
|
||||
public static native void setMaxGainRadius(float value);
|
||||
public static native int setMappingParameter(String key, String value);
|
||||
|
||||
public static native void resetMapping();
|
||||
|
||||
@@ -48,6 +48,8 @@ public class SettingsActivity extends PreferenceActivity implements OnSharedPref
|
||||
((Preference)findPreference(getString(R.string.pref_key_opt_decimation_factor))).setSummary("("+((ListPreference)findPreference(getString(R.string.pref_key_opt_decimation_factor))).getValue() + "%%) "+getString(R.string.pref_summary_opt_decimation_factor));
|
||||
((Preference)findPreference(getString(R.string.pref_key_opt_color_radius))).setSummary("("+((ListPreference)findPreference(getString(R.string.pref_key_opt_color_radius))).getEntry() + ") "+getString(R.string.pref_summary_opt_color_radius));
|
||||
|
||||
((Preference)findPreference(getString(R.string.pref_key_min_cluster_size))).setSummary("("+((ListPreference)findPreference(getString(R.string.pref_key_min_cluster_size))).getEntry() + ") "+getString(R.string.pref_summary_min_cluster_size));
|
||||
((Preference)findPreference(getString(R.string.pref_key_gain_max_radius))).setSummary("("+((ListPreference)findPreference(getString(R.string.pref_key_gain_max_radius))).getEntry() + ") "+getString(R.string.pref_summary_gain_max_radius));
|
||||
}
|
||||
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||
@@ -73,6 +75,9 @@ public class SettingsActivity extends PreferenceActivity implements OnSharedPref
|
||||
if(key.compareTo(getString(R.string.pref_key_opt_depth))==0) pref.setSummary("("+((ListPreference)pref).getEntry() + ") "+getString(R.string.pref_summary_opt_depth));
|
||||
if(key.compareTo(getString(R.string.pref_key_opt_decimation_factor))==0) pref.setSummary("("+((ListPreference)pref).getValue() + "%%) "+getString(R.string.pref_summary_opt_decimation_factor));
|
||||
if(key.compareTo(getString(R.string.pref_key_opt_color_radius))==0) pref.setSummary("("+((ListPreference)pref).getEntry() + ") "+getString(R.string.pref_summary_opt_color_radius));
|
||||
|
||||
if(key.compareTo(getString(R.string.pref_key_min_cluster_size))==0) pref.setSummary("("+((ListPreference)pref).getEntry() + ") "+getString(R.string.pref_summary_min_cluster_size));
|
||||
if(key.compareTo(getString(R.string.pref_key_gain_max_radius))==0) pref.setSummary("("+((ListPreference)pref).getEntry() + ") "+getString(R.string.pref_summary_gain_max_radius));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user