python - finding canvas boundary of a photo frame -
have photo frame 1 above. starting center, how u find rectangle maximum area can used draw (all pixels in rectangle must rgb(255,255,255)?
i need find x , y coordinate of point , b shown in picture.
one of approach this: starting center, , expand boundary graph above. not sure how write loop(s) that.
you should use flood fill algorithm: link. suggest use sets store pixels altered in set; way number of recursions done can reduced.
edit: didn't read question well. still, flood fill used, if used it on circle expanded.
- start single pixel, center of circle.
- set radius lager 1 unit.
- find pixels within circle, colours using flood fill.
- if same color, goto 2. if not, have radius finding rectangle next.
this algorithm may give possible solution, there may more one, depending on frame - should start developing using simple frame correctness of solution can judged easily.
edit: based on comment, problem find largest area axis-parallel rectangle in polygon - , luckily there paper on this: here. doesn't easy task though.
Comments
Post a Comment