views:

22

answers:

0

I am working on image processing on maps from Google Maps. How can I use ActionScript 3 to strip off the street names?

Since the street name fonts are anti-aliased, a lot variances of colors are used. I can replace colors one by one, but are there any efficient methods?

I have read a related method like:

public function threshold(sourceBitmapData:BitmapData, sourceRect:Rectangle, destPoint:Point, operation:String, threshold:uint, color:uint = 0, mask:uint = 0xFFFFFFFF, copySource:Boolean = false):uint

http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/display/BitmapData.html#threshold%28%29

I implement the method as follow:

var map_size:Rectangle = new Rectangle(0, 0, map.width, map.height);
map_overlay.threshold(map, map_size, new Point(0, 0), '>=', 0xFFB5D29C, 0x00000000, 0xFFFFFF, true);

But I did not work well.

Alternatively, I have also used getPixel and setPixel method to replace colors. However, I am unable to replace color with transparent color:

bitmapdata.setPixel(i, j, 0x00000000); // clear and transparent

Any better solution? or I have to use Google Maps API ?

Map Sample fetched from Google