aoles / EBImage

:art: Image processing toolbox for R
71 stars 28 forks source link

any function to do CLAHE ? #12

Closed Forrestwang1 closed 7 years ago

Forrestwang1 commented 7 years ago

Dear aoles, Is there any function in this package to do CLAHE (contrast limited adaptive histogram equalization)? I know this following function only doing hist.eq for the whole image. equalize(x) Thanks, Forrest

aoles commented 7 years ago

Hi, thank you for your interest in EBImage! We don't have a function for doing contrast limited adaptive histogram equalization, but it should be in principle possible to integrate the code from https://github.com/erich666/GraphicsGems/blob/master/gemsiv/clahe.c into the package. May I ask what would be your use case of performing CLAHE?

Cheers, Andrzej

Forrestwang1 commented 7 years ago

Thanks for your quick reply! I have used EBImage for a while. I am trying to use CLAHE for a project which is still related medial image. The function of equalize(x) is good for most of them, but sometimes some images really need CLAHE to enhance the picture.

Forrestwang1 commented 7 years ago

I just opened the link which seems using C, I have no any knowledge about language C. thanks anyway~ .

aoles commented 7 years ago

Thanks for your feedback!

I will then look into the possibility of adding a function for performing CLAHE based on the code from clahe.c, so stay tuned.

Forrestwang1 commented 7 years ago

thanks so much for your consideration, I will wait for that and will check the package everyday~~,thanks again~

aoles commented 7 years ago

You're very welcome, I will keep you updated on the progress.

Forrestwang1 commented 7 years ago

thanks~

aoles commented 7 years ago

Hi, I'm happy to inform you that I've managed to integrate into EBImage Karel Zuiderveld's implementation of CLAHE. You can perform the filtering as follows.

Please let me know whether this works for you as expected.

Cheers, Andrzej

# input image containing multiple frames
x = readImage(system.file("images", "cells.tif", package="EBImage"))
display(x, method="raster", all=TRUE)

# perform contrast limited adaptive histogram equalization
y = clahe(x, nx=5, ny=5)
display(y, method="raster", all=TRUE)

1

2

Forrestwang1 commented 7 years ago

wow, you are so fast~ I cannot wait to try and thanks a lot!!!!!!!!!!!!!!!!!!!

Forrestwang1 commented 7 years ago

It seems that I have trouble to update the package~any suggestion?

aoles commented 7 years ago
# install.packages("devtools")
devtools::install_github("aoles/EBImage")
Forrestwang1 commented 7 years ago

got it, thanks~~~~

Forrestwang1 commented 7 years ago

just now I randomly run the code x = readImage(system.file("images", "cells.tif", package="EBImage")) display(x, method="raster", all=TRUE) it shows that Error in transpose(y) : object 'C_transpose' not found

Forrestwang1 commented 7 years ago

Hey aoles, I reinstalled R and tried several images again and it works perfect, thanks~