<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Spatial transformations: maketform, tformfwd, and tforminv</title>
	<link>http://blogs.mathworks.com/steve/2006/02/14/spatial-transformations-maketform-tformfwd-and-tforminv/</link>
	<description>Steve Eddins manages the Image &#38; Geospatial development team at &#60;a href="http://www.mathworks.com/"&#62;The MathWorks&#60;/a&#62; and coauthored &#60;a href="http://www.mathworks.com/support/books/book5291.html?category=-1&#38;language=-1"&#62;Digital Image Processing Using MATLAB&#60;/a&#62;. He writes here about image processing concepts, algorithm implementations, and MATLAB.&#60;br&#62;&#60;br&#62;&#60;img&#62;</description>
	<pubDate>Sun, 08 Nov 2009 02:15:17 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.1</generator>
		<item>
		<title>By: Steve</title>
		<link>http://blogs.mathworks.com/steve/2006/02/14/spatial-transformations-maketform-tformfwd-and-tforminv/#comment-22011</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Mon, 27 Jul 2009 13:50:26 +0000</pubDate>
		<guid>http://blogs.mathworks.com/steve/2006/02/14/spatial-transformations-maketform-tformfwd-and-tforminv/#comment-22011</guid>
		<description>Qur&#8212;Do you mean subpixel translation? Then yes, you can do that with &lt;tt&gt;imtransform&lt;/tt&gt; and an affine transformation. Be sure to look at &lt;a href="http://blogs.mathworks.com/steve/2006/07/07/spatial-transformations-translation-confusion/" rel="nofollow"&gt;this post&lt;/a&gt; before you try it, though.</description>
		<content:encoded><![CDATA[<p>Qur&mdash;Do you mean subpixel translation? Then yes, you can do that with <tt>imtransform</tt> and an affine transformation. Be sure to look at <a href="http://blogs.mathworks.com/steve/2006/07/07/spatial-transformations-translation-confusion/" rel="nofollow">this post</a> before you try it, though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: qur</title>
		<link>http://blogs.mathworks.com/steve/2006/02/14/spatial-transformations-maketform-tformfwd-and-tforminv/#comment-22005</link>
		<dc:creator>qur</dc:creator>
		<pubDate>Fri, 24 Jul 2009 10:34:10 +0000</pubDate>
		<guid>http://blogs.mathworks.com/steve/2006/02/14/spatial-transformations-maketform-tformfwd-and-tforminv/#comment-22005</guid>
		<description>Hi steve 

Is it to possible to shift the subpixels in an image ? if possible how ?. Does matlab provide any algorithm for subpixels shifting? 

Regards</description>
		<content:encoded><![CDATA[<p>Hi steve </p>
<p>Is it to possible to shift the subpixels in an image ? if possible how ?. Does matlab provide any algorithm for subpixels shifting? </p>
<p>Regards</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blogs.mathworks.com/steve/2006/02/14/spatial-transformations-maketform-tformfwd-and-tforminv/#comment-21875</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Tue, 16 Jun 2009 13:41:36 +0000</pubDate>
		<guid>http://blogs.mathworks.com/steve/2006/02/14/spatial-transformations-maketform-tformfwd-and-tforminv/#comment-21875</guid>
		<description>Qureshi&#8212;You are calling &lt;tt&gt;tformfwd&lt;/tt&gt; incorrectly. It is expecting its second input to have two columns, but you are passing it [x y], which is a 542-element row vector.  You've got a bug in your indexing offset (181 is wrong), and you are computing x and y as row vectors instead of column vectors.  And there's no need for that for-loop.  Consider doing something like this:

&lt;pre&gt;
th = (-90:90)';
th_r = th*pi/180;
x = cos(th_r)*(8-0.33*th_r.^2);
y = sin(th_r)*(8-0.33*th_r.^2);
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Qureshi&mdash;You are calling <tt>tformfwd</tt> incorrectly. It is expecting its second input to have two columns, but you are passing it [x y], which is a 542-element row vector.  You&#8217;ve got a bug in your indexing offset (181 is wrong), and you are computing x and y as row vectors instead of column vectors.  And there&#8217;s no need for that for-loop.  Consider doing something like this:</p>
<pre>
th = (-90:90)';
th_r = th*pi/180;
x = cos(th_r)*(8-0.33*th_r.^2);
y = sin(th_r)*(8-0.33*th_r.^2);
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: qureshi</title>
		<link>http://blogs.mathworks.com/steve/2006/02/14/spatial-transformations-maketform-tformfwd-and-tforminv/#comment-21874</link>
		<dc:creator>qureshi</dc:creator>
		<pubDate>Tue, 16 Jun 2009 13:26:45 +0000</pubDate>
		<guid>http://blogs.mathworks.com/steve/2006/02/14/spatial-transformations-maketform-tformfwd-and-tforminv/#comment-21874</guid>
		<description>when i follow ur code for rotation i got errors in matlab mentioned at the end ? 

My code is

&lt;pre&gt;
for th=-90:90;
x(th+181)=cos((th*pi)/180)*(8-(0.33*((th*pi)/180))*((th*pi)/180));
y(th+181)=sin((th*pi)/180)*(8-(0.33*((th*pi)/180))*((th*pi)/180));
end
 plot(x,y), axis ij, axis equal, axis([-15 15 -15 15]), grid on
 theta = pi/4;
A2 = [cos(theta) sin(theta) 0; -sin(theta) cos(theta) 0; 0 0 1];
tform2 = maketform('affine', A2);

 uv = tformfwd(tform2, [x y]) %% after the execution of    %%this  line  

and the error appears to be in MATLAB are

??? Error using ==&#62; tform&#62;checkCoordinates at 141
Function TFORMFWD: SIZE(U) is inconsistent with T.ndims_in.

Error in ==&#62; tform at 42
    [U, D] = checkCoordinates( f, P, A{1} );

Error in ==&#62; tformfwd at 68
varargout = tform('fwd', nargout, varargin{:});
&lt;/pre&gt;

Any suggestions ?</description>
		<content:encoded><![CDATA[<p>when i follow ur code for rotation i got errors in matlab mentioned at the end ? </p>
<p>My code is</p>
<pre>
for th=-90:90;
x(th+181)=cos((th*pi)/180)*(8-(0.33*((th*pi)/180))*((th*pi)/180));
y(th+181)=sin((th*pi)/180)*(8-(0.33*((th*pi)/180))*((th*pi)/180));
end
 plot(x,y), axis ij, axis equal, axis([-15 15 -15 15]), grid on
 theta = pi/4;
A2 = [cos(theta) sin(theta) 0; -sin(theta) cos(theta) 0; 0 0 1];
tform2 = maketform('affine', A2);

 uv = tformfwd(tform2, [x y]) %% after the execution of    %%this  line  

and the error appears to be in MATLAB are

??? Error using ==&gt; tform&gt;checkCoordinates at 141
Function TFORMFWD: SIZE(U) is inconsistent with T.ndims_in.

Error in ==&gt; tform at 42
    [U, D] = checkCoordinates( f, P, A{1} );

Error in ==&gt; tformfwd at 68
varargout = tform('fwd', nargout, varargin{:});
</pre>
<p>Any suggestions ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blogs.mathworks.com/steve/2006/02/14/spatial-transformations-maketform-tformfwd-and-tforminv/#comment-21719</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Wed, 29 Apr 2009 12:51:12 +0000</pubDate>
		<guid>http://blogs.mathworks.com/steve/2006/02/14/spatial-transformations-maketform-tformfwd-and-tforminv/#comment-21719</guid>
		<description>imtransform has logic in it that automatic adjusts the size (in X-Y space) of the output pixels in order to keep the dimensions of the output image from growing too large.

To prevent this automatic (and unexpected) adjustment of the output pixel size, specify the 'XYScale' parameter to be 1, like this:

&lt;pre&gt;
newimg = imtransform(oldimg, tform, 'XYScale', 1);
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>imtransform has logic in it that automatic adjusts the size (in X-Y space) of the output pixels in order to keep the dimensions of the output image from growing too large.</p>
<p>To prevent this automatic (and unexpected) adjustment of the output pixel size, specify the &#8216;XYScale&#8217; parameter to be 1, like this:</p>
<pre>
newimg = imtransform(oldimg, tform, 'XYScale', 1);
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xiaohong Zhang</title>
		<link>http://blogs.mathworks.com/steve/2006/02/14/spatial-transformations-maketform-tformfwd-and-tforminv/#comment-21718</link>
		<dc:creator>Xiaohong Zhang</dc:creator>
		<pubDate>Wed, 29 Apr 2009 12:44:19 +0000</pubDate>
		<guid>http://blogs.mathworks.com/steve/2006/02/14/spatial-transformations-maketform-tformfwd-and-tforminv/#comment-21718</guid>
		<description>Dear Steve:

I had wrote the following codes: 
{
xscale = 5;
yscale = 5;

rotation = 30;
oldimg = imread('house.bmp');

theta = rotation*pi/180;
As = [xscale 0; 0 yscale];
Ath = [cos(theta) -sin(theta);sin(theta) cos(theta)];
A = Ath*As;

T = eye(3,3);
T(1:2,1:2)=A;
tform=maketform('affine',T);
newimg = imtransform(oldimg,tform);
size(newimg)
figure,imshow(newimg);
}

My problem is as follows:

As xscale&#62;=2 and yscale&#62;=2, the size of the transfomed image is not the one I expected. In the above example, the size of the origin image is 256X256, however, the new image size is 513X513.</description>
		<content:encoded><![CDATA[<p>Dear Steve:</p>
<p>I had wrote the following codes:<br />
{<br />
xscale = 5;<br />
yscale = 5;</p>
<p>rotation = 30;<br />
oldimg = imread(&#8217;house.bmp&#8217;);</p>
<p>theta = rotation*pi/180;<br />
As = [xscale 0; 0 yscale];<br />
Ath = [cos(theta) -sin(theta);sin(theta) cos(theta)];<br />
A = Ath*As;</p>
<p>T = eye(3,3);<br />
T(1:2,1:2)=A;<br />
tform=maketform(&#8217;affine&#8217;,T);<br />
newimg = imtransform(oldimg,tform);<br />
size(newimg)<br />
figure,imshow(newimg);<br />
}</p>
<p>My problem is as follows:</p>
<p>As xscale&gt;=2 and yscale&gt;=2, the size of the transfomed image is not the one I expected. In the above example, the size of the origin image is 256X256, however, the new image size is 513X513.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blogs.mathworks.com/steve/2006/02/14/spatial-transformations-maketform-tformfwd-and-tforminv/#comment-21383</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Tue, 13 Jan 2009 13:32:08 +0000</pubDate>
		<guid>http://blogs.mathworks.com/steve/2006/02/14/spatial-transformations-maketform-tformfwd-and-tforminv/#comment-21383</guid>
		<description>Tomy&#8212;I can't help you with your remapping function definition, but once you get that worked out, take a look at my post on &lt;a href="http://blogs.mathworks.com/steve/2006/08/04/spatial-transformations-defining-and-applying-custom-transforms/" rel="nofollow"&gt;custom spatial transformations&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>Tomy&mdash;I can&#8217;t help you with your remapping function definition, but once you get that worked out, take a look at my post on <a href="http://blogs.mathworks.com/steve/2006/08/04/spatial-transformations-defining-and-applying-custom-transforms/" rel="nofollow">custom spatial transformations</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tomy</title>
		<link>http://blogs.mathworks.com/steve/2006/02/14/spatial-transformations-maketform-tformfwd-and-tforminv/#comment-21378</link>
		<dc:creator>Tomy</dc:creator>
		<pubDate>Mon, 12 Jan 2009 15:57:49 +0000</pubDate>
		<guid>http://blogs.mathworks.com/steve/2006/02/14/spatial-transformations-maketform-tformfwd-and-tforminv/#comment-21378</guid>
		<description>I'm really sorry but the squared rings have not been shown as I wanted.
The first ring had a 44u of outer perimeter and 16u of inner perimeter,the second one is 52u of outer perimeter and 12u of inner. This is just an example for explaining what the function should do.</description>
		<content:encoded><![CDATA[<p>I&#8217;m really sorry but the squared rings have not been shown as I wanted.<br />
The first ring had a 44u of outer perimeter and 16u of inner perimeter,the second one is 52u of outer perimeter and 12u of inner. This is just an example for explaining what the function should do.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tomy</title>
		<link>http://blogs.mathworks.com/steve/2006/02/14/spatial-transformations-maketform-tformfwd-and-tforminv/#comment-21377</link>
		<dc:creator>Tomy</dc:creator>
		<pubDate>Mon, 12 Jan 2009 15:51:36 +0000</pubDate>
		<guid>http://blogs.mathworks.com/steve/2006/02/14/spatial-transformations-maketform-tformfwd-and-tforminv/#comment-21377</guid>
		<description>Steve,
Probably I was not clear enought in the explanation of my question, so let me show you in a simple way the transformation I am looking for:

Suposse I have a squared ring as shown next,

&lt;pre&gt;
%    ________17_______
%   &#124;      _____      &#124;
%   &#124;     &#124;     &#124;     &#124;5
%   &#124;     &#124;     &#124;3    &#124;
%   &#124;     &#124;__5__&#124;     &#124;  2*(5+17) units of outer perimeter
%   &#124;_________________&#124;  2*(3+5) units of inner perimeter
&lt;/pre&gt;

The function I am trying to design should out a result similar to the next figure,

&lt;pre&gt;
%   _________20_________
%  &#124;                    &#124; 
%  &#124;        ____        &#124;6
%  &#124;       &#124;    &#124;2      &#124; 
%  &#124;       &#124;_4__&#124;       &#124;
%  &#124;                    &#124;  2*(6+20) units of outer perimeter
%  &#124;____________________&#124;  2*(2+4) units of inner perimeter
&lt;/pre&gt;

The main problem I have is that I don't know how to remap the image in order to obtain those results. 
I though in determining the euclidean distance from the image pixels to the background and try to expand the evaluated pixels towards the direcction where such distance is minimum but I dont know how to expand/contract the pixels according with the object boundary location in a coherent way.
Maybe there is no relation with the imopen funtcion I mentioned in the last question but I've shown by using the imdilate the results are quite similar as I need, however, the output image is blurred.

Thanks</description>
		<content:encoded><![CDATA[<p>Steve,<br />
Probably I was not clear enought in the explanation of my question, so let me show you in a simple way the transformation I am looking for:</p>
<p>Suposse I have a squared ring as shown next,</p>
<pre>
%    ________17_______
%   |      _____      |
%   |     |     |     |5
%   |     |     |3    |
%   |     |__5__|     |  2*(5+17) units of outer perimeter
%   |_________________|  2*(3+5) units of inner perimeter
</pre>
<p>The function I am trying to design should out a result similar to the next figure,</p>
<pre>
%   _________20_________
%  |                    |
%  |        ____        |6
%  |       |    |2      |
%  |       |_4__|       |
%  |                    |  2*(6+20) units of outer perimeter
%  |____________________|  2*(2+4) units of inner perimeter
</pre>
<p>The main problem I have is that I don&#8217;t know how to remap the image in order to obtain those results.<br />
I though in determining the euclidean distance from the image pixels to the background and try to expand the evaluated pixels towards the direcction where such distance is minimum but I dont know how to expand/contract the pixels according with the object boundary location in a coherent way.<br />
Maybe there is no relation with the imopen funtcion I mentioned in the last question but I&#8217;ve shown by using the imdilate the results are quite similar as I need, however, the output image is blurred.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blogs.mathworks.com/steve/2006/02/14/spatial-transformations-maketform-tformfwd-and-tforminv/#comment-21370</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Mon, 12 Jan 2009 13:01:48 +0000</pubDate>
		<guid>http://blogs.mathworks.com/steve/2006/02/14/spatial-transformations-maketform-tformfwd-and-tforminv/#comment-21370</guid>
		<description>Tomy&#8212;I don't see any connection between your image transform description and imopen. Regarding the pixel resolution, you might want to look at my post about &lt;a href="http://blogs.mathworks.com/steve/2006/08/01/spatial-transformations-controlling-the-input-and-output-grids-with-imtransform/" rel="nofollow"&gt;controlling the input and output grids with imtransform&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>Tomy&mdash;I don&#8217;t see any connection between your image transform description and imopen. Regarding the pixel resolution, you might want to look at my post about <a href="http://blogs.mathworks.com/steve/2006/08/01/spatial-transformations-controlling-the-input-and-output-grids-with-imtransform/" rel="nofollow">controlling the input and output grids with imtransform</a>.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
