[vtkusers] vtkImageData Reflection

Cameron Lowell Palmer cameron.palmer at ntnu.no
Mon Jan 26 08:49:35 EST 2015


On a scale of 1 to supremely bad idea, how about flipping the location of the camera and view up?

I did precisely that by making the camera face the positive z-axis, this also required me to flip the Y-Axis by changing the view up. I thought the issue was that the camera facing the negative z-axis and therefore was seeing the backside of the image.

cameron

From: Cory Quammen <cory.quammen at kitware.com<mailto:cory.quammen at kitware.com>>
Date: mandag 26. januar 2015 14.45
To: Cameron Lowell Palmer <cameron.palmer at ntnu.no<mailto:cameron.palmer at ntnu.no>>
Cc: VTK Users <vtkusers at vtk.org<mailto:vtkusers at vtk.org>>
Subject: Re: [vtkusers] vtkImageData Reflection

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<mailto: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<http://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/8e9060db/attachment.html>


More information about the vtkusers mailing list