Welcome, Guest. Please login or register.

Author Topic: Help needed with a very silly idea...  (Read 8382 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline minator

  • Hero Member
  • *****
  • Join Date: Jan 2003
  • Posts: 592
    • Show all replies
    • http://www.blachford.info
Re: Help needed with a very silly idea...
« on: January 20, 2005, 06:43:04 PM »
@ Karlos

I don't see why you need to scan vertically, you should be able to get x and y values by scanning horizontally.

Also by scanning vertically you'll get a potentially massive speed hit as reading from RAM non-sequentially is very slow.



Assuming the index is in the top left:

Scan across, and when you hit the first correct pixel record xMin, xMax, yMin and yMax.

Scan the next line, if the pixel's x value is lower and it's touching the xMin you can record it as a new xMin, and increment yMax while there are other releant pixels touching you set a higher xMax.

--

That should work for solid areas but you'll need to implement something to track "previous pixels which were touching" if you want to capture non-solid objects.

That useful?

EDIT: I was suggesting an area fill for an alternative but this will not work on irregular shapes (i.e. an S).
 

Offline minator

  • Hero Member
  • *****
  • Join Date: Jan 2003
  • Posts: 592
    • Show all replies
    • http://www.blachford.info
Re: Help needed with a very silly idea...
« Reply #1 on: January 28, 2005, 11:14:54 AM »
@ Karlos

Out of interest, what is this for?