How to see full image after transformation not the cropped one
Hello everybody This question was raised here: Google Grup | | | Google Grup Google Grup memungkinkan Anda untuk membuat dan berpartisipasi dalam forum online serta grup berbasis email deng... | | | × × × But I didn't find an answer.I'm doing 2D piecewise affine transformation with skimage.transform.PiecewiseAffineTransformResult image is heavily cropped.I tried to play with output_shape, mode and clip parameters but without any effect, image is still cropped.Could anyone point me what am I doing wrong?Thanks Best regards, Serge Shakhov.
Hi Serge, Could you provide an example of the code you are running. This will help us to better understand the issue, and solve it faster. Thanks! Regards, Egor 2017-04-03 1:30 GMT+03:00 Serge Shakhov via scikit-image < scikit-image@python.org>:
Hello everybody
This question was raised here: Google Grup <https://groups.google.com/forum/#!topic/scikit-image/dw1rUssJUkA/overview>
Google Grup Google Grup memungkinkan Anda untuk membuat dan berpartisipasi dalam forum online serta grup berbasis email deng... <https://groups.google.com/forum/#!topic/scikit-image/dw1rUssJUkA/overview> × × ×
But I didn't find an answer. I'm doing 2D piecewise affine transformation with skimage.transform. PiecewiseAffineTransform Result image is heavily cropped. I tried to play with output_shape, mode and clip parameters but without any effect, image is still cropped. Could anyone point me what am I doing wrong? Thanks
Best regards, Serge Shakhov.
_______________________________________________ scikit-image mailing list scikit-image@python.org https://mail.python.org/mailman/listinfo/scikit-image
Hi Serge On Sun, Apr 2, 2017, at 15:30, Serge Shakhov via scikit-image wrote:
But I didn't find an answer.
I'm doing 2D piecewise affine transformation with skimage.transform.PiecewiseAffineTransform Result image is heavily cropped.
I tried to play with output_shape, mode and clip parameters but without any effect, image is still cropped. Could anyone point me what am I doing wrong?
I thought we had this implemented, but I guess not yet. You can see how here: https://github.com/scikit-image/skimage-tutorials/blob/master/lectures/adv3_... Specifically: *from* *skimage.transform* *import* SimilarityTransform *# Shape of middle image, our registration target* r, c = image.shape *# Note that transformations take coordinates in (x, y) format,* *# not (row, column), in order to be consistent with most literature* corners = np.array([[, ], [, r], [c, ], [c, r]]) *# Warp the image corners to their new positions* warped_corners = my_tf(corners) *# The overall output shape will be max - min* corner_min = np.min(corners, axis=0) corner_max = np.max(corners, axis=0) output_shape = (corner_max - corner_min) *# Ensure integer shape with np.ceil and dtype conversion* output_shape = np.ceil(output_shape[::-1]).astype(int) That calculates the shape you want. You now need to modify the transform to output an image inside of this shape: *from* *skimage.transform* *import* warp * # This in-plane offset is the only necessary transformation for the # middle image* offset = SimilarityTransform(translation=-corner_min) shifted_transform = (my_tf + offset).inverse pano0_warped = warp(image, shifted_transform, order=3, output_shape=output_shape, cval=-1) Let us know how that goes! Stéfan
participants (3)
-
Egor Panfilov
-
Serge Shakhov
-
Stefan van der Walt