Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int nnsLoop(int M, int N, Matrix& Scene, Matrix& Waldo, int L, int highest, int xBlock, int yBlock)
- {
- for (int a = 0; a < M-49; a+=1) //for loop to cycle through every block in the large wally scene and perform ssd
- {
- for (int b = 0; b < N-36; b+=1)
- {
- Matrix SceneLarge = Scene.splitScene(a, b); //create a matrix to use the scene data
- int ssd = 0; //creating a variable for ssd (sum of square diff)
- Matrix value = SceneLarge - Waldo; //find the difference
- Matrix value2 = value * value; //square the value
- for (int m = 0; m < L; m++)
- {
- ssd += value2._data[m];
- }
- if (ssd < highest) //looking for the smallest value
- {
- highest = ssd;
- xBlock = a;
- yBlock = b;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment