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

Extract patches types #602

Merged
merged 4 commits into from Jul 7, 2015

Conversation

Projects
None yet
2 participants
@patricksnape
Contributor

patricksnape commented Jul 3, 2015

Adds the ability to extract patches from different type images:

  • np.float64
  • np.float32
  • np.uint8

Also, adds passing of kwargs to import_builtin_asset so we can do:

import menpo.io as mio
bb = mio.import_builtin_asset.breakingbad_jpg(normalise=False)

And bb.pixels == np.uint8

patricksnape added some commits Jul 3, 2015

Template extract_patches cython
Can now take float, double and uint8 images and either float
or double centres and extract patches. It will always
return the patches as the same type as the provided image.
Allow import_builtin_asset to take kwargs
Now you can pass normalize=False when importing builtin assets
Add tests for new features
Tests for extract_patches and kwargs to imports
@patricksnape

This comment has been minimized.

Contributor

patricksnape commented Jul 6, 2015

@jabooth OK with this?

@jalabort

This comment has been minimized.

Member

jalabort commented Jul 6, 2015

Can you add np.uint8 to gradient.pyx in features as well? Seems sensible since images can be loaded as np.uint8 and extract_patches supports it...

@patricksnape

This comment has been minimized.

Contributor

patricksnape commented Jul 6, 2015

What is the correct value of:

(100 - 1) / 2

as a uint8?

Is it 0, as it would be by default? Or 50, rounding up, or 49 rounding down?

@jalabort

This comment has been minimized.

Member

jalabort commented Jul 6, 2015

Mmm... Good point!!!

0 does not seem a sensible answer to me... 50 and 49 would not be consistent with other menpo transformations e.g. image.as_greyscale(mode='average')... What about simply returning 49.5 as np.float64 which is exactly what happens when you call image.as_greyscale(mode='average') on image with np.uint8 pixels (instead of crashing as gradient does now)?

@jalabort

This comment has been minimized.

Member

jalabort commented Jul 7, 2015

Get this in Patrick, we can deal with integer gradient in another PR. Or open an issue for it.

patricksnape added a commit that referenced this pull request Jul 7, 2015

@patricksnape patricksnape merged commit 35203bc into menpo:master Jul 7, 2015

3 checks passed

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

@patricksnape patricksnape deleted the patricksnape:extract_patches_types branch Jul 7, 2015

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