how to calculate variance of the different blocks of an image
2 views (last 30 days)
Show older comments
respected sir / madam
i have a question that how to make partition of an image in to blocks of the size decided dynamically means the size may vary dependent on some condition(like a dynamic window ).
i am trying mat2cell function but because of the size(height , width ) may come in fraction too, it doesn't work .
eg. image size is (295x500), if the block size comes, on sm condition, 9.83 x 12.5 .In this case if we use round , ceil or floor function the whole pixel will not be cover and the function mat2cell will give error
??? Error using ==> mat2cell at 116 Input arguments, D1 through D2, must sum to each dimension of the input matrix size, [295 500].
kindly guide me some guidance to overcome this problem.
thanks .
Actually i want to make block on matrix and after that i want to calculate the variance for each block.
1 Comment
Answers (2)
Image Analyst
on 14 Dec 2012
As I understand it, blockproc works only with uniformly sized blocks, not blocks that change their size on a location-by-location basis. Perhaps you could pass in the largest possible block and the information for what size to reduce the block to and then the function could crop down the block and use just a smaller chunk of it. Would that work for you? What criteria do you have that makes the block change size from pixel to pixel? Does the block size at each location depend on the intensity at that location or something?
6 Comments
Image Analyst
on 15 Dec 2012
Edited: Image Analyst
on 15 Dec 2012
I think this section of the FAQ applies here: http://matlab.wikia.com/wiki/FAQ?&cb=5688#Can_you_program_up_the_algorithm_in_this_article_for_me_and_explain_it_to_me.3F, not to mention the fact that I don't want to pay $31.50 to read the article. Good luck with it though. It looks like it might be a useful algorithm.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!