<div dir="ltr">Hmm.  I just checked, and for vtkJPEGReader, FileLowerLeft doesn&#39;t do anything.  In order to get the image into its original orientation (i.e. so that pixel (0,0) is at the top left of the image) you will have to apply the vtkImageFlip filter to the image after reading it.<div>

<br></div><div>If you are curious, the code in vtkJPEGReader.cxx that flips the image is this:</div><div><br></div><div><div>  // copy the data into the outPtr</div><div>  OT *outPtr2 = outPtr;</div><div>  long outSize = cinfo.output_components*(outExt[1] - outExt[0] + 1);</div>

<div>  for (int i = outExt[2]; i &lt;= outExt[3]; ++i)</div><div>    {</div><div>    memcpy(outPtr2,</div><div>           row_pointers[cinfo.output_height - i - 1]</div><div>           + outExt[0]*cinfo.output_components,</div>

<div>           outSize);</div><div>    outPtr2 += outInc[1];</div><div>    }</div><div><br></div><div style>There is similar image-flipping code in vtkPNGReader and pretty much every VTK reader that reads a file format that specifies that pixel (0,0) is at the top left corner.</div>

<div style><br></div><div style> - David</div><div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 16, 2013 at 5:49 PM, ChenDawnWind <span dir="ltr">&lt;<a href="mailto:cybfly1@hotmail.com" target="_blank">cybfly1@hotmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


<div><div dir="ltr">Thanks.But even if i set up FileLowerLeftOn. The contour still fliped.<div>Here are the codes i used, is there any problem? </div><div><br><div><div><div><span style="white-space:pre-wrap">        </span>vtkSmartPointer&lt;vtkJPEGReader&gt; jpegReader =</div>

<div><span style="white-space:pre-wrap">                </span>vtkSmartPointer&lt;vtkJPEGReader&gt;::New();  </div><div><span style="white-space:pre-wrap">        </span>jpegReader-&gt;FileLowerLeftOn();</div><div><span style="white-space:pre-wrap">        </span>jpegReader-&gt;SetFilePrefix(&quot;C:/Users/DawnWind/Desktop/000/&quot;);</div>

<div><span style="white-space:pre-wrap">        </span>jpegReader-&gt;SetFilePattern(&quot;%s%d.jpg&quot;);</div><div><span style="white-space:pre-wrap">        </span>jpegReader-&gt;SetDataByteOrderToLittleEndian();</div><div><span style="white-space:pre-wrap">        </span>jpegReader-&gt;SetDataSpacing(2.0 / 3, 2.0 / 3, 1); </div>

<div><span style="white-space:pre-wrap">        </span>jpegReader-&gt;SetFileNameSliceSpacing(1); </div><div><span style="white-space:pre-wrap">        </span>jpegReader-&gt;SetDataExtent(0, 209, 0, 209, 0, 0);</div><div><span style="white-space:pre-wrap">        </span>jpegReader-&gt;Update(); </div>

<div><br></div><div><br></div><div><div>The full codes please see the <i>attachments in</i></div><div><br></div><div><a href="https://blu175.mail.live.com/mail/17.0.6156.0403/Compose/RteFrameResources.aspx?ch=8824048901591138608&amp;mkt=zh-cn" style="line-height:19px;text-decoration:none;color:rgb(0,114,198);font-family:&#39;Microsoft Yahei&#39;,Verdana,Simsun,&#39;Segoe UI&#39;,&#39;Segoe UI Web Regular&#39;,&#39;Segoe UI Symbol&#39;,&#39;Helvetica Neue&#39;,&#39;BBAlpha Sans&#39;,&#39;S60 Sans&#39;,Arial,sans-serif;font-size:14px;min-height:1px;width:1px;display:block;outline:none" target="_blank"></a><div style="line-height:19px;margin:5px 0px;color:rgb(68,68,68);font-family:&#39;Microsoft Yahei&#39;,Verdana,Simsun,&#39;Segoe UI&#39;,&#39;Segoe UI Web Regular&#39;,&#39;Segoe UI Symbol&#39;,&#39;Helvetica Neue&#39;,&#39;BBAlpha Sans&#39;,&#39;S60 Sans&#39;,Arial,sans-serif;font-size:14px">

<ul style="margin-right:0px;margin-left:0px;padding-right:0px;padding-left:0px;list-style:none"><li style="margin:10px 0px 0px;float:right;display:block;white-space:nowrap;min-height:16px"><a href="https://blu175.mail.live.com/mail/#" title="?? ??(Esc)" style="text-decoration:none;color:rgb(0,114,198);padding:0px 0px 0px 6px;display:block;margin-bottom:0px" target="_blank"><img alt="????" style="border: none; width: 11px; min-height: 11px; background-image: url(https://mail.google.com/mail/u/0/?ui=2&amp;shva=1); background-color: transparent; overflow: hidden; background-repeat: no-repeat no-repeat;"></a></li>

<li style="margin:11px 0px 0px;float:right;display:block;white-space:nowrap;min-height:16px"><span><a title="?????(Ctrl+.)" href="https://blu175.mail.live.com/mail/#" style="text-decoration:none;color:rgb(0,114,198);padding:0px 2px;display:block;margin-bottom:0px" target="_blank"><img title="?????(Ctrl+.)" alt="?????" style="border: none; width: 16px; min-height: 16px; background-image: url(https://mail.google.com/mail/u/0/?ui=2&amp;shva=1); background-color: transparent; overflow: hidden; background-repeat: no-repeat no-repeat;"></a></span></li>

<li style="margin:11px 0px 0px;float:right;display:block;white-space:nowrap;min-height:16px"><span style="display:block;padding:0px 3px;color:rgb(0,0,0);margin-bottom:0px"><img alt="?????" style="width: 16px; min-height: 16px; background-image: url(https://mail.google.com/mail/u/0/?ui=2&amp;shva=1); background-color: transparent; overflow: hidden; background-repeat: no-repeat no-repeat;"></span></li>

<li style="margin:0px"><h2 style="line-height:29px;font-size:21px;font-family:&#39;Microsoft Yahei&#39;,Verdana,Simsun,&#39;Segoe UI Web Light&#39;,&#39;Segoe UI Light&#39;,&#39;Segoe UI Web Regular&#39;,&#39;Segoe UI&#39;,&#39;Segoe UI Symbol&#39;,&#39;Helvetica Neue&#39;,Arial;font-weight:normal;margin:0px 0px 14px;padding-top:1px">

Re: [vtkusers] vtkPointWidget set the right position</h2><div><a style="color:rgb(0,0,0);white-space:nowrap">from Chen DawnWind</a><span style="white-space:nowrap"> (<a href="mailto:cybfly1@hotmail.com" target="_blank">cybfly1@hotmail.com</a>)</span></div>

<div><span style="white-space:nowrap"><br></span></div><div><span style="white-space:nowrap">Thanks.</span></div><div><span style="white-space:nowrap"><br></span></div></li></ul></div></div></div>DawnWind.Chen<div>CSU</div>

<br><br><div><div></div>&gt; From: <a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a><br>&gt; Date: Tue, 16 Apr 2013 15:30:34 -0600<br>&gt; To: <a href="mailto:vtkusers@vtk.org" target="_blank">vtkusers@vtk.org</a><br>

&gt; Subject: Re: [vtkusers] Readers read image with some kind of reveral?<div><div class="h5"><br>&gt; <br>&gt; On Tue, Apr 16, 2013 at 10:17 AM, David Doria &lt;<a href="mailto:daviddoria@gmail.com" target="_blank">daviddoria@gmail.com</a>&gt; wrote:<br>

&gt; &gt; On Tue, Apr 16, 2013 at 11:45 AM, ChenDawnWind &lt;<a href="mailto:cybfly1@hotmail.com" target="_blank">cybfly1@hotmail.com</a>&gt; wrote:<br>&gt; &gt;&gt; Hi everyone,<br>&gt; &gt;&gt; when i use the reader such as vtkJPEGReader to read one image file(see<br>

&gt; &gt;&gt; attachment) and extract the contour of<br>&gt; &gt;&gt; the img, then read the result output and print the points with OpenCV.<br>&gt; &gt;&gt; Then i found the image was not the way it used to be.<br>&gt; &gt;&gt; In the attachment the original image is number 1, and the contour image is<br>

&gt; &gt;&gt; number 2.<br>&gt; &gt;&gt; It is clear that the image reversal in some way.<br>&gt; &gt;&gt; Cause i have to set the point of the contour in the 3D model,<br>&gt; &gt;&gt; with this revesal the calculated center of the white target in the the<br>

&gt; &gt;&gt; original image was not suit the reveral image 2.<br>&gt; &gt;&gt; So i wanna know is there any way to avoid this revesal and to read file as<br>&gt; &gt;&gt; it used to be?<br>&gt; &gt;&gt; Thanks!<br>&gt; &gt;&gt;<br>

&gt; &gt;&gt; DawnWind.Chen<br>&gt; &gt;&gt; CSU<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; It looks to me like you are just viewing the points from a different<br>&gt; &gt; viewpoint. If you want to change the view on the VTK side of things,<br>

&gt; &gt; check out:<br>&gt; &gt; <a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/vtkCamera" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/vtkCamera</a><br>&gt; &gt;<br>&gt; &gt; for how to position and aim the camera.<br>

&gt; &gt;<br>&gt; &gt; David<br>&gt; <br>&gt; I don&#39;t think this is a camera issue.  The vtkJPEGReader does in fact<br>&gt; flip the image.  In JPEG the first pixel is at the upper left corner<br>&gt; of the image, while VTK&#39;s 2D coordinate system (the one used for<br>

&gt; vtkActor2D) has the first pixel at the lower left corner of the<br>&gt; renderer.  The reader flips the image so that it appears the right way<br>&gt; up on the screen when displayed with vtkImageViewer.  This flip of<br>

&gt; course means that the coordinates of any points that you get from<br>&gt; contouring the image will be flipped top-to-bottom.<br>&gt; <br>&gt; For some readers, you can call FileLowerLeftOn() to stop the reader<br>&gt; from flipping the image.<br>

&gt; <br>&gt;  - David<br></div></div><div class="im"><br></div></div></div></div></div></div></div></blockquote></div></div></div></div></div></div></div>