Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #12993 > unrolled thread

Cursor position on images

Started by"King, Peter R" <peter.king@imperial.ac.uk>
First post2012-12-29 20:08 +0000
Last post2012-12-31 01:49 +0000
Articles 4 — 3 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  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

#12993 — Cursor position on images

From"King, Peter R" <peter.king@imperial.ac.uk>
Date2012-12-29 20:08 +0000
SubjectCursor position on images
Message-ID<kbnijt$1bh$1@smc.vnet.net>
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

[toc] | [next] | [standalone]


#12994

Fromspamslayer19@gmail.com
Date2012-12-30 03:24 +0000
Message-ID<kboc68$3gq$1@smc.vnet.net>
In reply to#12993
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. :)

[toc] | [prev] | [next] | [standalone]


#13001

Fromspamslayer19@gmail.com
Date2012-12-31 01:49 +0000
Message-ID<kbqqv1$7vt$1@smc.vnet.net>
In reply to#12994
And of course define ptsList = {}; before anything else. I left out the most important part!

On Saturday, December 29, 2012 9:24:56 PM UTC-6, spamsl...@gmail.com wrote:
> 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. :)

[toc] | [prev] | [next] | [standalone]


#13000

FromRoland Franzius <roland.franzius@uos.de>
Date2012-12-31 01:49 +0000
Message-ID<kbqqur$7vr$1@smc.vnet.net>
In reply to#12993
Am 29.12.2012 21:08, schrieb King, Peter R:
> 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.

Left click curson on the image to select.

Enlarge the image by dragging the lower left corner in order to get a 
better resolution for positioning the cross hairs.

Right click the image and select "Get coordinates" from the context menu.

After this opening procedure each mouse click on a point followed by 
Ctrl C writes the actual list of the coordinate pair at the selected 
cursor position into a Copy&Paste List.

Selecting a input cell position you can copy the list with Ctrl+V

-- 

Roland Franzius

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web