Jump to content
Sign in to follow this  
ShikiPiki

using Pixel search around a given point

Recommended Posts

ShikiPiki

Given a 100x100 pixel square, is it possible to do a pixel search in the entire square EXCEPT for a 10x10 pixel square at the center without using 4 search areas.

I am currently doing the above pixel search by searching the top, left, right and bottom by using 

top = [0,0,0,100,50-10/2]. The bottom left and right are done similarly. The issue with this method however is that I also want it to find the pixel which is closest to the center.

What I can do is do the whole search by in iteration and do something like search 1 line above the center search 1 line below, search 1 line to the left search 1 line to the right. Starting at the 6th pixel from the center such that i ignore that 10x10... but that would be a mess.

TLDR; Is there an easy method to search an area like such that you still return the pixel which matches closest to the center?

_____________
| o                     |
|        ___          |
|       |      |         |
|   o  |___|         |
|                 o     |
|____________|


Thanks! -ShikiPiki

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×