Hello,

I have to solve a real world problem; it is:

There are 2 black-white rectangular images (each one kept in 2d array, 0/1 as black/white).
First rectangular has A and B as its sides.
Second rectangular has C and D as its sides. C is less than A and D is less than B.

I want to place the second rectangular into the first one with the least overlaped pixels. (the second regtangular can be placed exceedingly the bound of the larger reg., but it is worse than overlaped pixel)

With a brute-force algorithm, it tries to generate the smaller images in all top-left co-ordinates in C x D and determine overlaped pixels and exceeded pixels; and return the best top-left co-ordinate.
Approximately, the algorithm takes A x B x C x D comparisons.

Do anyone know other better solutions?

--
$_=`perldoc -U -q "What is a"`;m/"(.*?)"/;print$1



_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to