<?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: Spatial transformations: Translation confusion</title>
	<atom:link href="http://blogs.mathworks.com/steve/2006/07/07/spatial-transformations-translation-confusion/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.mathworks.com/steve/2006/07/07/spatial-transformations-translation-confusion/</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 Eddins</title>
		<link>http://blogs.mathworks.com/steve/2006/07/07/spatial-transformations-translation-confusion/#comment-24765</link>
		<dc:creator>Steve Eddins</dc:creator>
		<pubDate>Thu, 29 Dec 2011 13:18:40 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/?p=68#comment-24765</guid>
		<description>Einat&#8212;In the &lt;a href=&quot;http://www.mathworks.com/help/toolbox/images/ref/imtransform.html&quot; rel=&quot;nofollow&quot;&gt;imtransform documentation&lt;/a&gt;, see the &quot;Pure translation&quot; section under &quot;Tips.&quot;</description>
		<content:encoded><![CDATA[<p>Einat&mdash;In the <a href="http://www.mathworks.com/help/toolbox/images/ref/imtransform.html" rel="nofollow">imtransform documentation</a>, see the &#8220;Pure translation&#8221; section under &#8220;Tips.&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Einat</title>
		<link>http://blogs.mathworks.com/steve/2006/07/07/spatial-transformations-translation-confusion/#comment-24759</link>
		<dc:creator>Einat</dc:creator>
		<pubDate>Tue, 27 Dec 2011 20:40:50 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/?p=68#comment-24759</guid>
		<description>Finally found this solution! Been looking for this for so long! thanks. Would be nice if it was mentioned as part of the Help for &quot;cpselect&quot; and &quot;imtransform&quot; :)</description>
		<content:encoded><![CDATA[<p>Finally found this solution! Been looking for this for so long! thanks. Would be nice if it was mentioned as part of the Help for &#8220;cpselect&#8221; and &#8220;imtransform&#8221; :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blogs.mathworks.com/steve/2006/07/07/spatial-transformations-translation-confusion/#comment-23344</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Tue, 10 Aug 2010 16:53:23 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/?p=68#comment-23344</guid>
		<description>Chew&#8212;You&#039;ll need to say more. What exactly did you try, and why were the results not satisfactory?</description>
		<content:encoded><![CDATA[<p>Chew&mdash;You&#8217;ll need to say more. What exactly did you try, and why were the results not satisfactory?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chew</title>
		<link>http://blogs.mathworks.com/steve/2006/07/07/spatial-transformations-translation-confusion/#comment-23343</link>
		<dc:creator>Chew</dc:creator>
		<pubDate>Tue, 10 Aug 2010 15:13:53 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/?p=68#comment-23343</guid>
		<description>hi

I am trying to model simple translation on the image by step of non-integer value (eg 2.5 pixel). I was hoping if you can provide me some guidance as I tried imtransform of that translation matrix and using bicubic interpolation but the image is different that expected. There are shades that wasn&#039;t supposed to be there. Hope to hear  from you soon.

Thanks.

Regards,
Chew</description>
		<content:encoded><![CDATA[<p>hi</p>
<p>I am trying to model simple translation on the image by step of non-integer value (eg 2.5 pixel). I was hoping if you can provide me some guidance as I tried imtransform of that translation matrix and using bicubic interpolation but the image is different that expected. There are shades that wasn&#8217;t supposed to be there. Hope to hear  from you soon.</p>
<p>Thanks.</p>
<p>Regards,<br />
Chew</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blogs.mathworks.com/steve/2006/07/07/spatial-transformations-translation-confusion/#comment-23272</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Tue, 13 Jul 2010 15:55:43 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/?p=68#comment-23272</guid>
		<description>Chris&#8212;Thanks for your input. We recognize that the automatic scale change behavior in imtransform is frequently confusing and we are taking steps to address this.</description>
		<content:encoded><![CDATA[<p>Chris&mdash;Thanks for your input. We recognize that the automatic scale change behavior in imtransform is frequently confusing and we are taking steps to address this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://blogs.mathworks.com/steve/2006/07/07/spatial-transformations-translation-confusion/#comment-23271</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Tue, 13 Jul 2010 14:52:07 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/?p=68#comment-23271</guid>
		<description>I noticed you are looking for recommendations on how to implement imtransform.  I would recommend an optional parameter in imtransform that causes the returned image to be exactly what is expected, including the expected translation and one-to-one pixel mapping.  I know there is a concern about exceeding memory limitations, but if this occurs, the error Matlab gives is very clear on the cause of the error.</description>
		<content:encoded><![CDATA[<p>I noticed you are looking for recommendations on how to implement imtransform.  I would recommend an optional parameter in imtransform that causes the returned image to be exactly what is expected, including the expected translation and one-to-one pixel mapping.  I know there is a concern about exceeding memory limitations, but if this occurs, the error Matlab gives is very clear on the cause of the error.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://blogs.mathworks.com/steve/2006/07/07/spatial-transformations-translation-confusion/#comment-23270</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Tue, 13 Jul 2010 14:13:43 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/?p=68#comment-23270</guid>
		<description>Of course, I figured it out shortly after sending that message.  The relatively large distance between my basePoints and inputPoints increases the condition number and triggers imtransform to stop mapping pixels 1-to-1 in order to reduce output image size.  By using &lt;pre&gt;imtransform(...,&#039;XYScale&#039;,1)&lt;/pre&gt;the problem is fixed.  Documented feature.</description>
		<content:encoded><![CDATA[<p>Of course, I figured it out shortly after sending that message.  The relatively large distance between my basePoints and inputPoints increases the condition number and triggers imtransform to stop mapping pixels 1-to-1 in order to reduce output image size.  By using
<pre>imtransform(...,'XYScale',1)</pre>
</p><p>the problem is fixed.  Documented feature.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blogs.mathworks.com/steve/2006/07/07/spatial-transformations-translation-confusion/#comment-23268</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Tue, 13 Jul 2010 12:35:50 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/?p=68#comment-23268</guid>
		<description>Chris&#8212;Please &lt;a href=&quot;http://www.mathworks.com/support/contact_us/index.html&quot; rel=&quot;nofollow&quot;&gt;contact technical support&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>Chris&mdash;Please <a href="http://www.mathworks.com/support/contact_us/index.html" rel="nofollow">contact technical support</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://blogs.mathworks.com/steve/2006/07/07/spatial-transformations-translation-confusion/#comment-23262</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Mon, 12 Jul 2010 20:12:01 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/?p=68#comment-23262</guid>
		<description>The code below illustrates a problem I&#039;m having with imtransform.  I do not see why I get a correct transform with the first set of input points, but not with the second set.  Also, I don&#039;t know what it is about the four pairs of control points that make the condition number so high.  Any help or ideas would be greatly appreciated.

&lt;pre&gt;
close all;clear all;

% User inputs
inputSet = 2;           % 1 for a set of input points that works, 2 for a set that does not work
numRows = 378;          % Rows in original image
numCols = 570;          % Cols in original image
featureRow = 370;    % Row location of a feature
featureCol = 560;    % Col location of a feature

% Define basePoints and inputPoints
basePoints =[143    95; 428    95; 143   284; 428   284];
if inputSet == 1
    inputPoints = [-2715.562638664548   388.123635347757; -2125.110248447010 397.956744564281; ...
        -2687.235992046404 670.251779320847; -2109.030835350265 646.991296648817];
elseif inputSet == 2  
    inputPoints = [-2841.364192843382   392.571575290416; -2232.168660713694 402.270514363645; ...
        -2811.962711649763 679.351410803620; -2215.607991122505 654.591857089487];
    % Note: inputSet 2 works if you remove the average row and column locations in inputPoints 
    % (commented out below). I don&#039;t understand why this should make a difference
        % inputPoints(:,1) = inputPoints(:,1) - mean(inputPoints(:,1));
        % inputPoints(:,2) = inputPoints(:,2) - mean(inputPoints(:,2));
end

% Plot basePoints and inputPoints
figure;plot(basePoints(:,1),basePoints(:,2),&#039;b+&#039;);
hold on;
plot(inputPoints(:,1),inputPoints(:,2),&#039;g+&#039;);

% Compute tform
tform = cp2tform(inputPoints,basePoints,&#039;projective&#039;);

% Compute condition number.  It is very high, even though this appears to be a straightforward 
% transform (see plot above)
conditionNum = cond(tform.tdata.T)

% Create image.  Outlined with 1&#039;s.  Feature is a 3x3 region of 2&#039;s.
originalImage = zeros(numRows,numCols);
originalImage(1,:) = 1;
originalImage(numRows,:) = 1;
originalImage(:,1) = 1;
originalImage(:,numCols) = 1;
originalImage(featureRow-1:featureRow+1,featureCol-1:featureCol+1,:) = 2;

% Transform the image
[tformedImage,colData,rowData] = imtransform(originalImage,tform,&#039;nearest&#039;);

% Locate the feature
[rowIndices,colIndices] = find(tformedImage(:,:,1)==2);
tformedFeatureCol = colData(1) + mean(colIndices) - 1
tformedFeatureRow = rowData(1) + mean(rowIndices) - 1

% Now perform a manual calculation of where the feature should be located
tformedPoint = tform.tdata.T&#039;*[featureCol;featureRow;1];
expectedTformedCol = tformedPoint(1)/tformedPoint(3)
expectedTformedRow = tformedPoint(2)/tformedPoint(3)

% Compute error in feature location
colError = tformedFeatureCol - expectedTformedCol
rowError = tformedFeatureRow - expectedTformedRow
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>The code below illustrates a problem I&#8217;m having with imtransform.  I do not see why I get a correct transform with the first set of input points, but not with the second set.  Also, I don&#8217;t know what it is about the four pairs of control points that make the condition number so high.  Any help or ideas would be greatly appreciated.</p>
<pre>
close all;clear all;

% User inputs
inputSet = 2;           % 1 for a set of input points that works, 2 for a set that does not work
numRows = 378;          % Rows in original image
numCols = 570;          % Cols in original image
featureRow = 370;    % Row location of a feature
featureCol = 560;    % Col location of a feature

% Define basePoints and inputPoints
basePoints =[143    95; 428    95; 143   284; 428   284];
if inputSet == 1
    inputPoints = [-2715.562638664548   388.123635347757; -2125.110248447010 397.956744564281; ...
        -2687.235992046404 670.251779320847; -2109.030835350265 646.991296648817];
elseif inputSet == 2
    inputPoints = [-2841.364192843382   392.571575290416; -2232.168660713694 402.270514363645; ...
        -2811.962711649763 679.351410803620; -2215.607991122505 654.591857089487];
    % Note: inputSet 2 works if you remove the average row and column locations in inputPoints
    % (commented out below). I don't understand why this should make a difference
        % inputPoints(:,1) = inputPoints(:,1) - mean(inputPoints(:,1));
        % inputPoints(:,2) = inputPoints(:,2) - mean(inputPoints(:,2));
end

% Plot basePoints and inputPoints
figure;plot(basePoints(:,1),basePoints(:,2),'b+');
hold on;
plot(inputPoints(:,1),inputPoints(:,2),'g+');

% Compute tform
tform = cp2tform(inputPoints,basePoints,'projective');

% Compute condition number.  It is very high, even though this appears to be a straightforward
% transform (see plot above)
conditionNum = cond(tform.tdata.T)

% Create image.  Outlined with 1's.  Feature is a 3x3 region of 2's.
originalImage = zeros(numRows,numCols);
originalImage(1,:) = 1;
originalImage(numRows,:) = 1;
originalImage(:,1) = 1;
originalImage(:,numCols) = 1;
originalImage(featureRow-1:featureRow+1,featureCol-1:featureCol+1,:) = 2;

% Transform the image
[tformedImage,colData,rowData] = imtransform(originalImage,tform,'nearest');

% Locate the feature
[rowIndices,colIndices] = find(tformedImage(:,:,1)==2);
tformedFeatureCol = colData(1) + mean(colIndices) - 1
tformedFeatureRow = rowData(1) + mean(rowIndices) - 1

% Now perform a manual calculation of where the feature should be located
tformedPoint = tform.tdata.T'*[featureCol;featureRow;1];
expectedTformedCol = tformedPoint(1)/tformedPoint(3)
expectedTformedRow = tformedPoint(2)/tformedPoint(3)

% Compute error in feature location
colError = tformedFeatureCol - expectedTformedCol
rowError = tformedFeatureRow - expectedTformedRow
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blogs.mathworks.com/steve/2006/07/07/spatial-transformations-translation-confusion/#comment-22912</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Thu, 25 Mar 2010 18:45:02 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/steve/?p=68#comment-22912</guid>
		<description>If you can successfully segment the object, then you can assign its pixel values somewhere else in the image.  Of course, you&#039;ll have to fill in the gap in the original object location.  You might take a look at roifill.</description>
		<content:encoded><![CDATA[<p>If you can successfully segment the object, then you can assign its pixel values somewhere else in the image.  Of course, you&#8217;ll have to fill in the gap in the original object location.  You might take a look at roifill.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

