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

Does an LMSolver equivalent exist in OpenCvSharp? #1634

Open
jmoleary opened this issue Dec 23, 2023 · 0 comments
Open

Does an LMSolver equivalent exist in OpenCvSharp? #1634

jmoleary opened this issue Dec 23, 2023 · 0 comments

Comments

@jmoleary
Copy link

jmoleary commented Dec 23, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant