python - finding canvas boundary of a photo frame -


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.

proposed algorithm

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.

  1. start single pixel, center of circle.
  2. set radius lager 1 unit.
  3. find pixels within circle, colours using flood fill.
  4. 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

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -