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

Is it possible to make the class GCGraph available outside GrabCut? #12445

Open
romanc opened this issue Sep 6, 2018 · 2 comments
Open

Is it possible to make the class GCGraph available outside GrabCut? #12445

romanc opened this issue Sep 6, 2018 · 2 comments

Comments

@romanc
Copy link

romanc commented Sep 6, 2018

This is a feature request, not a bug.

System information (version)
  • OpenCV =>3.3.1
  • Operating System / Platform => Windows
  • Compiler => MSVC 1914
Detailed description

I'd like to use the max-flow/min-cut algorithm, which is used in GrabCut. It would be nice, if we could move gcgraph.hpp from the source directory to the header files. This would make the class GCGraph and its function maxflow() available outside GrabCut.

Steps to reproduce

(not applicable)

@alalek
Copy link
Member

alalek commented Sep 6, 2018

In general, public interfaces should be:

  • reliable for changes (including optimizations)
  • minimal
  • not expose internal details

"As is" GCGraph doesn't satisfy these requirements.
Also it is template-based class, that make things slightly worse ("TWeight" can be restricted to double, float, int types).
So some extra design work is required here.

Also public functionality requires tests.

@romanc
Copy link
Author

romanc commented Sep 6, 2018

I see. This make a lot of sense to me. Let me propose something different then. How about adding a new function

cv::maxFlow(InputArray img, InputOutputArray mask, Point source, Point sink)

which would create a GCGraph , run maxFlow() on it and write the output again to the given mask?

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

No branches or pull requests

2 participants