Thread Subject: Blockproc vs blkproc problem

Subject: Blockproc vs blkproc problem

From: Gary

Date: 21 Mar, 2010 01:58:04

Message: 1 of 3

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

Subject: Blockproc vs blkproc problem

From: Ashish Uthama

Date: 22 Mar, 2010 12:41:28

Message: 2 of 3

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'?

Subject: Blockproc vs blkproc problem

From: Masha

Date: 22 Apr, 2010 12:26:06

Message: 3 of 3

"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

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
blockproc blkproc Gary 20 Mar, 2010 21:59:04
rssFeed for this Thread

Contact us at files@mathworks.com