I have to work on a method called extract feature which has to check for the pattern i pass to the method in the matrix I pass
This is an example pattern = {{0,100,0},{255,255,255},{0,100,0}};
Though I pass any different pattern it has to check for that pattern in the matrix and make that matrix to zero where the pattern is found and return 1.
The following is the code that I have which is almost complete. But the problem is with the pattern matching which is kinda difficult to write.
Can any one give me some hints to complete the code.
public static int extractFeature(int[][] pattern, int[][] matrix) {
int patternFound = 0;
int rowp = pattern.length;
int colump = pattern[0].length;
for(int i = 0; i < 10; i++ ){
for(int j = 0; j < 10; j++){
for(int l = 0; l<rowp; l++{
for(int k = 0; k < colump; k++){
if(matrix[i][j] == pattern[l][k]);
{
......
}
}
}
}
}
for(int i = 0; i < 10; i++ ){
for(int j = 0; j < 10; j++){
System.out.print(matrix[i][j] + "\t");
}
System.out.println("");
}
return patternFound;
}
Thanks in advance. any help is appreciated