Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #12994
| From | spamslayer19@gmail.com |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Cursor position on images |
| Date | 2012-12-30 03:24 +0000 |
| Message-ID | <kboc68$3gq$1@smc.vnet.net> (permalink) |
| References | <kbnijt$1bh$1@smc.vnet.net> |
| Organization | Time-Warner Telecom |
On Saturday, December 29, 2012 2:08:29 PM UTC-6, King, Peter R wrote:
> I am sure this is straightforward but I cannot quite see how to do this.
I have an image (jpg file, but could be any format if that matters). I want
to be able to left click on the image and mark the point with a dot of some sort and collect the coordinates of the point (the coordinate system is fairly arbitrary). I then want to be able to repeat this as many times as required and end up with a list of the coordinates of the points clicked on for further manipulation. Clickpane should do the trick but I can't work out how.
>
>
>
> Any suggestions, thanks.
>
>
>
> Peter
Try this:
image = ExampleData[{"TestImage", "Girl3"}];
ptColor = Yellow;
ptSize = Large;
Panel@Grid[
{
{
Dynamic@ClickPane[
Show[
{
image, Graphics[{PointSize[ptSize], ptColor, Point[ptsList]}]
}
],
AppendTo[ptsList, #] &], SpanFromLeft
},
{
PopupWindow[Button["View Points", ImageSize -> 100],
Dynamic@ptsList], SpanFromLeft
},
{
Button["Reset", ptsList = {}, ImageSize -> 100], SpanFromLeft
}
},
Alignment -> {Right, Baseline}
]
If you don't like the popup window, you can just evaluate Dynamic@ptsList in a separate cell. I'm sure someone has a more elegant solution, but this works. :)
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Cursor position on images "King, Peter R" <peter.king@imperial.ac.uk> - 2012-12-29 20:08 +0000
Re: Cursor position on images spamslayer19@gmail.com - 2012-12-30 03:24 +0000
Re: Cursor position on images spamslayer19@gmail.com - 2012-12-31 01:49 +0000
Re: Cursor position on images Roland Franzius <roland.franzius@uos.de> - 2012-12-31 01:49 +0000
csiph-web