Skip to content
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

[Enhancement] Feature request: L2 norm across z for CImg objects, L2 across depth for CImgList objects #395

Open
KBentley57 opened this issue Aug 25, 2023 · 0 comments

Comments

@KBentley57
Copy link

HI All,

I use CImg quite a bit for image processing tasks, and if I'm obviously overlooking something, by all means just throw it at me.

I've been doing a few FFT's, and when calculating the magnitude, or power spectrum of the real and complex parts returned, I noticed that there's no magnitude() or norm() function that acts across the z axis for images, and across the stack for CImgList objects. I end up with code that has the form

cimg_library::CImg<float> Analytic(N,N,1,1,0.0f);

cimg_library::CImgList<float> CImg_FFT = Analytic.get_FFT('x',true);

cimg_library::CImg<float> CImg_FFT_magnitude = (CImg_FFT(0).get_pow(2) + CImg_FFT(1).get_pow(2)).sqrt();

While it works fine, it seems that there ought to be something like this

cimg_library::CImgList<float> CImg_FFT = Analytic.get_FFT('x',true);

cimg_library::CImg<float> CImg_FFT_magnitude = CImg_FFT.get_norm(2);

or possibly even

cimg_library::CImgList<float> CImg_FFT = Analytic.get_FFT('x',true);
CImg_FFT.norm(2);

If norm isn't the right term, replace with magnitude. Perhaps it's a better self documenting name anyways.

This would seem to put the CImgList class at least with parity against the CImg class, in that it has both a magnitude() and norm() function. Alternatively, I could compose the two images returned from the FFT into an image with two channels, but that seems kludgy and not really better than what I have in terms of the expressiveness of the code.

Thanks for your thoughts! I really appreciate this project and all who've contributed to it.

Kyle B

@KBentley57 KBentley57 changed the title Feature request: L2 norm across z for CImg objects, L2 across depth for CImgList objects [Enhancement] Feature request: L2 norm across z for CImg objects, L2 across depth for CImgList objects Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant