[vtkusers] vtkImageData Reflection

Cory Quammen cory.quammen at kitware.com
Mon Jan 26 08:53:37 EST 2015


I don't know if that's a supremely bad idea, but it may make life
complicated if you want to display anything else besides the image :-)

It might be safest to just flip the image with the vtkImageFlip filter or
flip the order of pixels in the incoming image yourself.

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

>  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>
> Date: mandag 26. januar 2015 14.45
> To: Cameron Lowell Palmer <cameron.palmer at ntnu.no>
> Cc: VTK Users <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> 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.
>



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


More information about the vtkusers mailing list