dawyd / bm3d-gpu Goto Github PK
View Code? Open in Web Editor NEWCUDA implementation of BM3D
License: Other
CUDA implementation of BM3D
License: Other
This project is not working with 16-bit tiff images. It is still doing something and the output is a 8-bit tiff pretty close to a random image.
Hello. I really like this code, and i use it regularly with great results. There have been some recent advances for the BM3D algorithm:
https://doi.org/10.1109/TIP.2020.3014721
It would be great to see the improvements added in this project. I am not familiar with CUDA development. Would this be possible?
Hi! Thanks for this great implementation!
However, I noticed that changing sigma did not change the output when denoising gray scale images. From looking into the code, I think the reason is that the parameter sigma is only actually used if channels == 3
, while it is initialized to 625 otherwise. I changed it in my local copy of the repository, and it seems to have fixed it, although based on the results I am still not 100% sure I really replaced it with the correct values (from my understanding, sigma2
should simply be sigma squared, i.e. the variance).
It concerns lines 49-64 in main_nodisplay.cpp
(I indicate my "fix" as a comment in line 53 (line 5 of the snippet))
//Allocate images
CImg<unsigned char> image(argv[1]);
CImg<unsigned char> image2(image.width(), image.height(), 1, channels, 0);
std::vector<unsigned int> sigma2(channels);
sigma2[0] = 25 * 25; // <--- sigma2[0] = sigma * sigma;
//Convert color image to YCbCr color space
if (channels == 3)
{
image = image.get_channels(0, 2).RGBtoYCbCr();
//Convert the sigma^2 variance to the YCbCr color space
long s = sigma * sigma;
sigma2[0] = ((66l*66l*s + 129l*129l*s + 25l*25l*s) / (256l*256l));
sigma2[1] = ((38l*38l*s + 74l*74l*s + 112l*112l*s) / (256l*256l)),
sigma2[2] = ((112l*112l*s + 94l*94l*s + 18l*18l*s) / (256l*256l));
}
It would be great if you could verify the issue and that the fix is correct.
hello,
this error appears with make
command:
[100%] Linking CXX executable bm3d
/usr/bin/ld: CMakeFiles/bm3d.dir/src/main_nodisplay.cpp.o: in function `cimg_library::CImg<unsigned char>::_save_jpeg(_IO_FILE*, char const*, unsigned int) const':
main_nodisplay.cpp:(.text._ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj[_ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj]+0x26b): undefined reference to `jpeg_std_error'
/usr/bin/ld: main_nodisplay.cpp:(.text._ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj[_ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj]+0x28b): undefined reference to `jpeg_CreateCompress'
/usr/bin/ld: main_nodisplay.cpp:(.text._ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj[_ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj]+0x2d4): undefined reference to `jpeg_stdio_dest'
/usr/bin/ld: main_nodisplay.cpp:(.text._ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj[_ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj]+0x31a): undefined reference to `jpeg_set_defaults'
/usr/bin/ld: main_nodisplay.cpp:(.text._ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj[_ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj]+0x345): undefined reference to `jpeg_set_quality'
/usr/bin/ld: main_nodisplay.cpp:(.text._ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj[_ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj]+0x359): undefined reference to `jpeg_start_compress'
/usr/bin/ld: main_nodisplay.cpp:(.text._ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj[_ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj]+0x808): undefined reference to `jpeg_write_scanlines'
/usr/bin/ld: main_nodisplay.cpp:(.text._ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj[_ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj]+0x81c): undefined reference to `jpeg_finish_compress'
/usr/bin/ld: main_nodisplay.cpp:(.text._ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj[_ZNK12cimg_library4CImgIhE10_save_jpegEP8_IO_FILEPKcj]+0x844): undefined reference to `jpeg_destroy_compress'
/usr/bin/ld: CMakeFiles/bm3d.dir/src/main_nodisplay.cpp.o: in function `cimg_library::CImg<unsigned char>::_load_jpeg(_IO_FILE*, char const*)':
main_nodisplay.cpp:(.text._ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc[_ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc]+0x100): undefined reference to `jpeg_std_error'
/usr/bin/ld: main_nodisplay.cpp:(.text._ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc[_ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc]+0x233): undefined reference to `jpeg_CreateDecompress'
/usr/bin/ld: main_nodisplay.cpp:(.text._ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc[_ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc]+0x24c): undefined reference to `jpeg_stdio_src'
/usr/bin/ld: main_nodisplay.cpp:(.text._ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc[_ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc]+0x260): undefined reference to `jpeg_read_header'
/usr/bin/ld: main_nodisplay.cpp:(.text._ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc[_ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc]+0x26f): undefined reference to `jpeg_start_decompress'
/usr/bin/ld: main_nodisplay.cpp:(.text._ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc[_ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc]+0x4da): undefined reference to `jpeg_read_scanlines'
/usr/bin/ld: main_nodisplay.cpp:(.text._ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc[_ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc]+0x799): undefined reference to `jpeg_finish_decompress'
/usr/bin/ld: main_nodisplay.cpp:(.text._ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc[_ZN12cimg_library4CImgIhE10_load_jpegEP8_IO_FILEPKc]+0x7a8): undefined reference to `jpeg_destroy_decompress'
/usr/bin/ld: CMakeFiles/bm3d.dir/src/main_nodisplay.cpp.o: in function `cimg_library::CImg<unsigned char>::_cimg_jpeg_error_exit(jpeg_common_struct*)':
main_nodisplay.cpp:(.text._ZN12cimg_library4CImgIhE21_cimg_jpeg_error_exitEP18jpeg_common_struct[_ZN12cimg_library4CImgIhE21_cimg_jpeg_error_exitEP18jpeg_common_struct]+0x45): undefined reference to `jpeg_destroy'
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/bm3d.dir/build.make:129: bm3d] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/bm3d.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
I get the following error:
Sigma = 10
Number of Steps: 2
Color denoising: yes
Noise variance for individual channels (YCrCb if color): 32 29 33
width: 4231 height: 3051
Shared memory : 46KB/48KB
Number of warps: 20
Processing 0%terminate called after throwing an instance of 'thrust::system::system_error'
what(): bm3d.hpp(788):: an illegal memory access was encountered
test_bm3d.sh: line 6: 5767 Aborted (core dumped) bm3d ${NOISYTESTDIR}/${TESTSET}/${TESTIMG} results/test2/bm3d-${SIGMA}/${TESTIMG} ${SIGMA} color twostep
when trying to denoise any of the images in that set https://commons.wikimedia.org/wiki/File:NIND_MuseeL-skull-C500D_ISO200.jpg
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.