doubt on using blkproc functiom
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
hai i am working with matlab R2009a and i have to move a window of size[30,700] over the image and calculate the sum of pixels inside the window
the problem is my image is having NaN values and and i am using the blkproc function to make the window move over my image and i got a matrix of size 21X700 with NAN values is my answer correct please some one help me
and my coding is this
figure ,imshow(final2); [width, height] = size(final2); fun=@sum; B=blkproc(final2,[30 height],fun);
0 commentaires
Réponses (2)
Andrei Bobrov
le 2 Sep 2011
variant
B=blkproc(final2,[30 height],@(x)sum(x(~isnan(x))));
OR
B=blockproc(final2,[30 height],@(block_struct)sum(block_struct.data(~isnan(block_struct.data))));
add variant
B=blkproc(final2,[30 height],@(x)sum(x(~isnan(x)&~isinf(x))))
3 commentaires
Bjorn Gustavsson
le 2 Sep 2011
Replace sum with nansum in your call to blkproc. If you dont have the statistics toolbox you can look for nansum in the file exchange - I've found at least one statistics-related toolbox there that includes a number of nan-safe functions.
HTH
0 commentaires
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!