# Get the current image block (8x8) that contains a certain pixel (x,y)

In my MATLAB application I load an image. Let say we divide the image up in 8x8 blocks (8pixels by 8pixels = 64 pixel block).

I need to get the positions of all the pixels in the current block that contain a single given pixel position.

Hope my question is understandable, let me know if it isn't.
LVL 5
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
Calculate x1 = x - (x%8) and y1 = y-(y%8), wher % is the modulo operator.
Then the containing 8x8 block is given by coordinates x1,...,x1+7 and y1,...,y1+7.
0

Experts Exchange Solution brought to you by