PyMaxflow icon indicating copy to clipboard operation
PyMaxflow copied to clipboard

It would be very helpful to add examples for maxflow.fastmin module...

Open hellokenlee opened this issue 9 years ago • 3 comments

Thank you so much for writing this package! The documentation is great in the maxflow part. But it's a little confusing in the maxflow.fastmin part... It would be great if you can improve the documentation on this part. Thank you again.

hellokenlee avatar Apr 07 '16 13:04 hellokenlee

I made a minimal example Here. Hope it helps.

CrisDamian avatar May 07 '18 09:05 CrisDamian

Hi! I have a question about the 2-D matrix V. In the example you provided, the values of V are the same for all pixels. But sometimes, for different pixels, the neighborhood cost should be different, and I think that each pixel in an image should be corresponding to a V. are the values of V fixed for all pixels in this module?

zhangwenyuan0926 avatar Dec 03 '19 07:12 zhangwenyuan0926

Hi @zhangwenyuan0926,

are the values of V fixed for all pixels in this module?

Unfortunately yes, they are fixed. I wrote the fastmin module a long time ago and I didn't keep it updated with the rest of the API. The good news is that the C++ implementations for aexpansion_grid_step and abswap_grid_step are unnecessary now, and they can be easily implemented in Python with the new API (or so I want to believe). I am planning to update this in the future and get rid of the old C++ fastmin implementation.

In the meantime, you can just reuse the implementation of aexpansion_grid (or abswap_grid) from fastmin.py and write your own aexpansion_grid_step (or abswap_grid_step) that builds the graph using the neighborhood costs you want.

Sorry for the inconvenience. I will fix this as soon as I have time.

pmneila avatar Dec 03 '19 16:12 pmneila