0
$\begingroup$

I want to select a random sub-block of 8x8 out of an image 256x256. Is there an instruction that do this thing or i need to calculate it with a different approach. I found how to choose a galois field array out of a matrix but i think this is not in my case what i need.

$\endgroup$
2
$\begingroup$
r = randi(256-7);
c = randi(256-7);

subblock = I(r:r+7, c:c+7);
$\endgroup$
  • 2
    $\begingroup$ Very elegant! Just to be picky: it should be $\tt{randi(256-7)}$ and $\tt{I(r:r+7, c:c+7)}$. $\endgroup$ – Matt L. May 18 '13 at 12:51
  • $\begingroup$ d'oh.. yes... :) (edited) $\endgroup$ – geometrikal May 18 '13 at 12:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.