Page MenuHomePhabricator

image cropper crops wrong region
Closed, InvalidPublic

Assigned To
None
Authored By
neuhaus
Feb 27 2010, 9:57 AM
Referenced Files
F476: ImageCropper.patch
Mar 5 2010, 10:30 AM
F475: after cropping.jpg
Feb 27 2010, 9:58 AM

Description

I loaded a pic image, selected a region of interest with the image cropper, cropped the region, but the resulting region is not the one I selected!

Image geometry before cropping:

GetGeometry3D(0):       SlicedGeometry3D (0000000008CC1DE0)
     IndexToWorldTransform: 
    Matrix: 
      0.964844 0 0 
      0 0.964844 0 
      0 0 1 
    Offset: [-249.518, -428.238, 38.7]
    Center: [0, 0, 0]
    Translation: [-249.518, -428.238, 38.7]
    Inverse: 
      1.03644 0 0 
      0 1.03644 0 
      0 0 1 
    Scale : 1 1 1 
     BoundingBox:         ( 0,512 0,512 0,829  )
     Origin: [-249.518, -428.238, 38.7]
     ImageGeometry: 1
     Spacing: [0.964844, 0.964844, 1]
     TimeBounds: [-3.40282e+038, 3.40282e+038]
     EvenlySpaced: 1
     DirectionVector: [0, 0, 1]
     Slices: 829

Image geometry after cropping:

GetGeometry3D(0):       SlicedGeometry3D (0000000008CC2780)
  IndexToWorldTransform: 
 Matrix: 
   0.964844 0 0 
   0 0.964844 0 
   0 0 1 
 Offset: [-74.8809, -261.32, 363.2]
 Center: [0, 0, 0]
 Translation: [-74.8809, -261.32, 363.2]
 Inverse: 
   1.03644 0 0 
   0 1.03644 0 
   0 0 1 
 Scale : 1 1 1 
  BoundingBox:         ( 0,150 0,166 0,180  )
  Origin: [-74.8809, -261.32, 363.2]
  ImageGeometry: 1
  Spacing: [0.964844, 0.964844, 1]
  TimeBounds: [-3.40282e+038, 3.40282e+038]
  EvenlySpaced: 1
  DirectionVector: [0, 0, 1]
  Slices: 180

I'll upload a before and after screenshot

before_cropping.jpg (1×1 px, 257 KB)

Event Timeline

neuhaus added a subscriber: neuhaus.

screenshot after cropping shows the cropped area lying to the left of the area that was selected. Note the fiducial point that was in the selected area but is outside the resulting cropped image

after cropping.jpg (1×1 px, 208 KB)

Patch that reverts all my changes.

I added a patch that reverts all changes I made to the Image Cropper. Please apply it and try cropping your images.
It would be nice if you make the images you used available for tests. It may be a geometry problem.

the image is available at /home/jochen/temp/planungs-ct.pic

We have tested the cropping with and without the changes we made, and in both cases the same result was achieved.
In order to evaluate if the cropped region is correct, we used synthetic images, such as wall (/lpic/synthetic), where we could easily check if the cropping region was correct.
The selected regions were successfully cropped. However, after cropping, the selected image always moves to the center of the original image. This effect can explain what happened in Jochen's screenshots. After cropping, and having the cropped region moved to the center, the red marker lies outside the cropped region. In summary, the marker set by Jochen is given in world coordinates, which before cropping lies inside the image, and does not lie inside the cropped image because its origin is moved to another world coordinate, so the image lies in the center.
I don't know if this a geometry problem, or if there is a problem at all. The behavior of the cropping tools was never specified before, and I don't know who implemented it that way.

Cropping should update the geometry, so that the pixels of the cropped image are at the same position as before cropping. Everything else doesn't really make sense.
I'm pretty sure that ImageCropper behaved this way some time ago.

Merging "applicazion modules" component with "ExtApp plugins"

kislinsk changed the task status from Invalid to Spite.Jun 27 2018, 1:32 PM
kislinsk added a project: Bulk Edit.
kislinsk changed the task status from Spite to Invalid.Jun 27 2018, 1:36 PM
kislinsk removed a project: Bulk Edit.