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

add hdiff option #62

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CSFDemo/CSFDemo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ int main(int argc,char* argv[])
cfg.readConfigFile("params.cfg", "time_step", time_step);
std::string terr_pointClouds_filepath;
cfg.readConfigFile("params.cfg", "terr_pointClouds_filepath", terr_pointClouds_filepath);
std::string height_diff_threshold;
cfg.readConfigFile("params.cfg", "height_diff_threshold", height_diff_threshold);

CSF csf;
//step 1 Input the point cloud
Expand All @@ -78,6 +80,7 @@ int main(int argc,char* argv[])
csf.params.interations = atoi(iterations.c_str());
csf.params.rigidness = atoi(rigidness.c_str());
csf.params.time_step = atof(time_step.c_str());
csf.params.height_diff_threshold = atof(height_diff_threshold.c_str());

//step3 do filtering
std::vector<int> groundIndexes, offGroundIndexes;
Expand Down
3 changes: 2 additions & 1 deletion CSFDemo/params.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ cloth_resolution=0.5
rigidness=3
iterations=500
class_threshold=0.5
time_step=0.65
time_step=0.65
height_diff_threshold=0.3
1 change: 1 addition & 0 deletions python/CSF/CSF.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@ class Params(object):
cloth_resolution = property(_CSF.Params_cloth_resolution_get, _CSF.Params_cloth_resolution_set)
rigidness = property(_CSF.Params_rigidness_get, _CSF.Params_rigidness_set)
interations = property(_CSF.Params_interations_get, _CSF.Params_interations_set)
height_diff_threshold = property(_CSF.Params_height_diff_threshold_get, _CSF.Params_height_diff_threshold_set)

def __init__(self):
_CSF.Params_swiginit(self, _CSF.new_Params())
Expand Down
56 changes: 55 additions & 1 deletion python/CSF/CSF_wrap.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -5614,7 +5614,7 @@ SWIG_AsVal_bool (PyObject *obj, bool *val)
return success;
}

/* Require the given PyArrayObject to to be Fortran ordered. If the
/* Require the given PyArrayObject to be Fortran ordered. If the
* the PyArrayObject is already Fortran ordered, do nothing. Else,
* set the Fortran ordering flag and recompute the strides.
*/
Expand Down Expand Up @@ -14242,6 +14242,58 @@ SWIGINTERN PyObject *_wrap_Params_interations_get(PyObject *SWIGUNUSEDPARM(self)
}


SWIGINTERN PyObject *_wrap_Params_height_diff_threshold_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
Params *arg1 = (Params *) 0 ;
double arg2 ;
void *argp1 = 0 ;
int res1 = 0 ;
double val2 ;
int ecode2 = 0 ;
PyObject *swig_obj[2] ;

if (!SWIG_Python_UnpackTuple(args, "Params_height_diff_threshold_set", 2, 2, swig_obj)) SWIG_fail;
res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Params, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Params_height_diff_threshold_set" "', argument " "1"" of type '" "Params *""'");
}
arg1 = reinterpret_cast< Params * >(argp1);
ecode2 = SWIG_AsVal_double(swig_obj[1], &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Params_height_diff_threshold_set" "', argument " "2"" of type '" "double""'");
}
arg2 = static_cast< double >(val2);
if (arg1) (arg1)->height_diff_threshold = arg2;
resultobj = SWIG_Py_Void();
return resultobj;
fail:
return NULL;
}


SWIGINTERN PyObject *_wrap_Params_height_diff_threshold_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
Params *arg1 = (Params *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject *swig_obj[1] ;
double result;

if (!args) SWIG_fail;
swig_obj[0] = args;
res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Params, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Params_height_diff_threshold_get" "', argument " "1"" of type '" "Params *""'");
}
arg1 = reinterpret_cast< Params * >(argp1);
result = (double) ((arg1)->height_diff_threshold);
resultobj = SWIG_From_double(static_cast< double >(result));
return resultobj;
fail:
return NULL;
}


SWIGINTERN PyObject *_wrap_new_Params(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
Params *result = 0 ;
Expand Down Expand Up @@ -15194,6 +15246,8 @@ static PyMethodDef SwigMethods[] = {
{ "Params_rigidness_get", _wrap_Params_rigidness_get, METH_O, NULL},
{ "Params_interations_set", _wrap_Params_interations_set, METH_VARARGS, NULL},
{ "Params_interations_get", _wrap_Params_interations_get, METH_O, NULL},
{ "Params_height_diff_threshold_set", _wrap_Params_height_diff_threshold_set, METH_VARARGS, NULL},
{ "Params_height_diff_threshold_get", _wrap_Params_height_diff_threshold_get, METH_O, NULL},
{ "new_Params", _wrap_new_Params, METH_NOARGS, NULL},
{ "delete_Params", _wrap_delete_Params, METH_O, NULL},
{ "Params_swigregister", Params_swigregister, METH_O, NULL},
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

setup(
name="cloth_simulation_filter",
version="1.1.5",
version="1.1.6",
author="Jianbo Qi",
url="http://ramm.bnu.edu.cn/projects/CSF/",
long_description=readme_content,
Expand Down
6 changes: 4 additions & 2 deletions src/CSF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ CSF::CSF(int index) {
params.cloth_resolution = 1;
params.rigidness = 3;
params.interations = 500;
params.height_diff_threshold = 0.3;

this->index = index;
}
Expand All @@ -43,7 +44,8 @@ CSF::CSF() {
params.cloth_resolution = 1;
params.rigidness = 3;
params.interations = 500;
this->index = 0;
params.height_diff_threshold = 0.3;
this->index = 0;
}

CSF::~CSF()
Expand Down Expand Up @@ -140,7 +142,7 @@ Cloth CSF::do_cloth() {
height_num,
params.cloth_resolution,
params.cloth_resolution,
0.3,
params.height_diff_threshold,
9999,
params.rigidness,
params.time_step
Expand Down
1 change: 1 addition & 0 deletions src/CSF.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ struct Params {
double cloth_resolution;
int rigidness;
int interations;
double height_diff_threshold;
};

#ifdef _CSF_DLL_EXPORT_
Expand Down