New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mirror image #630

Merged
merged 4 commits into from Sep 1, 2015

Conversation

Projects
None yet
3 participants
@nontas
Member

nontas commented Aug 31, 2015

Adds a mirror(axis, mirror_landmarks) method to Image class that returns the mirrored/flipped version of current image. The axis argument defines the axis about which the mirroring will take place. If mirror_landmarks=True, then the landmarks are mirrored as well.

Note that the method could utilize the warp_to_shape() method, however I preferred to simply flip the self.pixels array which I believe must be faster.

nontas added some commits Aug 31, 2015

@jabooth jabooth added the in progress label Aug 31, 2015

@nontas

This comment has been minimized.

Member

nontas commented Aug 31, 2015

Actually, I changed my mind regarding the method's implementation...
I thought it's better to mirror the image using the warp_to_shape() function, since it is now able to deal with MaskedImage objects as well. Also it is more consistent with the way other similar functions are implemented, e.g. rotation (#629) etc.

The transform that is required for the mirroring involves:

  1. Rotating the image with an identity matrix that has -1 on the axis position of the diagonal.
  2. Translating the result by self.shape[axis] - 1.
@patricksnape

This comment has been minimized.

Contributor

patricksnape commented Aug 31, 2015

I like this :) +1

nontas added a commit that referenced this pull request Sep 1, 2015

@nontas nontas merged commit b5a568e into menpo:master Sep 1, 2015

4 checks passed

OS X MenpoBot Jenkins build passed No test results found.
Details
clahub All contributors have signed the Contributor License Agreement.
Details
continuous-integration/appveyor AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@jabooth jabooth removed the in progress label Sep 1, 2015

@nontas nontas deleted the nontas:mirror_image branch Sep 1, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment