Replace std::time with std::random_device as seed for random number generator#5824
Conversation
|
Hi, could you please explain why it is necessary to repeat the detection multiple times? On the same cloud? I am not sure I understand the use case. |
|
Yes, I repeat the detection with the same cloud. The algorithm detects an initial valid solution (isModelValid returns true) with computeModel, but after optimizeModelCoefficients the obtained model is invalid (isModelValid returns false) given my constraints. Thus, I try multiple times to obtain an optimized valid model. |
|
Which model is that? We should probably take a look at that behaviour |
|
It is the cylinder model. That happens because the CylinderOptimizationFunctor used in optimizeModelCoefficientsCylinder does not use the parameters constraints (Axis, EpsAngle and RadiusLimits). |
mvieth
left a comment
There was a problem hiding this comment.
Thanks!
Yeah, would we nice if we could use constrained optimization in the cylinder model (and other models), but I don't think Eigen offers that. I am just a bit surprised that some "valid" models are still "valid" after optimization and some are not.
std::time produces the same seed during the same second. This is a problem if you need to repeat the detection multiple times consecutively.