First, I want to divide binary image into 8 by 8 block.Second I want to perform rowise logical AND(1st AND 2nd,2nd AND 3rd .....so on ) and from that results i want to do XOR.Please help me with matlab code.
1 view (last 30 days)
Show older comments
kaavya subramani
on 28 Jul 2015
Commented: kaavya subramani
on 28 Jul 2015
suppose i have 8 rows ,i need to do logical AND for first and second row,then second and third .....then neglect same vectors using unique,from that remaining vectors i want to do overall XOR.
0 Comments
Accepted Answer
Walter Roberson
on 28 Jul 2015
ur = unique(block(1:end-1) | block(2:end), 'rows');
uxor = mod(sum(ur,1),2);
You might notice that I did not use explicit xor() here. When you have a vector of binary values, xor is 0 if the sum of the vector is even, and xor is 1 if the sum of the vector is odd. (For xor, 0 do not change the result, but every 1 toggles the result, so even numbers of 1's toggle the result back to 0 and odd numbers of 1's leave it at 1)
5 Comments
Walter Roberson
on 28 Jul 2015
I = blockproc(pp, [8 8], @feature_xor, 'PadPartialBlocks', true);
but you need to decide what you want to have happen when you divide your image that is not a multiple of 8 wide or tall, into blocks that are 8 wide and tall. What do you want to have happen on the border blocks?
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!