RSS/Atom feed Twitter
Site is read-only, email is disabled

plugin to put points on top of each other

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

6 of 6 messages available
Toggle history

Please log in to manage your subscriptions.

plugin to put points on top of each other Christoph Lutz 07 Jul 16:11
plugin to put points on top of each other William Skaggs 07 Jul 18:00
  plugin to put points on top of each other Sven Neumann 07 Jul 18:39
   plugin to put points on top of each other Christoph Lutz 07 Jul 19:35
plugin to put points on top of each other William Skaggs 07 Jul 20:10
  plugin to put points on top of each other Sven Neumann 07 Jul 20:34
Christoph Lutz
2004-07-07 16:11:59 UTC (almost 20 years ago)

plugin to put points on top of each other

Hi,

I think, a very common problem is to put particular points of two (or more) different pictures/drawables on top of each other. This could be done by a perspective transformation and is useful, if you for example want to create an animated gif out of many slightly different pictures (consider unwanted waggling of the camera) you took with your digicam. If you use the raw source pictures, there might be small "jumps" in the flow, but if you use a transformation to put particular points on top of each other, there is a smooth effect of motion.

I need this feature to create stereooscopic-images, using the "stereoscopic"-plugin. The output-image could be viewed using red/green glasses. With stereoscopic-images it is very important to adjust the two images (right, left) so that at least the points of the focused object are exact on top of each other.

Is there already a plugin which provides the needed feature? My recherche in the registry was negative, but may be I overlooked something.

Despite of the fact there might be a already existing plugin, I wrote a plugin which implements the following algorithm: - You provide three source points in the left-eye-image/drawable which should be exact on top of the corresponding three points in the right-eye-destination-image/drawable. - The plugin calculates a matrix for a affine transformation out of this data and performs the transformation.

Unfortunately, for the moment, the plugin is not very comfortable to use: you have to provide 6 points (x and y-value) in 12 spin-buttons and you have to enter all values by hand. Since I am not very firm with gtk and the gimp-tools, there is no way to enter these values just by clicking on the points in the displayed images. Could your help me in that point? I just need to know how to "grab" the point-coordinates of a click to an image! I want to take these coordinates and fill the spin-buttons with these data to provide more comfort. From the context of my plugin (the run-function), I don't know anything of the diplayed image (and the events that are activated in it), isn't it? All I know is the image_id and the drawable_id. Any hints are very welcome!!

My algorithm works very similar to the "perspective-transformation" in the toolbox. The main difference is that with perspective-transformation it is not possible to provide the source-points which are fixed to the corner points. You may only change the 4 destination points. Regardless, the user-interface of perspective-transform is very comfortable (grid-preview, move points in the picture) and I would be happy if my plugin could provide the same comfort.

thanks, Christoph

William Skaggs
2004-07-07 18:00:08 UTC (almost 20 years ago)

plugin to put points on top of each other

Christof Lutz writes:

Could your help me in that point? I just need to know how to "grab" the point-coordinates of a click to an image!

If you go into the plug-ins/common directory of the source and grep for GDK_BUTTON_PRESS, you will find plenty of examples that will quickly show you how to do it.

There are three main steps involved: (1) requesting to receive button press events, (2) connecting a callback for them, and (3) handling them in the callback.

Best, -- Bill


______________ ______________ ______________ ______________ Sent via the KillerWebMail system at primate.ucdavis.edu

Sven Neumann
2004-07-07 18:39:08 UTC (almost 20 years ago)

plugin to put points on top of each other

Hi,

"William Skaggs" writes:

Christof Lutz writes:

Could your help me in that point? I just need to know how to "grab" the point-coordinates of a click to an image!

If you go into the plug-ins/common directory of the source and grep for GDK_BUTTON_PRESS, you will find plenty of examples that will quickly show you how to do it.

I guess that Christof is asking for a way to get the coordindates of a click into a GIMP image window, not a click on a widget in the plug-in dialog. If that is the case, then the answer is that plug-ins can't do that.

Sven

Christoph Lutz
2004-07-07 19:35:25 UTC (almost 20 years ago)

plugin to put points on top of each other

Sven Neumann wrote:

Hi,

"William Skaggs" writes:

Christof Lutz writes:

Could your help me in that point? I just need to know how to "grab" the point-coordinates of a click to an image!

If you go into the plug-ins/common directory of the source and grep for GDK_BUTTON_PRESS, you will find plenty of examples that will quickly show you how to do it.

I guess that Christof is asking for a way to get the coordindates of a click into a GIMP image window, not a click on a widget in the plug-in dialog. If that is the case, then the answer is that plug-ins can't do that.

yes, that's true and it's a pity that there is no way :-) So what do you suggest:

I want to mark particular points in one or more images and use the marked coordinates in my plugin-dialog. Do you think it's the best to create picture-buttons with more or less small thumbnails of the images and read the coordinates of the corresponding GDK_BUTTON_PRESS? The smaller the thumbnail, the more unprecise the coordinates I get. Is this way possible actually? How can I get reasonable results in respect to the precision of the corrdinates? I always had in mind to do it that way (create a picture-button), but I felt the results may be better if I click into the GIMP-image itself which is unfortunately not possible.

Christoph

Sven

William Skaggs
2004-07-07 20:10:00 UTC (almost 20 years ago)

plugin to put points on top of each other

Christof Lutz writes:

yes, that's true and it's a pity that there is no way :-) So what do you suggest:

I want to mark particular points in one or more images and use the marked coordinates in my plugin-dialog. Do you think it's the best to create picture-buttons with more or less small thumbnails of the images and read the coordinates of the corresponding GDK_BUTTON_PRESS? The smaller the thumbnail, the more unprecise the coordinates I get. Is this way possible actually? How can I get reasonable results in respect to the precision of the corrdinates?

My apologies for misunderstanding the question. I am doing something very much like this in gfig, using the following code (simplified a little bit):

if (! back_pixbuf) back_pixbuf = gimp_image_get_thumbnail (image_id, preview_width, preview_height, GIMP_PIXBUF_LARGE_CHECKS);

if (back_pixbuf) gdk_draw_pixbuf (preview->window, preview->style->fg_gc[GTK_STATE_NORMAL], back_pixbuf, 0, 0, 0, 0,
gdk_pixbuf_get_width (back_pixbuf), gdk_pixbuf_get_height (back_pixbuf), GDK_RGB_DITHER_NONE, 0, 0);

Here "preview" is a GtkDrawingArea. You can create a thumbnail up to 512 x 512 in this way. (Incidentally, thanks to Sven for improving the code I originally wrote to do this.)

Best, -- Bill


______________ ______________ ______________ ______________ Sent via the KillerWebMail system at primate.ucdavis.edu

Sven Neumann
2004-07-07 20:34:19 UTC (almost 20 years ago)

plugin to put points on top of each other

Hi,

"William Skaggs" writes:

if (back_pixbuf)
gdk_draw_pixbuf (preview->window, preview->style->fg_gc[GTK_STATE_NORMAL], back_pixbuf, 0, 0, 0, 0,
gdk_pixbuf_get_width (back_pixbuf), gdk_pixbuf_get_height (back_pixbuf), GDK_RGB_DITHER_NONE, 0, 0);

Any particular reason that you use GDK_RGB_DITHER_NONE here instead of GDK_RGB_DITHER_NORMAL? GdkRGB dithering is rather fast and it yields a much better visual appearance on 16bit displays.

Or did I write it this way?

Sven