I have got a sample images and a set of other images with which i want to compare the first image. So I am drawing both of them to a canvas and checking if they are same.
i have used the concept here: Compare two Images in JavaScript
The problem is the images are rotated at a random angle. so the base64 value of the images doesn’t seem to match with each other.
NOTE:I have no way to calculate the angles and trial and error is too resource consuming
match=-1;
for(i=0;i<7;i++)
{
context1.drawImage(img,xPos[i],5,width[i],height,0,0,width[i],height);;
if(canvas1.toDataURL()==samplecanvas.toDataURL()){
match=i+1;
break;
}
context1.clearRect(0, 0, canvas1.width, canvas1.height);
}
In the above code i am iterating through images. I am given sample image at samplecanvas and canvas1 is where i draw my list of images. then i want to compare them. But i dont know how.
How can i compare two images which are rotated in different direction at random angles using JavaScript?
Can i compare colours?