Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix image interpolation#8966

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
efiring merged 8 commits intomatplotlib:masterfromtacaswell:fix_image_interpolation
Aug 31, 2017

Conversation

tacaswell
Copy link
Member

@tacaswelltacaswell commentedJul 30, 2017
edited
Loading

This is an attempt at#8631 and#6952

I expect this to fail. Already updated a bunch of images that had minor changes. There are a few with big changes that I still need to look into.

  • re-visit rotate image and get rid of black pixels on edge
  • drop attempt to fix python2
  • add comments about ringing into test code
  • look into scaling to a bitless than full range to prevent speckles near vmin/vmax
  • test flat cases near vmin or vmax\
  • regenerate all test images with current defaults

@tacaswelltacaswell added the Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. labelJul 30, 2017
@tacaswelltacaswell added this to the2.1 (next point release) milestoneJul 30, 2017
@anntzer
Copy link
Contributor

In rotate_image.png, the edge of the image seems to follow the middle of the dashes more closely in the original version.

Copy link
Contributor

@dopplershiftdopplershift left a comment

Choose a reason for hiding this comment

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

👍 on the approach--interpolating before doing any other transforms makes sense to me. I'm also a little concerned about the change torotate_image, but no clue what's going wrong.

Caught a couple typos in the comments.


# we are done with A_scaled now, remove from namespace to be sure!
del A_scaled
# un-scale the resampled data to approximatly the
Copy link
Contributor

Choose a reason for hiding this comment

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

approximatly -> approximate

self.get_filterrad() or 0.0)
# we are done with the mask, delete from namespace to be sure!
del mask
# Agg tells us a pixel has no value not setting a value into it
Copy link
Contributor

Choose a reason for hiding this comment

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

I think there's a word missing in this comment.

@tacaswell
Copy link
MemberAuthor

I anticipate re-writing history here before it gets merged.

@tacaswell
Copy link
MemberAuthor

I see some failures locally that I do not understand, let see if we see them on travis.

Still have to sort out those edge effects.

History will get re-written at least once more before this is ready to merge.

@tacaswell
Copy link
MemberAuthor

I am actually comfertable that the edges are the correct behavior. If you look at the zoomed in bottom 3x3 area

so

you can see that the out of range area is against the edge, the bottom right is the highest value which is equal to vmax of the norm.

It is correct, from the interpolations point of view, that the pixel past the last point (which it view as being at the center of that pixel) are of greater value (which are then correctly marked as out of range).

@tacaswelltacaswellforce-pushed thefix_image_interpolation branch fromc511460 todb19f9fCompareAugust 7, 2017 02:39
@tacaswelltacaswell changed the title[WIP] Fix image interpolationFix image interpolationAug 7, 2017
@tacaswelltacaswellforce-pushed thefix_image_interpolation branch from1962d84 to1e160aaCompareAugust 7, 2017 19:07
@tacaswell
Copy link
MemberAuthor

tacaswell commentedAug 7, 2017
edited
Loading

Todos:

  • re-visit rotate image and get rid of black pixels on edge
  • drop attempt to fix python2
  • add comments about ringing into test code
  • look into scaling to a bitless than full range to prevent speckles near vmin/vmax
  • test flat cases near vmin or vmax\
  • regenerate all test images with current defaults

@tacaswelltacaswell mentioned this pull requestAug 7, 2017
@tacaswelltacaswell modified the milestone:2.1 (next point release)Aug 29, 2017
 - interpolate raw, not normed, data - should reduce memory footprint, only 1 or 2 copies of input data - this will change many tests in small ways - down-casting input data before interpolation was causing issues with   numerical precision so work in no less than the input float type - Numpy 1.7 does not support `np.nanmin` and `np.nanmax` on masked   arrays (instead of returning a number it returns a MaskedIterator).
 - update to mpl20 style - re-generate as needed - bump threshold on pngsuite test
@tacaswelltacaswellforce-pushed thefix_image_interpolation branch from1e160aa toec43d0eCompareAugust 29, 2017 03:14
@tacaswelltacaswell added this to the2.1 (next point release) milestoneAug 29, 2017
@tacaswell
Copy link
MemberAuthor

fromcopyimportcopyimportmatplotlib.imageasmimagedefinterpolation_grid(data,vmin=None,vmax=None):cm=copy(plt.get_cmap('viridis'))cm.set_over('r')cm.set_under('b')cm.set_bad('k')fig,ax_grid=plt.subplots(3,6,sharex=True,sharey=True)ret= []forinterp,axinzip(sorted(mimage._interpd_),ax_grid.ravel()):ax.set_title(interp)im=ax.imshow(data,cmap=cm,interpolation=interp)ax.axis('off')im.set_clim(vmin,vmax)ret.append(im)returnret
ims_a=interpolation_grid([[0,1], [1,0]],0,1)ims_b=interpolation_grid(np.tile([[0,1], [1,0]], (10,10)),0,1)

I am satisfied that the speckles are edge effects on the higher-order interpolators

[im.set_clim(0, 1.00000005) for im in ims_b]

That is the smallest upper limit that shows the speckles on my system which gives us an idea of the level of the numeric instability. I don't think that it is worth playing games to stay just under it as I suspect it will vary between systems.

If we do anything about this we should bump the Autoscales out a bit.

Push the stale flag down into the ScalarMappable so that it getsapplied to all ScalarMappable sub-classes (ex Collections).
@tacaswelltacaswellforce-pushed thefix_image_interpolation branch from8186243 to346bb1aCompareAugust 31, 2017 03:46
@efiringefiring merged commitb1b9404 intomatplotlib:masterAug 31, 2017
@tacaswelltacaswell deleted the fix_image_interpolation branchAugust 31, 2017 11:26
@tacaswelltacaswell mentioned this pull requestSep 24, 2017
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@dopplershiftdopplershiftdopplershift approved these changes

Assignees
No one assigned
Labels
Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Milestone
v2.1
Development

Successfully merging this pull request may close these issues.

6 participants
@tacaswell@anntzer@dopplershift@efiring@QuLogic@phobson

[8]ページ先頭

©2009-2025 Movatter.jp