Getting pixel value from Picture object is incredibly slow
I am trying to create my own custom image comparison algorithm. The first, what I thought, simple step would be to iterate over the each pixel in each image and compare them. This however is so slow that I have yet to wait long enough for it to finish. Is this a known issue? Any alternative ideas instead of using the builtin TC picture object to get the pixel data?
My images are fairly large, 2000 x 2000 but this still seems way slower than it should be.
function test()
{
var pic1 = Utils["Picture"]
pic1["LoadFromFile"]("C:\\Users\\testaccount\\Documents\\Test\\Static.png")
var pic2 = Utils["Picture"]
pic2["LoadFromFile"]("C:\\Users\\testaccount\\Documents\\Test\\newTest.png")
CompareImage(pic1,pic2)
}
function CompareImage(pic1,pic2)
{
var totalErrors = 0;
var width = pic1["Size"]["Width"]
var height = pic1["Size"]["Height"]
for(var i=0; i<width;i++){
for(var j=0; j<height; j++){
if(pic1.Pixels(i,j) != pic2.Pixels(i,j))
totalErrors++;
}
}
}