Skip to content
This repository has been archived by the owner on Jul 2, 2021. It is now read-only.

add rotate transforms for image #690

Merged
merged 6 commits into from
Sep 19, 2018
Merged

add rotate transforms for image #690

merged 6 commits into from
Sep 19, 2018

Conversation

knorth55
Copy link
Contributor

@knorth55 knorth55 commented Sep 11, 2018

add rotate for img.
random_rotate exists but rotate does not exists.

@knorth55 knorth55 added this to the 0.11 milestone Sep 11, 2018
class TestRotate(unittest.TestCase):

def test_rotate(self):
img = np.random.uniform(size=(3, 24, 24))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using non-square image for test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@yuyu2172
Copy link
Member

Could you change argument k to angle?
If possible, could you support continuous values between -180,180?

@knorth55
Copy link
Contributor Author

i think continuous rotate support is different problem.
continuous rotate do not change img.shape, intepolate pixel value and do zero-padding in outside area.
this function is rotate90 introduced in random_rotate.

@knorth55
Copy link
Contributor Author

Updated to use scipy.ndimage.rotate

"""Rotate images by degrees.

Args:
img (~numpy.ndarray): An arrays that get flipped. This is in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flipped --> rotated

_available = False


def _check_available():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked scipy availablity at the top of rotate function.

CHW format.
angle (float): Clock-wise rotation angle (degree) in [-180, 180].
expand (bool): The output shaped is adapted or not.
If `True`, the input image is contained completel in the output.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:obj:`True`

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: completel

Args:
img (~numpy.ndarray): An arrays that get flipped. This is in
CHW format.
angle (float): Clock-wise rotation angle (degree) in [-180, 180].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yuyu2172 yuyu2172 merged commit 1fd0010 into chainer:master Sep 19, 2018
@knorth55 knorth55 deleted the rotate branch September 19, 2018 08:55
@knorth55 knorth55 mentioned this pull request Oct 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants