04-17-2015, 03:24 PM
I think I see what you mean. Take the images and lay them out onto neat rows with a label. Yeah, I think I could do that.
As to the above question of how Palomine locates the closest color, I've come to realize that no matter how you slice it up, creating a one-dimensional array of colors just isn't gonna cut it. Color is three-dimensional, and I have to treat it as such, so I'm changing the color distance to actually use 3D distance.
Also, a lil snippet of Tigestion's code. I'm gonna make it open-source anyway, but if anyone using SDL needs a way to ensure two images match, here ya go:
This checks that two images are of the same size, then if that check works, it checks that all pixels are the same color. Because Tigestion needs to check every new tile against every saved tile, it may seem slower as it goes through the list, but this is normal behaviour, and shouldn't be worried about. Though, if you end up with the same exact image, just skewed in a funny way, chances are you used a JPEG or something.
As to the above question of how Palomine locates the closest color, I've come to realize that no matter how you slice it up, creating a one-dimensional array of colors just isn't gonna cut it. Color is three-dimensional, and I have to treat it as such, so I'm changing the color distance to actually use 3D distance.
Also, a lil snippet of Tigestion's code. I'm gonna make it open-source anyway, but if anyone using SDL needs a way to ensure two images match, here ya go:
Code:
bool imageMatch(img* A, img* B){
//Check that they're the same size
int w = A->w, h = A->h;
if(A->w != B->w || A->h != B->h) return 0;
//Check each pixel
bool isDiff = 0;
for(int i = 0; i < w; i++){
for(int j = 0; j < h; j++){
if(getPixel(A, i, j) != getPixel(B, i, j)) isDiff = 1;
if(isDiff) break;
};
if(isDiff) break;
};
//Return the test result
return !isDiff;
};