Skip to content

Support input coefficients in Pyramid.recon_pyr #2

Open

Description

@berthyf96

Is it possible to support custom pyramid coefficients as input to recon_pyr? I believe this could apply to all the Pyramid modules except GaussianPyramid. My particular use case is implementing phase-based motion magnification, where the coefficients of the complex CSP are modified before reconstruction. This may be useful for other applications, as well.

I've been using a modified version of this repo with this feature, so I'd be happy to start a PR.

Activity

  1. pehf commented on Aug 6, 2020

    @pehf
    Member

    Thanks for opening this issue Berthy. I am very curious about phase-based motion magnification!
    You are right that currently recon_pyr does not take coefficients as argument. Instead, it uses the attribute pyr_coeffs of a previously initialized pyramid class. What modification did you use?

    Here is the way I would go about it (if I understand you correctly): to reconstruct from modified coefficients, overwrite the pyr_coeffs attribute of the pyramid. For example, adding some noise in one of the channels and computing the corresponding reconstruction (assuming we do not want to keep the original coefficients):

    oim = plt.imread('../DATA/Einstein.pgm') / 255.
    pyr = pt.pyramids.SteerablePyramidFreq(oim)
    pyr.pyr_coeffs[1,2] += np.std(pyr.pyr_coeffs[1,2]) * np.random.normal(size=pyr.pyr_coeffs[1,2].shape)
    recon = pyr.recon_pyr()
    pt.image_compare(oim, recon)
    

    What do you think?

  2. self-assigned this
    on Aug 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions