Prev: LMS
Next: medical image registration
From: Walter Roberson on 28 Jul 2010 14:29 Julia Weidner wrote: > blockproc('image1.tif', [10 10], @(block_struct) > imresize(block_struct.data, .5), 'Destination', 'newimage.tif') > I have successfully saved my newimage to a folder in my directory but > now I want to know other things about my picture (like the average RGB > values) but all blockproc does is save an image. What if I wanted to > create a hsitogram of Red values for the image? How would I go about > doing this?! I am not clear from your question as to whether you want to apply those to the old image or to the processed image? If your blocks are all the same size and you do not have any 0 padding happening, then To find average RGB values, T = blockproc(TheImageFile, [10 10], @(v) mean(reshape(v.data,[],3))); and then (I speculate here), mean([ reshape(T(:,1:3:end),[],1), ... reshape(T(:,2:3:end),[],1), ... reshape(T(:,3:3:end),[],1) ]) This is speculation because I do not have a release new enough to support blockproc, so I do not know the exact format that would be returned from the call. It is also speculation that specifying the blocksize as [10 10] will give you a 10 x 10 x 3 matrix of RGB values. Histogramming... more tricky. Are the RGB values in the range [0,1] or are they uint8 or uint16 ?
From: Ashish Uthama on 28 Jul 2010 16:41 Julia, Here is a very relevant demo :) http://www.mathworks.com/products/image/demos.html?file=/products/demos/shipping/images/ipexblockprocstats.html It is a bit more involved that a function handle, but it should either give you ideas to do large data processing yourself. Or at least a template for you to copy to create the histogram.
|
Pages: 1 Prev: LMS Next: medical image registration |