opencvsharp
opencvsharp copied to clipboard
Does an LMSolver equivalent exist in OpenCvSharp?
Summary of your issue
I have been migrating some older C++ OpenCv code to C# using OpenCvSharp on Windows. But I have hit a roadblock on how to migrate some code that uses class called cv::LMSolver
. The code creates a callback and a "solver" and then "runs" it.
Does anything like this exist in OpenCvSharp? Maybe under another name?
As you can probably guess, my experience with OpenCV is limited. But my experience with both languages is extensive. I have adapted a lot of older C++ code to C# and have written C++/CLI bridges when I could not do that.
Environment
.NET 8.0, Visual Studio 2022 17.8.3 Windows 11
What did you do when you faced the problem?
Downloaded the git repo and went searching through it for some sort of equivalent. I see many classes that derive from Algorithm
but nothing that looks like LMSolver
Example code:
// Some code declares a class derived from LM::Solver::Callback
class LSQNonLinearCb : public cv::LMSolver::Callback { ... }
// And then later, this code uses it.
cv::Mat _dsts;
cv::vconcat(dsts, _dsts);
cv::Ptr<LSQNonLinearCb> callback = cv::makePtr<LSQNonLinearCb>(src, _dsts, sizeH, margin, selectPixels, grid);
cv::Ptr<LSQNonLinear> solver = cv::makePtr<LSQNonLinear>(callback, maxIter, epsx, epsf);
solver->run(parameters);
Output:
What did you intend to be?
I just want to be able to build first. Then I'll compare output of the old code to the new to ensure I've migrated it correctly.