Blockproc vs blkproc problem

  • Follow


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
0
Reply Gary 3/21/2010 1:58:04 AM

On Sat, 20 Mar 2010 21:58:04 -0400, Gary  <uk_robo@hotmail.com> wrote:

> 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 Gary,

Could you show us the function signature of 'FunctionName'?
0
Reply Ashish 3/22/2010 12:41:28 PM


"Gary " <uk_robo@hotmail.com> wrote in message <ho3ufc$faa$1@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
0
Reply Masha 4/22/2010 12:26:06 PM

2 Replies
688 Views

(page loaded in 0.075 seconds)

Similiar Articles:





7/23/2012 6:31:07 AM


Reply: