<br><br><div class="gmail_quote">On Thu, Sep 2, 2010 at 9:45 AM, Bert Douglas <span dir="ltr"><<a href="mailto:bertd@tplogic.com">bertd@tplogic.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi All,<br><br>I have written a new "effect" for geometrictransform. It does image rotation.<br>The code is appended below.<br>If there is any interest, I will do the work to push it upstream.<br>But I need a mentor to help guide the way.<br>
<br>On the code itself.<br>I modified the "circle" element, to do rotation.<br>The changes were confined to the "map" function.<br>I used the same parameters, but with different meaning.<br></blockquote>
<div><br>Great! I can help you getting this in. Can you provide this as a git patch in bugzilla?<br><br>In case you've never done this before, I could guide you through the details so you'd learn how to do it. I'm available on #gstreamer on freenode as 'thiagoss'. You can talk to me there or send me a private mail.<br>
</div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><br>Thanks,<br>
Bert Douglas<br><br>------------------------------------------------------------------------<br><br>static gboolean<br>circle_map (GstGeometricTransform * gt, gint x, gint y, gdouble * in_x,<br> gdouble * in_y)<br>{<br>
//GstCircleGeometricTransform *cgt = GST_CIRCLE_GEOMETRIC_TRANSFORM_CAST (gt);<br> GstCircle *circle = GST_CIRCLE_CAST (gt);<br><br> gint w, h;<br> gdouble pad, sa;<br> gdouble cix, ciy, cox, coy; // centers, in/out x/y<br>
gdouble ai, ao, ar; // angles, in/out/rotate (radians)<br> gdouble r; // radius<br> gdouble xi, yi, xo, yo; // positions in/out x/y<br><br> // input and output image height and width<br>
w = gt->width;<br> h = gt->height;<br><br> // our parameters<br> pad = circle->height; // padding on bottom and right of input image<br> ar = circle->angle * M_PI / 180.0; // angle of rotation, degrees to radians<br>
sa = circle->spread_angle; // not used<br><br> // get in and out centers<br> cox = 0.5 * w;<br> coy = 0.5 * h;<br> cix = 0.5 * (w - pad);<br> ciy = 0.5 * (h - pad);<br><br> // convert output image position to polar form<br>
xo = x - cox;<br> yo = y - coy;<br> ao = atan2 (yo, xo);<br> r = sqrt (xo * xo + yo * yo);<br><br> // perform rotation backward to get input image rotation<br> // this seems wrong, but rotation from in-->out is counterclockwise<br>
ai = ao + ar;<br><br> // back to rectangular for input image position<br> xi = r * cos (ai);<br> yi = r * sin (ai);<br><br> // restore center offset, return values to caller<br> *in_x = xi + cix;<br> *in_y = yi + ciy;<br>
<br> GST_DEBUG_OBJECT (circle, "Inversely mapped %d %d into %lf %lf",<br> x, y, *in_x, *in_y);<br><br> return TRUE;<br>}<br><br><br><br><br>
<br>------------------------------------------------------------------------------<br>
This SF.net Dev2Dev email is sponsored by:<br>
<br>
Show off your parallel programming skills.<br>
Enter the Intel(R) Threading Challenge 2010.<br>
<a href="http://p.sf.net/sfu/intel-thread-sfd" target="_blank">http://p.sf.net/sfu/intel-thread-sfd</a><br>_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.sourceforge.net">gstreamer-devel@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Thiago Sousa Santos<br>