<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[QTransform::quadToQuad for QImage]]></title><description><![CDATA[<p dir="auto">I'll use the terms from: <a href="https://doc.qt.io/qt-5/qtransform.html#quadToQuad" target="_blank" rel="noopener noreferrer nofollow ugc">doc.qt.io...</a></p>
<p dir="auto">I seem to have some problem understanding this function. Iwould have expected, that the Points of polygone one end up at the coresponding points of polygone two. Here an extract of my source:<br />
```<br />
QPolygonF quadQ, quadZ;<br />
quadQ &lt;&lt;mpkt1 &lt;&lt;mpkt2 &lt;&lt; mpkt3 &lt;&lt; mpkt4;<br />
int w=2500,h=1800;<br />
quadZ &lt;&lt; QPointF(0,0) &lt;&lt; QPointF(w,0) &lt;&lt; QPointF(0,h) &lt;&lt; QPointF(w,h);<br />
QTransform q2q;<br />
QTransform::quadToQuad(quadQ,quadZ,q2q);<br />
QImage target=source.transformed(q2q);</p>
<pre><code>The mpkts are QPoints  and are calculated before. They are:
mpkt1 =(539,208)
mpkt2 =(2921,196) 
mpkt3 =(467,2119) 
mpkt4 =(2966,2135) 

So I would expect to find the part of the source image at (539,208) at the target image at (0,0), but it ends up at about (588,211), the others are where I would expect them relative to this on. So a translation of -588,-211 would solve the problem, but how do I get these parameters. Itried to transform the QPoint mpkt1 with the same transformation, but that gives me (0,0) as I would have expexted.
Any idea?</code></pre>
]]></description><link>https://forum.qt.io/topic/121956/qtransform-quadtoquad-for-qimage</link><generator>RSS for Node</generator><lastBuildDate>Mon, 09 Nov 2026 02:00:20 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/121956.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 20 Dec 2020 13:28:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QTransform::quadToQuad for QImage on Sun, 20 Dec 2020 14:27:48 GMT]]></title><description><![CDATA[<p dir="auto">So that the next one with the same problem finds a solution here.</p>
<p dir="auto">I added:</p>
<pre><code>       qDebug() &lt;&lt;QImage::trueMatrix(q2q,source.width(),source.height()).dx();
       qDebug() &lt;&lt;QImage::trueMatrix(q2q,source.width(),source.height()).dy();
       qDebug() &lt;&lt;q2q.dy();
       qDebug() &lt;&lt;q2q.dx();

</code></pre>
<p dir="auto">and got<br />
0.68924<br />
-582.219<br />
0.963701<br />
-208.209</p>
<p dir="auto">The difference between these two (dx,dy) should be the added translation. so mpkt1 does not end up at (0,0) but at (0.68924+582.219,0.963701+208.209) =(583,209), which is what I observed.</p>
]]></description><link>https://forum.qt.io/post/633508</link><guid isPermaLink="true">https://forum.qt.io/post/633508</guid><dc:creator><![CDATA[Dimitri Junker]]></dc:creator><pubDate>Sun, 20 Dec 2020 14:27:48 GMT</pubDate></item><item><title><![CDATA[Reply to QTransform::quadToQuad for QImage on Sun, 20 Dec 2020 14:02:15 GMT]]></title><description><![CDATA[<p dir="auto">Sometimes asking a question helps understand it  So what seem to happen is, that the full source image is mapped to the target, not only the part of inside the polygone one.<br />
<a href="https://doc.qt.io/qt-5/qtransform.html#quadToQuad" target="_blank" rel="noopener noreferrer nofollow ugc">There</a> it is:</p>
<pre><code>The transformation matrix is internally adjusted to compensate for unwanted translation; i.e. the image produced is the smallest image that contains all the transformed points of the original image. Use the trueMatrix() function to retrieve the actual matrix used for transforming an image.
</code></pre>
<p dir="auto">So now I have to find out how to either deactivate this adjustment or, bycomparing the two matrixes, to find out the added translation</p>
]]></description><link>https://forum.qt.io/post/633503</link><guid isPermaLink="true">https://forum.qt.io/post/633503</guid><dc:creator><![CDATA[Dimitri Junker]]></dc:creator><pubDate>Sun, 20 Dec 2020 14:02:15 GMT</pubDate></item></channel></rss>