[josm-dev] Plugin: Access layer pixel data
Paul Hartmann
phaaurlt at googlemail.com
Tue Apr 15 20:46:36 UTC 2014
On 15.04.2014 18:24, Nick Ma. wrote:
> I'm working on a plugin like "Tracer2"[1] but which should run
> entirely embedded into JOSM.
>
> Therefore I'm asking for the best way to access pixel color shown in
> an active Layer[2] or ImageryLayer?
Like this (gets the pixels in the current view):
BufferedImage image = new BufferedImage(20, 30,
BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = image.createGraphics();
g2.setClip(0, 0, 20, 30);
Main.map.mapView.paint(g2);
int col = image.getRGB(5,6);
The Layer class has a paint() method as well, if you just need one layer.
> Why/Background/Next steps (that's not the question):
> To execute an edge detection[3] algorithm with the image information
> and auto detect the edges of an area currently displayed in JOSM.
> Helping to faster create buildings.
The library ImageJ might be worth a look. It is pure Java and is
advertised as being fast.
Also lakewalker is another plugin that does a similar thing, but more
specialized.
Paul
More information about the josm-dev
mailing list