point on an image() [message #92209] |
Thu, 29 October 2015 09:37 |
Helder Marchetto
Messages: 520 Registered: November 2011
|
Senior Member |
|
|
Hi,
I would like to display some points (pixels) on an image in FG.
Here is an example of what I'm doing (and I'm not happy with this):
oImg = image(dist(400),margin=0)
pts = randomu(s,100,100) gt 0.5
emptyImage = bytarr(400,400)
ovImg = emptyImage
ovImg[150:249,150:249] = pts * 255b
tImage = [[[ovImg]],[[emptyImage]],[[emptyImage]],[[ovImg]]]
oImgOverlay = image(tImage, overplot=oImg, transparency=50)
This way a red set of points is drawn on the original image. However, I have no bounding box and I can't, for instance, click on the original image.
Is there a way to do this either using plot()(1) or polyline()(2)?
It would save me quite some trouble. So far I ran against FG walls...
Thanks,
Helder
(1) I've tried plot() and I got something using these lines:
locs = where(ovImg)
coordinates = array_indices([400,400], locs, /dimens)
oPlot = plot(coordinates[0,*],coordinates[1,*],'. ', overplot=oImg, transparency=50)
But using the dot does not look as good as using the pixels. Specially when you zoom in.
(2) Polyline does not allow plotting symbols.
|
|
|