graphics - Algorithm to find the coordinates of a corner in a simple image -


i have bitmap 2 large blocks of colors intersect, , find intersection of these 2 blocks.

enter image description here

note not know actual geometry of 2 shapes, because raw pixel data.

is there algorithm use this?

if have pixel data in memory (which i'd assume do, major sticking point) , there 2 distinct colours, should need run horizontal scanline find point rgb changes colour x colour y (note may need run scanline few times, in case it's no worse o(height)).
simple graph traversal (bfs or dfs) continue walk down line (you should need 3 points , you'll able form geometric line equation a*x + b*y + c = 0 (assuming it's not curve)).
repeat scanline vertically (again, worst case it's o(width)). find 3 points , you'll have 2 lines d*x + e*y + f = 0. using little bit of comp. geom, intersection of these 2 lines give point.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -