i want to resize an RGB image from 512X512 to 256X256 + i want to divide it into 4 equal blocks and take each block and change it from RGB to HSV, all of this using blockproc function or if you can tell me another effective way, here is my code in matlab:
f= imread ('lena_rgb.tiff');h= rgb2hsv(f);fun = @(block_struct) imresize(block_struct.data,h);I2 = blockproc(f,[2 2],fun);figure(1),imshow(f);figure(2),imshow(I2);
i had all these errors:
??? Function BLOCKPROC encountered an error while evaluating the user supplied function handle,FUN.The cause of the error was:Error using ==> imresize>scaleOrSize at 393Invalid scale or size input argument.Error in ==> imresize>parsePreMethodArgs at 364[scale, output_size] = scaleOrSize(next, next_arg);Error in ==> imresize>parseInputs at 257[params.A, params.map, params.scale, params.output_size] = ...Error in ==> imresize at 141params = parseInputs(varargin{:});Error in ==> @(block_struct)imresize(block_struct.data,h)Error in ==> blockprocFunDispatcher at 14 output_block = fun(block_struct);Error in ==> blockprocInMemory at 71[ul_output fun_nargout] = blockprocFunDispatcher(fun,block_struct,...Error in ==> blockproc at 248 result_image = blockprocInMemory(a,block_size,fun,border_size,...Error in ==> ff4 at 12I2 = blockproc(f,[2 2],fun);
Best Answer