<div dir="ltr">Cameron,<div><br></div><div>It looks like your camera's convention for image origin and VTK's disagree. You could correct it in the display by scaling the reversed axis of the actor that displays the image by -1, or you can flip the data after import with a vtkImageFlip filiter.</div><div><br></div><div>HTH,</div><div>Cory</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 26, 2015 at 7:29 AM, Cameron Lowell Palmer <span dir="ltr"><<a href="mailto:cameron.palmer@ntnu.no" target="_blank">cameron.palmer@ntnu.no</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div style="word-wrap:break-word">
<div style="margin:0px;font-size:11px;font-family:Menlo">When receiving a camera frame I’m converting to vtkImageData like this:</div>
<div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(112,61,170)">
<span style="color:#000000"><br>
</span></div>
<div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(112,61,170)">
<span style="color:#000000">    </span><span style="color:#bb2ca2">auto</span><span style="color:#000000">
 imageImport = </span>vtkSmartPointer<span style="color:#000000"><</span>vtkImageImport<span style="color:#000000">>::</span><span style="color:#3d1d81">New</span><span style="color:#000000">();</span></div>
<div style="margin:0px;font-size:11px;font-family:Menlo">    imageImport-><span style="color:#3d1d81">SetDataSpacing</span>(<span style="color:#272ad8">1.0f</span>,
<span style="color:#272ad8">
1.0f</span>, <span style="color:#272ad8">
1.0f</span>);</div>
<div style="margin:0px;font-size:11px;font-family:Menlo">    imageImport-><span style="color:#3d1d81">SetDataOrigin</span>(<span style="color:#272ad8">0.f</span>,
<span style="color:#272ad8">
0.f</span>, <span style="color:#272ad8">
0.f</span>);</div>
<div style="margin:0px;font-size:11px;font-family:Menlo">    imageImport-><span style="color:#3d1d81">SetWholeExtent</span>(<span style="color:#272ad8">0.f</span>,
 videoFrame.<span style="color:#4f8187">width</span> -
<span style="color:#272ad8">
1.f</span>, <span style="color:#272ad8">
0.f</span>, videoFrame.<span style="color:#4f8187">height</span> -
<span style="color:#272ad8">
1.f</span>, <span style="color:#272ad8">
0.f</span>, <span style="color:#272ad8">
0.f</span>);</div>
<div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(61,29,129)">
<span style="color:#000000">    imageImport-></span>SetDataExtentToWholeExtent<span style="color:#000000">();</span></div>
<div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(61,29,129)">
<span style="color:#000000">    imageImport-></span>SetDataScalarTypeToUnsignedChar<span style="color:#000000">();</span></div>
<div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(61,29,129)">
<span style="color:#000000">    imageImport-></span>SetNumberOfScalarComponents<span style="color:#000000">(</span><span style="color:#272ad8">4</span><span style="color:#000000">);</span></div>
<div style="margin:0px;font-size:11px;font-family:Menlo">    imageImport-><span style="color:#3d1d81">SetImportVoidPointer</span>(videoFrame.<span style="color:#4f8187">rawPixelData</span>);</div>
<div style="margin:0px;font-size:11px;font-family:Menlo">    imageImport-><span style="color:#3d1d81">Update</span>();</div>
<div style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px">
<br>
</div>
<div style="margin:0px;font-size:11px;font-family:Menlo">    <span style="color:#703daa">
vtkSmartPointer</span><<span style="color:#703daa">vtkImageData</span>> imageData = imageImport-><span style="color:#3d1d81">GetOutput</span>();</div>
<div style="margin:0px;font-size:11px;font-family:Menlo"><br>
</div>
<div style="margin:0px;font-size:11px;font-family:Menlo">It works, but adding this to an image plane the image is mirrored across the Y-axis (right-left). Am I doing this image conversion correctly?</div><span class="HOEnZb"><font color="#888888">
<div style="margin:0px;font-size:11px;font-family:Menlo"><br>
</div>
<div style="margin:0px;font-size:11px;font-family:Menlo">cameron</div>
</font></span></div>

<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Cory Quammen<br>R&D Engineer<br>Kitware, Inc.</div>
</div>