Hi, I'm trying to use gemmouse with pix_data to get the color values of pixels in an image under the mouse. gemmouse and pix_data use different co-ordinates? Is there a simple way to do this. It would be simpler if pix_draw put the image I was looking at into the bottom left of the gem window but it doesn't also because translateXYZ uses a different scale again from pix_data and gemmouse that complicates the matter. Anyway I'm sure there is a simple way to get the color values under the cursor. Any hints? Thanks, Jim
Quick and simple solution to a lot of similar problems, use [range].
It needs four arguments, the input range (in this case 0 to the size of your gemwin) as two arguments, and the output range (usually -4 to 4) and it will convert one into the other. Although to make this work on gem you need one for each of the x and y axes.
You can do this by re-scaling yourself, although this does take more time and effort, but also can provide more control. In the end it's your own choice.
Andrew
From: cinetron@passport.ca To: pd-list@iem.at Date: Thu, 8 Apr 2010 22:56:37 -0400 Subject: [PD] gemmouse and pix_data
Hi, I'm trying to use gemmouse with pix_data to get the color values of pixels in an image under the mouse. gemmouse and pix_data use different co-ordinates? Is there a simple way to do this. It would be simpler if pix_draw put the image I was looking at into the bottom left of the gem window but it doesn't also because translateXYZ uses a different scale again from pix_data and gemmouse that complicates the matter. Anyway I'm sure there is a simple way to get the color values under the cursor. Any hints? Thanks, Jim
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
http://clk.atdmt.com/UKM/go/195013117/direct/01/ We want to hear all your funny, exciting and crazy Hotmail stories. Tell us now
Andrew Faraday wrote:
Quick and simple solution to a lot of similar problems, use [range].
It needs four arguments, the input range (in this case 0 to the size of your gemwin) as two arguments, and the output range (usually -4 to 4) and it will convert one into the other. Although to make this work on gem you need one for each of the x and y axes.
You can do this by re-scaling yourself, although this does take more time and effort, but also can provide more control. In the end it's your own choice.
[gemmouse] will output coordinates in pixels by default. however, you can specify the range manually, [gemmouse 1 1] will output x=0..1 and y=0..1
fgmsadr IOhannes
Date: Fri, 9 Apr 2010 11:03:28 +0200 From: zmoelnig@iem.at To: jbturgid@hotmail.com CC: cinetron@passport.ca; pd-list@iem.at Subject: Re: [PD] gemmouse and pix_data
Andrew Faraday wrote:
Quick and simple solution to a lot of similar problems, use [range].
It needs four arguments, the input range (in this case 0 to the size of your gemwin) as two arguments, and the output range (usually -4 to 4) and it will convert one into the other. Although to make this work on gem you need one for each of the x and y axes.
You can do this by re-scaling yourself, although this does take more time and effort, but also can provide more control. In the end it's your own choice.
[gemmouse] will output coordinates in pixels by default. however, you can specify the range manually, [gemmouse 1 1] will output x=0..1 and y=0..1
fgmsadr IOhannes
I'm not entirely sure, but this would probably still be centred on the top left corner of the gem window, so would still require some arithmetic to sync up objects to mouse position. Something like
[gemmouse 8 8] | | [- 4] [- 4]
http://clk.atdmt.com/UKM/go/197222280/direct/01/ Do you have a story that started on Hotmail? Tell us now
Le vendredi 09 avril 2010 à 11:52 +0100, Andrew Faraday a écrit :
Date: Fri, 9 Apr 2010 11:03:28 +0200 From: zmoelnig@iem.at To: jbturgid@hotmail.com CC: cinetron@passport.ca; pd-list@iem.at Subject: Re: [PD] gemmouse and pix_data
Andrew Faraday wrote:
Quick and simple solution to a lot of similar problems, use
[range].
It needs four arguments, the input range (in this case 0 to the
size of your gemwin) as two arguments, and the output range (usually -4 to 4) and it will convert one into the other. Although to make this work on gem you need one for each of the x and y axes.
You can do this by re-scaling yourself, although this does take
more time and effort, but also can provide more control. In the end it's your own choice.
[gemmouse] will output coordinates in pixels by default. however, you can specify the range manually, [gemmouse 1 1] will
output
x=0..1 and y=0..1
fgmsadr IOhannes
I'm not entirely sure, but this would probably still be centred on the top left corner of the gem window, so would still require some arithmetic to sync up objects to mouse position.
No, if you read the help about [pix-data], you only need the range between 0 and 1 : The coordinates within the image (x-pos, y-pos) range from (0.0f, 0.0f) (left-bottom) to (1.0f, 1.0f) (right-top). So [gemmouse 1 1] is enough (on Linux you have to invert the values on Y axe). Your example is good for a square GEM window and return the position in its space (not in the pix 'space' of a picture). (I'm not sure to be clear here ?) Have a look at the attached patch. ++
Jack
Something like
[gemmouse 8 8] | | [- 4] [- 4]
Get a free e-mail account with Hotmail. Sign-up now. _______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Thanks a lot for all your help in sorting out using gemmouse with pix_data. It's making a lot more sense to me now. It would be nice if translateXYZ had a feature like gemmouse where one could set the scale relative to the gem window. Same goes for the geometric primitive sizes like square. It would be nice to be able to specify those in pixels. Thanks again. Jim
On Fri, 2010-04-09 at 14:47 +0200, Jack wrote:
Le vendredi 09 avril 2010 à 11:52 +0100, Andrew Faraday a écrit :
Date: Fri, 9 Apr 2010 11:03:28 +0200 From: zmoelnig@iem.at To: jbturgid@hotmail.com CC: cinetron@passport.ca; pd-list@iem.at Subject: Re: [PD] gemmouse and pix_data
Andrew Faraday wrote:
Quick and simple solution to a lot of similar problems, use
[range].
It needs four arguments, the input range (in this case 0 to the
size of your gemwin) as two arguments, and the output range (usually -4 to 4) and it will convert one into the other. Although to make this work on gem you need one for each of the x and y axes.
You can do this by re-scaling yourself, although this does take
more time and effort, but also can provide more control. In the end it's your own choice.
[gemmouse] will output coordinates in pixels by default. however, you can specify the range manually, [gemmouse 1 1] will
output
x=0..1 and y=0..1
fgmsadr IOhannes
I'm not entirely sure, but this would probably still be centred on the top left corner of the gem window, so would still require some arithmetic to sync up objects to mouse position.
No, if you read the help about [pix-data], you only need the range between 0 and 1 : The coordinates within the image (x-pos, y-pos) range from (0.0f, 0.0f) (left-bottom) to (1.0f, 1.0f) (right-top). So [gemmouse 1 1] is enough (on Linux you have to invert the values on Y axe). Your example is good for a square GEM window and return the position in its space (not in the pix 'space' of a picture). (I'm not sure to be clear here ?) Have a look at the attached patch. ++
Jack
Something like
[gemmouse 8 8] | | [- 4] [- 4]
Get a free e-mail account with Hotmail. Sign-up now. _______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
hello,
with the "perspec" and "view" message to gemwin, you can adjust everything in order to have the gem coordinate to be exactly what you want. i.e. to coincide with pixel value.
c
jim a écrit :
Thanks a lot for all your help in sorting out using gemmouse with pix_data. It's making a lot more sense to me now. It would be nice if translateXYZ had a feature like gemmouse where one could set the scale relative to the gem window. Same goes for the geometric primitive sizes like square. It would be nice to be able to specify those in pixels. Thanks again. Jim
On Fri, 2010-04-09 at 14:47 +0200, Jack wrote:
Le vendredi 09 avril 2010 à 11:52 +0100, Andrew Faraday a écrit :
Date: Fri, 9 Apr 2010 11:03:28 +0200 From: zmoelnig@iem.at To: jbturgid@hotmail.com CC: cinetron@passport.ca; pd-list@iem.at Subject: Re: [PD] gemmouse and pix_data
Andrew Faraday wrote:
Quick and simple solution to a lot of similar problems, use
[range].
It needs four arguments, the input range (in this case 0 to the
size of your gemwin) as two arguments, and the output range (usually -4 to 4) and it will convert one into the other. Although to make this work on gem you need one for each of the x and y axes.
You can do this by re-scaling yourself, although this does take
more time and effort, but also can provide more control. In the end it's your own choice.
[gemmouse] will output coordinates in pixels by default. however, you can specify the range manually, [gemmouse 1 1] will
output
x=0..1 and y=0..1
fgmsadr IOhannes
I'm not entirely sure, but this would probably still be centred on the top left corner of the gem window, so would still require some arithmetic to sync up objects to mouse position.
No, if you read the help about [pix-data], you only need the range between 0 and 1 : The coordinates within the image (x-pos, y-pos) range from (0.0f, 0.0f) (left-bottom) to (1.0f, 1.0f) (right-top). So [gemmouse 1 1] is enough (on Linux you have to invert the values on Y axe). Your example is good for a square GEM window and return the position in its space (not in the pix 'space' of a picture). (I'm not sure to be clear here ?) Have a look at the attached patch. ++
Jack
Something like
[gemmouse 8 8] | | [- 4] [- 4]
Get a free e-mail account with Hotmail. Sign-up now. _______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list