I'm trying to fit a line model from a pointcloud. I'm using pcl 1.9.1. And I'm facing this error :
[pcl::RandomSampleConsensus::computeModel] No samples could be selected
[pcl::SACSegmentation::segment] Error segmenting the model! No solution found.
The pointclouds I want to use are like this one :
https://drive.google.com/file/d/1qLrVjplmqT_SdFUXaZCYAkWHtYVEoTKR/view?usp=sharing
The code I'm using is almost the exact same as the tutorial's one (https://pcl.readthedocs.io/projects/tutorials/en/latest/planar_segmentation.html#planar-segmentation):
pcl::ModelCoefficients::Ptr coefficients (new pcl::ModelCoefficients);
pcl::PointIndices::Ptr inliers (new pcl::PointIndices);
// Create the segmentation object
pcl::SACSegmentation<pcl::PointXYZ> seg;
// Optional
seg.setOptimizeCoefficients (true);
// Mandatory
seg.setModelType (pcl::SACMODEL_LINE);
seg.setMethodType (pcl::SAC_RANSAC);
seg.setDistanceThreshold (0.1);
seg.setInputCloud (m_Lcloud);
seg.segment (*inliers, *coefficients);
The only difference is the fact I want to use a line model instead of a plane one. I don't know what is happening because I saw several people doing the same and not facing this problem. I didn't see the error in this context on any topic.
My pointcloud is not so big (like 300 points) but I don't think that's the problem. I already tried to make it bigger (just added symmetrics or things like this) but same error.
The threshold is also not the problem (I think). I tried a lot of these and normally with 0.1 it should be good.
Maybe it's my version of PCL that have a problem. If someone with a latest version could try, I would appreciate.
I'm posting here because the pcl forum doesn't seem to be still active. So sorry if this shouldn't be here.
Thanks to anyone who takes some time for helping me !
Related
First time question here, tx in advance.
I am trying to use code from opencv tutorial that use the fisherface algorithim.
I am able to create the fisherface model and train it,detect faces but fail on the recognition part model->predict.
I am also pretty new to C++ and trying to debug this problem myself but I guess I still need help here.
Jumping in at line model->predict(face_im)
I get to the following line of code in operations.hpp and fail immediately without any description of the error.
template<typename _Tp> inline _Tp* Ptr<_Tp>::operator -> () { return obj; }
executing this line jumps back out to the main and breaks with error
Access violation reading location 0x00000019.
agh, I hope this is not to vague but how can i analyze my problem here?
Again tx in advance and if more info is needed ..sure thing
Et
I've come to a conclusion; it was a scoping problem. By moving the declaration out of main, I was able to get it to work fine.
I guess it was very vague. It's still a bit unclear to me, but I suppose I need to brush up on my C++.
Migrating some code from VTK 5.10 to 6.1, I have several code pieces like this:
vtkSmartPointer<vtkImageData> img = vtkSmartPointer<vtkImageData>::New();
// ... initialize img somehow, e.g. copy from other image:
img->DeepCopy(otherImg);
img->SetInformation(otherImg->getInformation());
// the problematical statement:
img->Update();
At the call to Update(), the compiler now complains that there isn't such a function (anymore).
The migration site from VTK doesn't really tell me too much about that - I believe this falls into the section Removal of Data Objects’ Dependency on the Pipeline , but as it's no Algorithm which is filling my image, I can't call update on an algorithm.
Similar goes for custom-filled vtkPolyData objects.
My question now is: Is the call to Update not necessary (anymore?), can I just remove it? Or by what would I need to replace it?
I have to say I'm relatively new to vtk, so if there's something fundamentally simple that I'm missing I'd be glad if you could point it out to me!
I think you've been meaning to call Modified() on your image rather than Update().
Apparently they already answered your question on VTK:
http://www.vtk.org/Wiki/VTK/VTK_6_Migration/Removal_of_Update
I am not sure how you are supposed to control a player character in Bullet. The methods that I read were to use the provided btKinematicCharacterController. I also saw methods that use btDynamicCharacterController from the demos. However, in the manual it is stated that kinematic controller has several outstanding issues. Is this still the preferred path? If so, are there any tutorials or documentations for this? All I found are snippets of code from the demo, and the usage of controllers with Ogre, which I do not use.
If this is not the path that should be tread, then someone point me to the correct solution. I am new to bullet and would like a straightforward, easy solution. What I currently have is hacked together bits of a btKinematicCharacterController.
This is the code I used to set up the controller:
playerShape = new btCapsuleShape(0.25, 1);
ghostObject= new btPairCachingGhostObject();
ghostObject->setWorldTransform(btTransform(btQuaternion(0,0,0,1),btVector3(0,20,0)));
physics.getWorld()->getPairCache()->setInternalGhostPairCallback(new btGhostPairCallback());
ghostObject->setCollisionShape(playerShape);
ghostObject->setCollisionFlags(btCollisionObject::CF_CHARACTER_OBJECT);
controller = new btKinematicCharacterController(ghostObject,playerShape,0.5);
physics.getWorld()->addCollisionObject(ghostObject,btBroadphaseProxy::CharacterFilter, btBroadphaseProxy::StaticFilter|btBroadphaseProxy::DefaultFilter);
physics.getWorld()->addAction(controller);
This is the code I use to access the controller's position:
trans = controller->getGhostObject()->getWorldTransform();
camPosition.z = trans.getOrigin().z();
camPosition.y = trans.getOrigin().y()+0.5;
camPosition.x = trans.getOrigin().x();
The way I control it is through setWalkDirection() and jump() (if canJump() is true).
The issue right now is that the character spazzes out a little, then drops through the static floor. Clearly this is not intended. Is this due to the lack of a rigid body? How does one integrate that?
Actually, now it just falls as it should, but then slowly sinks through the floor.
I have moved this line to be right after the dynamic world is created
physics.getWorld()->getPairCache()->setInternalGhostPairCallback(new btGhostPairCallback());
It is now this:
broadphase->getOverlappingPairCache()->setInternalGhostPairCallback(new btGhostPairCallback());
I am also using a .bullet file imported from blender, if that is relevant.
The issue was with the bullet file, which has since been fixed(the collision boxes weren't working). However, I still experience jitteryness, unable to step up occasionally, instant step down from to high a height, and other issues.
My answer to this question here tells you what worked well for me and apparently also for the person who asked.
Avoid ground collision with Bullet
The character controller implementations in bullet are very "basic" unfortunately.
To get good character controller, you'll need to invest this much.
I'm working on a game for android using Cocos2D-android and when I'm trying to use the CCQuadParticleSystem class, the CTOR just returns null. I spent hours searching for an example or a tutorial on this and all I found was other people asking about the same exact thing. It just returns null. I have my .plist file in my assets folder - the same file which is working just great with Cocos2D-X and IOS. According to the good people at github.com it should work so I must be doing something wrong but like I said... it just returns null when I call the CTOR with or without casting:
CCQuadParticleSystem p1 = (CCQuadParticleSystem) CCQuadParticleSystem.particleWithFile("fire.plist");
CCParticleSystem p2 = CCQuadParticleSystem.particleWithFile("fire.plist");
Please, anyone ???
if It's of use, this is the .plist file I'm working with
Have a look on this example :
link for plist
you'll get the way how to handle plist file .
Can somebody point me in the right direction of how to draw a multiple lines that seem connected? I found vtkLine and its SetPoint1 and SetPoint2 functions. Then I found vtkPolyLine, but there doesn't seem to be any add, insert or set function for this. Same for vtkPolyVertex.
Is there a basic function that allows me to just push some point at the end of its internal data and the simply render it? Or if there's no such function/object, what is the way to go here?
On a related topic: I don't like vtk too much. Is there a visualization toolkit, maybe with limited functionality, that is easier to use?
Thanks in advance
For drawing multiple lines, you should first create a vtkPoints class that contains all the points, and then add in connectivity info for the points you would like connected into lines through either vtkPolyData or vtkUnstructuredGrid (which is your vtkDataSet class; a vtkDataSet class contains vtkPoints as well as the connectivity information for these points). Once your vtkDataSet is constructued, you can take the normal route to render it (mapper->actor->renderer...)
For example:
vtkPoints *pts = vtkPoints::New();
pts->InsertNextPoint(1,1,1);
...
pts->InsertNextPoint(5,5,5);
vtkPolyData *polydata = vtkPolyData::New();
polydata->Allocate();
vtkIdType connectivity[2];
connectivity[0] = 0;
connectivity[1] = 3;
polydata->InsertNextCell(VTK_LINE,2,connectivity); //Connects the first and fourth point we inserted into a line
vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
mapper->SetInput(polydata);
// And so on, need actor and renderer now
There are plenty of examples on the documentation site for all the classes
Here is vtkPoints : http://www.vtk.org/doc/release/5.4/html/a01250.html
If you click on the vtkPoints (Tests) link, you can see the tests associated with the class. It provides a bunch of different sample code.
Also, the vtk mailing list is probably going to be much more useful than stack overflow.