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
BuginatorAsked:
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.

thehagmanCommented:
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

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
t0t0Commented:
Interesting question....

Perhaps if this question is still open when I return this evening, I may look at it again.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming Languages-Other

From novice to tech pro — start learning today.