Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: slide 3x3 box over image to read values

Subject: slide 3x3 box over image to read values

From: fas

Date: 8 May, 2008 04:18:37

Message: 1 of 11

I want to slide a 3x3 box over the image to read the values in that
3x3 box , Any ideas please ?

Subject: slide 3x3 box over image to read values

From: jay vaughan

Date: 8 May, 2008 04:32:02

Message: 2 of 11

Your description was vague, but I think you might want
something like a convolution of your image with a 3x3 of
ones. If so, use the function conv2.

%A = your image
B = ones(3,3);
C = conv(A,B,'same');

fas <faisalmufti@gmail.com> wrote in message
<7ec8e451-c6db-4bf1-9ed0-a5e6d39a4f8f@a9g2000prl.googlegroups.com>...
> I want to slide a 3x3 box over the image to read the
values in that
> 3x3 box , Any ideas please ?

Subject: slide 3x3 box over image to read values

From: Richard Brown

Date: 8 May, 2008 04:35:44

Message: 3 of 11

On May 8, 4:18=A0pm, fas <faisalmu...@gmail.com> wrote:
> I want to slide a 3x3 box over the image to read the values in that
> 3x3 box , Any ideas please ?

imtool?

Subject: slide 3x3 box over image to read values

From: fas

Date: 8 May, 2008 04:43:50

Message: 4 of 11

On May 8, 2:35 pm, Richard Brown <rgbr...@gmail.com> wrote:
> On May 8, 4:18 pm, fas <faisalmu...@gmail.com> wrote:
>
> > I want to slide a 3x3 box over the image to read the values in that
> > 3x3 box , Any ideas please ?
>
> imtool?

No I do not want to do convolution. I want to read the values of a A
matrix( not image to be precise) in a 3x3 window
e.g
A=rand(10,10);
data{1}=A(1:3,1:3);
next time I want to read
data{2}=A(1:3,2:4);
and so on till all the matrix has been read

Subject: slide 3x3 box over image to read values

From: Steve Carano

Date: 8 May, 2008 15:34:17

Message: 5 of 11

On May 7, 10:43 pm, fas <faisalmu...@gmail.com> wrote:
> On May 8, 2:35 pm, Richard Brown <rgbr...@gmail.com> wrote:
>
> > On May 8, 4:18 pm, fas <faisalmu...@gmail.com> wrote:
>
> > > I want to slide a 3x3 box over the image to read the values in that
> > > 3x3 box , Any ideas please ?
>
> > imtool?
>
> No I do not want to do convolution. I want to read the values of a A
> matrix( not image to be precise) in a 3x3 window
> e.g
> A=rand(10,10);
> data{1}=A(1:3,1:3);
> next time I want to read
> data{2}=A(1:3,2:4);
> and so on till all the matrix has been read

Unless I'm mistaken in what you're looking for, check the
documentation for blkproc.

Subject: slide 3x3 box over image to read values

From: Steve Carano

Date: 8 May, 2008 16:24:36

Message: 6 of 11

On May 8, 9:34 am, Steve Carano <scara...@earthlink.net> wrote:
> On May 7, 10:43 pm, fas <faisalmu...@gmail.com> wrote:
>
>
>
> > On May 8, 2:35 pm, Richard Brown <rgbr...@gmail.com> wrote:
>
> > > On May 8, 4:18 pm, fas <faisalmu...@gmail.com> wrote:
>
> > > > I want to slide a 3x3 box over the image to read the values in that
> > > > 3x3 box , Any ideas please ?
>
> > > imtool?
>
> > No I do not want to do convolution. I want to read the values of a A
> > matrix( not image to be precise) in a 3x3 window
> > e.g
> > A=rand(10,10);
> > data{1}=A(1:3,1:3);
> > next time I want to read
> > data{2}=A(1:3,2:4);
> > and so on till all the matrix has been read
>
> Unless I'm mistaken in what you're looking for, check the
> documentation for blkproc.

Whoops..... blkproc didn't overlap. I meant to suggest nlfilter.

Subject: slide 3x3 box over image to read values

From: Dave Robinson

Date: 8 May, 2008 16:42:03

Message: 7 of 11

Steve Carano <scarano1@earthlink.net> wrote in message
<b9b035be-4a10-4a65-abb0-
d2bd3e0ed116@x41g2000hsb.googlegroups.com>...
> On May 8, 9:34 am, Steve Carano <scara...@earthlink.net>
wrote:
> > Unless I'm mistaken in what you're looking for, check
the
> > documentation for blkproc.
>
> Whoops..... blkproc didn't overlap. I meant to suggest
nlfilter.

I am running from memory, but I thought that blkproc could
be configured with a specified overlap using optional
parameters when it is called.

I don't have the IP-Toolbox on this machine so I guess you
will need to check the documentation.

Regards

Dave Robinson

Subject: slide 3x3 box over image to read values

From: fas

Date: 9 May, 2008 00:23:17

Message: 8 of 11

On May 9, 2:42 am, "Dave Robinson" <dave.robin...@somewhere.biz>
wrote:
> Steve Carano <scara...@earthlink.net> wrote in message
>
> <b9b035be-4a10-4a65-abb0-
> d2bd3e0ed...@x41g2000hsb.googlegroups.com>...> On May 8, 9:34 am, Steve Carano <scara...@earthlink.net>
> wrote:
> > > Unless I'm mistaken in what you're looking for, check
> the
> > > documentation for blkproc.
>
> > Whoops..... blkproc didn't overlap. I meant to suggest
>
> nlfilter.
>
> I am running from memory, but I thought that blkproc could
> be configured with a specified overlap using optional
> parameters when it is called.
>
> I don't have the IP-Toolbox on this machine so I guess you
> will need to check the documentation.
>
> Regards
>
> Dave Robinson

The problem is that I do not want to apply any operation. What I want
is just to read the values of a 2D matrix( may not be an image) as a
3x3 window slides over the complete matrix. It is like putting a frame
of 3x3 on matrix and slide it and read what ever is there in that 3x3
frame overlapping the matrix. What I do with the values that I get is
a separate issue. Any ideas now ?

Subject: slide 3x3 box over image to read values

From: ImageAnalyst

Date: 9 May, 2008 00:59:28

Message: 9 of 11

On May 8, 12:43=A0am, fas <faisalmu...@gmail.com> wrote:
> On May 8, 2:35 pm, Richard Brown <rgbr...@gmail.com> wrote:
>
> > On May 8, 4:18 pm, fas <faisalmu...@gmail.com> wrote:
>
> > > I want to slide a 3x3 box over the image to read the values in that
> > > 3x3 box , Any ideas please ?
>
> > imtool?
>
> No I do not want to do convolution. I want to read the values of a A
> matrix( not image to be precise) in a 3x3 window
> e.g
> A=3Drand(10,10);
> data{1}=3DA(1:3,1:3);
> next time I want to read
> data{2}=3DA(1:3,2:4);
> and so on till all the matrix has been read

------------------------------------
fas:
Then just do basically that. Put your code into the callback of a
mousemove of the axes containing your image. Get the x,y coordinate
and extract the 9 values like you say but centered on the x,y
coordinate. Then send the 9 values to a label or table on your GUI or
just send them to the command window. You need to make sure you don't
go outside the image, but otherwise it should be pretty easy to
write. Not sure why you're adding them to a cell array though. If
you want to make sure you hit every pixel in the image, then instead
of hooking it up to the mouse movement, just put in a nested pair of
for loops where you iterate over every line and column until you've
visited every pixel. Again, very easy to write. If you were asking
if there were any canned function that did that, no, I don't know of
any, but you could write your own in about 5 minutes.
ImageAnalyst

Subject: slide 3x3 box over image to read values

From: fas

Date: 9 May, 2008 02:32:25

Message: 10 of 11

On May 9, 10:59 am, ImageAnalyst <imageanal...@mailinator.com> wrote:
> On May 8, 12:43 am, fas <faisalmu...@gmail.com> wrote:
>
>
>
> > On May 8, 2:35 pm, Richard Brown <rgbr...@gmail.com> wrote:
>
> > > On May 8, 4:18 pm, fas <faisalmu...@gmail.com> wrote:
>
> > > > I want to slide a 3x3 box over the image to read the values in that
> > > > 3x3 box , Any ideas please ?
>
> > > imtool?
>
> > No I do not want to do convolution. I want to read the values of a A
> > matrix( not image to be precise) in a 3x3 window
> > e.g
> > A=rand(10,10);
> > data{1}=A(1:3,1:3);
> > next time I want to read
> > data{2}=A(1:3,2:4);
> > and so on till all the matrix has been read
>
> ------------------------------------
> fas:
> Then just do basically that. Put your code into the callback of a
> mousemove of the axes containing your image. Get the x,y coordinate
> and extract the 9 values like you say but centered on the x,y
> coordinate. Then send the 9 values to a label or table on your GUI or
> just send them to the command window. You need to make sure you don't
> go outside the image, but otherwise it should be pretty easy to
> write. Not sure why you're adding them to a cell array though. If
> you want to make sure you hit every pixel in the image, then instead
> of hooking it up to the mouse movement, just put in a nested pair of
> for loops where you iterate over every line and column until you've
> visited every pixel. Again, very easy to write. If you were asking
> if there were any canned function that did that, no, I don't know of
> any, but you could write your own in about 5 minutes.
> ImageAnalyst

I think I should rephrase my question. I want to read a 64x48 size
matrix in a block of 5x5. Like first block should have a value of
(1:5,1:5), then (6:10,6:10)... so on

Subject: slide 3x3 box over image to read values

From: fas

Date: 9 May, 2008 02:47:32

Message: 11 of 11

On May 9, 10:59 am, ImageAnalyst <imageanal...@mailinator.com> wrote:
> On May 8, 12:43 am, fas <faisalmu...@gmail.com> wrote:
>
>
>
> > On May 8, 2:35 pm, Richard Brown <rgbr...@gmail.com> wrote:
>
> > > On May 8, 4:18 pm, fas <faisalmu...@gmail.com> wrote:
>
> > > > I want to slide a 3x3 box over the image to read the values in that
> > > > 3x3 box , Any ideas please ?
>
> > > imtool?
>
> > No I do not want to do convolution. I want to read the values of a A
> > matrix( not image to be precise) in a 3x3 window
> > e.g
> > A=rand(10,10);
> > data{1}=A(1:3,1:3);
> > next time I want to read
> > data{2}=A(1:3,2:4);
> > and so on till all the matrix has been read
>
> ------------------------------------
> fas:
> Then just do basically that. Put your code into the callback of a
> mousemove of the axes containing your image. Get the x,y coordinate
> and extract the 9 values like you say but centered on the x,y
> coordinate. Then send the 9 values to a label or table on your GUI or
> just send them to the command window. You need to make sure you don't
> go outside the image, but otherwise it should be pretty easy to
> write. Not sure why you're adding them to a cell array though. If
> you want to make sure you hit every pixel in the image, then instead
> of hooking it up to the mouse movement, just put in a nested pair of
> for loops where you iterate over every line and column until you've
> visited every pixel. Again, very easy to write. If you were asking
> if there were any canned function that did that, no, I don't know of
> any, but you could write your own in about 5 minutes.
> ImageAnalyst

I got it its im2col!

Tags for this Thread

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.

rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics