matlab - How to calculate variance of an image patch with vectorization -


i have 560*560*3 image file, want divide image many small 8*8 patches, calculate variance of each patch. vectorized way calculate variance of each image patch matlab or octave?

you can use nfilter function:

  fun = @var;   b = nlfilter(a, [8 8], fun); 

by way, if wanted 3x3 image patches, use stdfilt function . left apply square on image:

  s = stdfilt(im);   s = s.*s; 

Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -