need to make a function which reads each pixel in a 2x2 block of an image
Afficher commentaires plus anciens
I have actually tried to divide my image into 2x2 blocks. After retreiving each block, have run a loop upto the total number of 2x2 blocks. Now , in each block, i need to call a function which is going to read all 4 pixels , one by one so that i can apply conditions accordingly..
Réponses (1)
Titus Edelhofer
le 20 Juil 2011
Hi Ankita,
the simplest would be to loop on all blocks
A = ... % your image
lastRow = 2 * (floor(size(A,1)-1)/2);
lastCol = 2 * (floor(size(A,2)-1)/2);
for i=1:2:lastRow
for j=1:2:lastCol
yourBlock = A([i i+1], [j j+1]);
end
end
There are probably more elegant ways to do the same, but that should be a good (and simple) start ... Titus
Catégories
En savoir plus sur Neighborhood and Block Processing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!