Question: I would like to understand this C++ code better so I can present a pseudocode about it... // A possible solution... // Compares Image X
I would like to understand this C++ code better so I can present a pseudocode about it...
// A possible solution...
// Compares Image X into Image Y using dynamic programming
// each image has I rows, X has J comumns and Y has K columns
// returns 1 if images are similar and 0 otherwise
Algorithm. ImageCompare(X,Y,I,J,K, thresh)
SortingObject = HeapSort(s);
sortedS = SortingObject.sortedList;
map_from_sortedS_to_s = sortedS.reverseMap;
int minVal = 0;
for i: = 1 to I do{ //iterate through the rows of the images
D[0][...] = 0s; //initialize Distance Matrix
D[...][0] = 0,1,2,..., k;
for j: = 1 to J do{
for k: = 1 to k do{ //iterate through j,k entry and compute D[j][k]
if X[i][j]== Y[i][k]{
line 1 = D[j-1, k-1];
else
line 1 = D[j-1,k-1] + 1;
} //end if statement
line 2 = D[j-1][k];
line 3 = D[j][k-1];
D[j][k] = min(line1, line2,line3);
}end //for end for statement
}end for //for end for statement
minVal = minVal + min(D[J][]);
}end for //for end for statement
return P;
}end
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
