Closed JDWarner closed 9 years ago
@stefanv if this looks good to you, I think it's ready to merge on my end.
Allowing "sliding" borders for MCP was a capital idea!
This looks great, Josh! I think it would be good to add a way to export the final image to jpeg.
Done!
Don't merge quite yet, I'm going to simplify the MCP path seeds because the sliding border work so well.
Ruh roh, I found another challenge - to fix it requires tweaking the MCP cost function. Think I've got a fix.
@stefanv I think my work is done here!
The new cost array building function is necessary. I couldn't find any way to simplify it further. The results are now excellent and robust.
Basically, because the area surrounding the diff intersection was penalized so strongly, if the intersection border wasn't parallel with the top/bottom borders, the minimum-cost paths made a beeline to the corner nearest the border. This became evident when I allowed them to slide freely across the entire side. The new function gives slightly longer paths appropriate "breaks" in cost to be equally attractive.
Remind me again why the area outside the diff is penalized?
If not, the MCP finds the trivial solution by skirting the entire diff region.
I guess the question should be whether the correct constant background cost could save us all the effort.
No constant background will work this well; in that case you always have a contest between distance from the edge vs. quality of overlap. The MCP will choose essentially the midpoint between these, often resulting in visible exposure differences from vignetting. Trying to minimize this involves lowering the constant background toward the limit of zero... but you'll never get there; at some point it will snap to the trivial solution.
The only way to make it robustly choose the best path is to eliminate distance from the edge as a factor.
@JDWarner How about if we use a distance transform as computed by scipy.ndimage.distance_transform_edt
?
@stefanv I tried the various distance transforms. The distance function alone cannot be used, as it makes the incentive to go for the nearest corner even stronger.
If you forge ahead, they all suffer from two big problems:
It ends up being harder and more complicated than doing it the right way.
@JDWarner https://github.com/JDWarner How about if we use a distance transform as computed by scipy.ndimage.distance_transform_edt?
— Reply to this email directly or view it on GitHub https://github.com/scikit-image/skimage-demos/pull/4#issuecomment-104061650 .
I am worried that this part of the tutorial will go right over people's heads. Let's give it one more "thinking try", and if we cannot come up with any ideas over the next day or to, merge it as-is.
Updated the notebook. I simplified and improved the readability (or split) several dense cells. One of the sections in the costs function was extraneous, and now it's removed.
There is no better way to do this I know of. It does look simpler now. This (95452f4) is the version included in skimage-tutorials/pulls/17.
Great work--since I can't come up with a simpler way, let's use this one. And you get to explain it to the attendees :)
Take a look, @stefanv - the minimum cost path method to stitch images together works very well.
No more need for Enblend!
I limited the long axis on these pictures (which I have listed as CC-BY 4.0 right now, but could be persuaded to move to CC0) to 720 pixels. They're under 2MB in total, and ORB features take about 6 seconds total to extract from either set on my machine.