Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bitmap manipulation algorithm

Status
Not open for further replies.

tinjamin

Programmer
Jan 26, 2004
2
FI
Hi,

I?m trying to extract an image out of the "one colored" background.
This is what I came up with:

1. take a small square of each corner and calculate the
rgb average of them

2. scan every pixel of the image, if the current pixel value
is "close enough" to the average value, replace it with the
transparent colour / value.

Ok, nothing difficult here. But I don`t know what would be
a simple and a good way to avoid these:

1. What if the object in the picture contains sama colour as the background? How to avoid that?

2. How to antialize / blur / or similar the edges. The edges become very pixelated

Thanks
 
(1) If you use a flood-fill type approach to scanning over the pixels, then it won't find fully-enclosed areas of same colour in the middle of your picture.
(2) If you can be sure your picture will always be convex or at least not have curvy bits going into its insides you may be able to do things more simply.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top