[vtkusers] Readers read image with some kind of reveral?
ChenDawnWind
cybfly1 at hotmail.com
Tue Apr 16 19:49:13 EDT 2013
Thanks.But even if i set up FileLowerLeftOn. The contour still fliped.Here are the codes i used, is there any problem?
vtkSmartPointer<vtkJPEGReader> jpegReader = vtkSmartPointer<vtkJPEGReader>::New(); jpegReader->FileLowerLeftOn(); jpegReader->SetFilePrefix("C:/Users/DawnWind/Desktop/000/"); jpegReader->SetFilePattern("%s%d.jpg"); jpegReader->SetDataByteOrderToLittleEndian(); jpegReader->SetDataSpacing(2.0 / 3, 2.0 / 3, 1); jpegReader->SetFileNameSliceSpacing(1); jpegReader->SetDataExtent(0, 209, 0, 209, 0, 0); jpegReader->Update();
The full codes please see the attachments in
Re: [vtkusers] vtkPointWidget set the right positionfrom Chen DawnWind (cybfly1 at hotmail.com)
Thanks.
DawnWind.ChenCSU
> From: david.gobbi at gmail.com
> Date: Tue, 16 Apr 2013 15:30:34 -0600
> To: vtkusers at vtk.org
> Subject: Re: [vtkusers] Readers read image with some kind of reveral?
>
> On Tue, Apr 16, 2013 at 10:17 AM, David Doria <daviddoria at gmail.com> wrote:
> > On Tue, Apr 16, 2013 at 11:45 AM, ChenDawnWind <cybfly1 at hotmail.com> wrote:
> >> Hi everyone,
> >> when i use the reader such as vtkJPEGReader to read one image file(see
> >> attachment) and extract the contour of
> >> the img, then read the result output and print the points with OpenCV.
> >> Then i found the image was not the way it used to be.
> >> In the attachment the original image is number 1, and the contour image is
> >> number 2.
> >> It is clear that the image reversal in some way.
> >> Cause i have to set the point of the contour in the 3D model,
> >> with this revesal the calculated center of the white target in the the
> >> original image was not suit the reveral image 2.
> >> So i wanna know is there any way to avoid this revesal and to read file as
> >> it used to be?
> >> Thanks!
> >>
> >> DawnWind.Chen
> >> CSU
> >
> >
> > It looks to me like you are just viewing the points from a different
> > viewpoint. If you want to change the view on the VTK side of things,
> > check out:
> > http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/vtkCamera
> >
> > for how to position and aim the camera.
> >
> > David
>
> I don't think this is a camera issue. The vtkJPEGReader does in fact
> flip the image. In JPEG the first pixel is at the upper left corner
> of the image, while VTK's 2D coordinate system (the one used for
> vtkActor2D) has the first pixel at the lower left corner of the
> renderer. The reader flips the image so that it appears the right way
> up on the screen when displayed with vtkImageViewer. This flip of
> course means that the coordinates of any points that you get from
> contouring the image will be flipped top-to-bottom.
>
> For some readers, you can call FileLowerLeftOn() to stop the reader
> from flipping the image.
>
> - David
> _______________________________________________
> 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
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20130416/76d052a9/attachment.htm>
More information about the vtkusers
mailing list