<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Reader challenge: Custom spatial transformations</title>
	<atom:link href="http://blogs.mathworks.com/steve/2006/08/08/reader-challenge-custom-spatial-transformations/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.mathworks.com/steve/2006/08/08/reader-challenge-custom-spatial-transformations/</link>
	<description>Steve Eddins manages the Image &#38; Geospatial development team at The MathWorks and coauthored Digital Image Processing Using MATLAB. He writes here about image processing concepts, algorithm implementations, and MATLAB.</description>
	<lastBuildDate>Fri, 10 Feb 2012 18:55:59 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Steve</title>
		<link>http://blogs.mathworks.com/steve/2006/08/08/reader-challenge-custom-spatial-transformations/#comment-19450</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Mon, 28 Jan 2008 16:45:26 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/?p=76#comment-19450</guid>
		<description>Michael&#8212;Yes, you can multiply the three affines together to get a single affine matrix.

I don&#039;t understand your code in comment #9.  Since some of it is commented out, it looks like you are only applying the rotation matrix, and not the translation ones.  Also, applying A1 twice, as you show in one of your commented-out lines, is just translating twice in the same direction.  Instead, you need another translation matrix containing the negative of the translation offsets in the first.</description>
		<content:encoded><![CDATA[<p>Michael&mdash;Yes, you can multiply the three affines together to get a single affine matrix.</p>
<p>I don&#8217;t understand your code in comment #9.  Since some of it is commented out, it looks like you are only applying the rotation matrix, and not the translation ones.  Also, applying A1 twice, as you show in one of your commented-out lines, is just translating twice in the same direction.  Instead, you need another translation matrix containing the negative of the translation offsets in the first.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://blogs.mathworks.com/steve/2006/08/08/reader-challenge-custom-spatial-transformations/#comment-18289</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Tue, 08 Jan 2008 08:37:32 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/?p=76#comment-18289</guid>
		<description>steve- I&#039;ve been trying your suggestions. I&#039;ve the following problems. the translation seems not doing the job and the rotation seems to occur always around the up-left corner of the image.below is the code I&#039;m using. sorry to waste your time, but I&#039;d be very grateful if you could help with this. if you want I can send you the heli1_512 mat.
Thank again for you support. Michael

%A1= [1 0 0; 0 1 0; 50 0 1];
for i=0:pi/16:2*pi
    A2=[cos(i) sin(i) 0; -sin(i) cos(i) 0; 0 0 1];
   % A=A1*A2*A1;
    A=A2;
    B=maketform(&#039;affine&#039;,A);
    rot=imtransform(heli1_512,B,&#039;XData&#039;,[1 512],&#039;YData&#039;,[1 512]);
    figure;
    imshow(rot);
end</description>
		<content:encoded><![CDATA[<p>steve- I&#8217;ve been trying your suggestions. I&#8217;ve the following problems. the translation seems not doing the job and the rotation seems to occur always around the up-left corner of the image.below is the code I&#8217;m using. sorry to waste your time, but I&#8217;d be very grateful if you could help with this. if you want I can send you the heli1_512 mat.<br />
Thank again for you support. Michael</p>
<p>%A1= [1 0 0; 0 1 0; 50 0 1];<br />
for i=0:pi/16:2*pi<br />
    A2=[cos(i) sin(i) 0; -sin(i) cos(i) 0; 0 0 1];<br />
   % A=A1*A2*A1;<br />
    A=A2;<br />
    B=maketform(&#8216;affine&#8217;,A);<br />
    rot=imtransform(heli1_512,B,&#8217;XData&#8217;,[1 512],&#8217;YData&#8217;,[1 512]);<br />
    figure;<br />
    imshow(rot);<br />
end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://blogs.mathworks.com/steve/2006/08/08/reader-challenge-custom-spatial-transformations/#comment-18280</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Tue, 08 Jan 2008 07:08:26 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/?p=76#comment-18280</guid>
		<description>Steve- thank you for your reply. can I make a maketform with one affine matrix which is the multiplication of the 3 affines you wrote? (I hope my question is clear enough). thanks again, Michael.</description>
		<content:encoded><![CDATA[<p>Steve- thank you for your reply. can I make a maketform with one affine matrix which is the multiplication of the 3 affines you wrote? (I hope my question is clear enough). thanks again, Michael.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blogs.mathworks.com/steve/2006/08/08/reader-challenge-custom-spatial-transformations/#comment-18247</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Mon, 07 Jan 2008 16:25:12 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/?p=76#comment-18247</guid>
		<description>Michael&#8212;Create an affine tform struct using &lt;tt&gt;maketform&lt;/tt&gt; and then use &lt;tt&gt;imtransform&lt;/tt&gt;.  Your affine is a composition of three affines: (a) translate center point origin; (b) rotate about origin; and (c) translate back to desired center point.</description>
		<content:encoded><![CDATA[<p>Michael&mdash;Create an affine tform struct using <tt>maketform</tt> and then use <tt>imtransform</tt>.  Your affine is a composition of three affines: (a) translate center point origin; (b) rotate about origin; and (c) translate back to desired center point.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://blogs.mathworks.com/steve/2006/08/08/reader-challenge-custom-spatial-transformations/#comment-18246</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Mon, 07 Jan 2008 16:17:57 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/?p=76#comment-18246</guid>
		<description>Hello Mr. Eddins,

I&#039;d like to know how could I rotate an image not around its center. I&#039;ve been looking on your blog for something related to this question but I cannot find the answer. if it does exist here, please accept my apologize.

thank you in advance,

Michael</description>
		<content:encoded><![CDATA[<p>Hello Mr. Eddins,</p>
<p>I&#8217;d like to know how could I rotate an image not around its center. I&#8217;ve been looking on your blog for something related to this question but I cannot find the answer. if it does exist here, please accept my apologize.</p>
<p>thank you in advance,</p>
<p>Michael</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Maria</title>
		<link>http://blogs.mathworks.com/steve/2006/08/08/reader-challenge-custom-spatial-transformations/#comment-16373</link>
		<dc:creator>Maria</dc:creator>
		<pubDate>Mon, 10 Dec 2007 14:17:48 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/?p=76#comment-16373</guid>
		<description>Thank you, I guess because I am always in a hurry I dont read carefully enough. Thanks and I will try to create my own cart2pol.</description>
		<content:encoded><![CDATA[<p>Thank you, I guess because I am always in a hurry I dont read carefully enough. Thanks and I will try to create my own cart2pol.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blogs.mathworks.com/steve/2006/08/08/reader-challenge-custom-spatial-transformations/#comment-16361</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Mon, 10 Dec 2007 12:41:22 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/?p=76#comment-16361</guid>
		<description>Maria&#8212;Please read carefully the section on the &lt;tt&gt;custom&lt;/tt&gt; option in the documentation for &lt;tt&gt;maketform&lt;/tt&gt;.  Note especially the part starting with &quot;Those functions must support the following syntax ...&quot;  The function cart2pol doesn&#039;t support the syntax that maketform requires.  You&#039;ll need to create your own function that wraps &lt;tt&gt;cart2pol&lt;/tt&gt;, either as an M-file or as an anonymous function.</description>
		<content:encoded><![CDATA[<p>Maria&mdash;Please read carefully the section on the <tt>custom</tt> option in the documentation for <tt>maketform</tt>.  Note especially the part starting with &#8220;Those functions must support the following syntax &#8230;&#8221;  The function cart2pol doesn&#8217;t support the syntax that maketform requires.  You&#8217;ll need to create your own function that wraps <tt>cart2pol</tt>, either as an M-file or as an anonymous function.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Maria</title>
		<link>http://blogs.mathworks.com/steve/2006/08/08/reader-challenge-custom-spatial-transformations/#comment-16297</link>
		<dc:creator>Maria</dc:creator>
		<pubDate>Mon, 10 Dec 2007 08:44:16 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/?p=76#comment-16297</guid>
		<description>Hi Mr. Eddins,

Yes you are right, the custom option is for the maketform function. Here is what I have written:

&lt;pre&gt;
XData = [x_o x_f];
YData = [y_o y_f];
UData = [aax(1) aax(length(aax))];
VData = [rax(1) rax(length(rax))];
size_xy_data = [length(y) length(x)];

frw_fct = [];
inv_fct = @cart2pol;

TFORM = maketform(&#039;custom&#039;,2,2,frw_fct,inv_fct,[]);

xy_data = imtransform(rp_data,TFORM,&#039;UData&#039;,UData,&#039;VData&#039;,VData,...
    &#039;XData&#039;,XData,&#039;YData&#039;,YData,&#039;Size&#039;,size_xy_data);
&lt;/pre&gt;

After running I obtain for TFORM:

&lt;em&gt;Error messages edited out. -SLE&lt;/em&gt;

I hope this description of my problem is better than the previous one.

Thank you very much,

Maria</description>
		<content:encoded><![CDATA[<p>Hi Mr. Eddins,</p>
<p>Yes you are right, the custom option is for the maketform function. Here is what I have written:</p>
<pre>
XData = [x_o x_f];
YData = [y_o y_f];
UData = [aax(1) aax(length(aax))];
VData = [rax(1) rax(length(rax))];
size_xy_data = [length(y) length(x)];

frw_fct = [];
inv_fct = @cart2pol;

TFORM = maketform('custom',2,2,frw_fct,inv_fct,[]);

xy_data = imtransform(rp_data,TFORM,'UData',UData,'VData',VData,...
    'XData',XData,'YData',YData,'Size',size_xy_data);
</pre>
<p>After running I obtain for TFORM:</p>
<p><em>Error messages edited out. -SLE</em></p>
<p>I hope this description of my problem is better than the previous one.</p>
<p>Thank you very much,</p>
<p>Maria</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blogs.mathworks.com/steve/2006/08/08/reader-challenge-custom-spatial-transformations/#comment-16175</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Fri, 07 Dec 2007 16:34:25 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/?p=76#comment-16175</guid>
		<description>Maria&#8212;Your description of what you&#039;ve done is pretty vague, so it&#039;s hard to give you specific advice.  The first thing you should focus on is whether you are using &lt;tt&gt;maketform&lt;/tt&gt; correctly.  That&#039;s the function with the custom option, not &lt;tt&gt;imtransform&lt;/tt&gt;.  See my &lt;a href=&quot;http://blogs.mathworks.com/steve/2006/08/04/spatial-transformations-defining-and-applying-custom-transforms/&quot; rel=&quot;nofollow&quot;&gt;4-Aug-2006 post&lt;/a&gt; for an example.</description>
		<content:encoded><![CDATA[<p>Maria&mdash;Your description of what you&#8217;ve done is pretty vague, so it&#8217;s hard to give you specific advice.  The first thing you should focus on is whether you are using <tt>maketform</tt> correctly.  That&#8217;s the function with the custom option, not <tt>imtransform</tt>.  See my <a href="http://blogs.mathworks.com/steve/2006/08/04/spatial-transformations-defining-and-applying-custom-transforms/" rel="nofollow">4-Aug-2006 post</a> for an example.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Maria</title>
		<link>http://blogs.mathworks.com/steve/2006/08/08/reader-challenge-custom-spatial-transformations/#comment-16169</link>
		<dc:creator>Maria</dc:creator>
		<pubDate>Fri, 07 Dec 2007 12:24:23 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/?p=76#comment-16169</guid>
		<description>Hi Mr. Eddins,

I am trying to transform an image in polar coordinates to cartesian coordinates.
I am using imtransform with the &#039;custom&#039; option but I get an error message saying that atan2, in cart2pol.m which is my inverse_function, is not defined for input arguments of type &#039;struct&#039;.
I am entering as well UData, VData, XData and YData.

Do you have any suggestions on how to do it with imtransform or any other function?

Thank,

Maria</description>
		<content:encoded><![CDATA[<p>Hi Mr. Eddins,</p>
<p>I am trying to transform an image in polar coordinates to cartesian coordinates.<br />
I am using imtransform with the &#8216;custom&#8217; option but I get an error message saying that atan2, in cart2pol.m which is my inverse_function, is not defined for input arguments of type &#8216;struct&#8217;.<br />
I am entering as well UData, VData, XData and YData.</p>
<p>Do you have any suggestions on how to do it with imtransform or any other function?</p>
<p>Thank,</p>
<p>Maria</p>
]]></content:encoded>
	</item>
</channel>
</rss>

