From: Masha on
"Gary " <uk_robo(a)hotmail.com> wrote in message <ho3ufc$faa$1(a)fred.mathworks.com>...
> Hi i can get blkproc to work but when i use the following blockproc code nothing is returned after processing. I.e. a : empty 0x0 double
>
> fun = @FunctionaName;
>
> for i=1:300
> % get the current frame
> currentFrame = mov(i).cdata;
> frame = currentFrame(:,:,3);
>
> % block processing on the image
> a = blockproc(frame,[8 8],fun,'BorderSize',[4 4]);
> result(i,:) = transpose(a(:));
> end
>
>
> however if i do
> ...
> a=blkproc(frame,[8 8],[4 4] ,fun);
>
> it works fine.
>
> What am I missing here? I want my code to work in future versions of matlab thats why i want to use blockproc.
>
> Cheers,
>
> Gary
-------------------
Hi,

I had similar problem. The solution is that in "fun" you need to refer to "frame" as struct so in "func" use "frame.cdata" instead of frame.
for example, take a simple case:
fun = @(x) sum(x(:));
res = blkproc(im,[100,100],fun);
if you want to use blockproc, change func to: func = @(x) sum(x.cdata(:)); and it will work.

Hope it helps,
Masha
 | 
Pages: 1
Prev: 3d bar from scattered data
Next: problem