[vtkusers] vtkImageData Reflection

Cory Quammen cory.quammen at kitware.com
Mon Jan 26 08:45:17 EST 2015


Cameron,

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.

HTH,
Cory

On Mon, Jan 26, 2015 at 7:29 AM, Cameron Lowell Palmer <
cameron.palmer at ntnu.no> wrote:

>  When receiving a camera frame I’m converting to vtkImageData like this:
>
>      auto imageImport = vtkSmartPointer<vtkImageImport>::New();
>     imageImport->SetDataSpacing(1.0f, 1.0f, 1.0f);
>     imageImport->SetDataOrigin(0.f, 0.f, 0.f);
>     imageImport->SetWholeExtent(0.f, videoFrame.width - 1.f, 0.f,
> videoFrame.height - 1.f, 0.f, 0.f);
>      imageImport->SetDataExtentToWholeExtent();
>      imageImport->SetDataScalarTypeToUnsignedChar();
>      imageImport->SetNumberOfScalarComponents(4);
>     imageImport->SetImportVoidPointer(videoFrame.rawPixelData);
>     imageImport->Update();
>
>      vtkSmartPointer<vtkImageData> imageData = imageImport->GetOutput();
>
>  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?
>
>  cameron
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
>
>


-- 
Cory Quammen
R&D Engineer
Kitware, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150126/bd255bc8/attachment.html>


More information about the vtkusers mailing list