I have two images A and B of size 200x400. Pixels(cell values) in both images will have values that range from 1-20 only. A is the correct image which have the correct values in each pixel. What I want to do is to check the pixels in image A having each value (1-20) and compare it to the corresponding values in image B. So for example, I will check the pixels in image A which has the value 1, then will check those pixels in image B and check what values (1-20) those pixels have. Then will do the same thing for the rest of the values (2-20). After that, I want to save the confusion matrix of the result in matrix C.
So if A is like this:
2 3 4 5 6 7 8
4 1 1 1 1 1 3
3 1 1 1 1 1 6
6 1 1 1 1 1 4
6 1 1 1 1 1 2
2 3 4 5 6 7 8
and B is like this:
2 3 4 5 6 7 8
4 2 1 1 4 1 3
3 4 1 8 1 1 6
6 1 2 7 1 1 4
6 1 1 5 4 1 2
2 3 4 5 6 7 8
and I want to check the pixels with value 1 in image A with the same pixels in matrix B. The this means that the pixels that I'm gonna work with are this box of 1's in image A and the corresponding pixels in image B.
And C would look like this (will only fill the row of the 1 as this is what I gave the simple example):
1 2 3 4 5 6 7 8 9 ... 20
1 12 2 0 3 1 0 1 1 0 ...
2
3
4
5
6
7
8
9
.
.
.
20
so as you can in image A there were 20 pixels having the value 1 but the corresponding pixels in image B has 12 ones, 2 twos, 3 fours, 1 five, 1 seven and 1 eight.
So this matrix C will be filled row by row with the number of occurrences of each of the column number in the row number pixels.
So if anyone could please advise how this can be done in Matlab, also please let me know if any more clarification needed.
Aucun commentaire:
Enregistrer un commentaire