I'd like to cut several circular parts (Px) out of a big image (A) and compare them pixel by pixel to same sized round portions (Qx) of another big image (B) using resemble.js (or similar, but I did not find anything else which seems suitable) to get a factor of similarity.
Update: With the "factor of similarity" I mean the average of the color distance (length of rgb vector between both pixels) of one pixel of Px to the corresponding pixel of Qx. If both images are exactly the same then the images are 100% identical, factor would be 1. If they are identical but one is inverted, they are 0% identical because each pixel has the maximum possible color distance to the corresponding one of the image to compare. In this case, the factor would be 0.
The aim is to find the Px which fits best Qx at any orientation (5 degrees rotation steps), and to replace Qx with Px in the final image at the best fitting angle.
Imagine some kind of photo mosaic. I want to reassamble a given image by circular smaller images that are all in a big image for conveniance. First I have to cut them out, then place them on the photo in a hex grid manner. The challenge is to find which fits best at which position and in what orientation.
I am usually a C# backend developer, my JavaScript knowledge is pretty basic. If it is not neccessary to cut out images at all and my approach is not like an experienced JS frontend developer would do that, please say so. Thanks for all answers and comments in advance!