From: Kris zenitis on
Hello to everybody and thank in advance. I have some pictures and i want to divide them into blocks of 9x9. I have found that blockproc can help me for this task but my problem that i can t understand how does work. I wrote to matlab something like that I2 = blockproc(J,[9 9],fun); where J is my picture and then i received the message :

??? Attempt to reference field of non-structure array.

Error in ==> blockproc at 70
firstBlock = feval(fun,x,params{:});

Any idea??
From: ImageAnalyst on
Kris:
I don't know if that will work. What is fun? Maybe you can try it
like this demo I have for splitting up the standard gray scale demo
image up into 8 by 8 chunks:

clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear all; % Erase all existing variables.
workspace; % Make sure the workspace panel is showing.
fontSize = 12;

% Change the current folder to the folder of this m-file.
% (The line of code below is from Brett Shoelson of The Mathworks.)
if(~isdeployed)
cd(fileparts(which(mfilename)));
end

% Read in standard MATLAB grayscale demo image.
grayImage = imread('cameraman.tif');
subplot(8, 9, 1);
imshow(grayImage, []);
title('Original Grayscale Image', 'FontSize', 8);
set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.

[rows columns numberOfColorBands] = size(grayImage)
counter = 1;
for col = 1:32:columns
for row = 1:32:rows
subImage{counter} = grayImage(row:row+31, col:col+31);
subplot(8,9,counter+1);
imshow(subImage{counter});
caption = sprintf('Block #%d', counter);
title(caption, 'FontSize', fontSize);
counter = counter + 1;
end
end
From: Ashish Uthama on
On Mon, 12 Apr 2010 21:38:03 -0300, Kris zenitis <gio.1988(a)hotmai.com>
wrote:

> Hello to everybody and thank in advance. I have some pictures and i want
> to divide them into blocks of 9x9. I have found that blockproc can help
> me for this task but my problem that i can t understand how does work. I
> wrote to matlab something like that I2 = blockproc(J,[9 9],fun); where J
> is my picture and then i received the message :
>
> ??? Attempt to reference field of non-structure array.
>
> Error in ==> blockproc at 70
> firstBlock = feval(fun,x,params{:});
>
> Any idea??

Can you tell/show us the code for the function handle 'fun' ?
From: Ashish Uthama on
On Mon, 12 Apr 2010 21:41:05 -0300, Kris zenitis <gio.1988(a)hotmai.com>
wrote:

> Hello to everybody and thank in advance. I have some pictures and i want
> to divide them into blocks of 9x9. I have found that blockproc can help
> me for this task but my problem that i can t understand how does work. I
> wrote to matlab something like that I2 = blockproc(J,[9 9],fun); where J
> is my picture and then i received the message :
>
> ??? Attempt to reference field of non-structure array.
>
> Error in ==> blockproc at 70
> firstBlock = feval(fun,x,params{:});
>
> Any idea??

my guess is that your code in the function handle fun is "??? Attempting
to reference field of non-structure array." :)

like so perhaps:

>> a=1:10

a =

1 2 3 4 5 6 7 8 9 10

>> a.g
??? Attempt to reference field of non-structure array.