JuliaAstro / AstroImages.jl

Visualization of astronomical images
Other
28 stars 9 forks source link

add brightness_contrast function #7

Closed aquatiko closed 5 years ago

aquatiko commented 5 years ago

A handy function to visualize your fits images by changing brightness and contrast in your Jupyter notebooks. Currently works for GrayScale images.

Results in IJulia: Screenshot from 2019-03-10 10-38-31

aquatiko commented 5 years ago

https://docs.opencv.org/3.4/d3/dc1/tutorial_basic_linear_transform.html Reference for changing brightness and contrast using operation g(x) = a*f(x) + b where a controls contrast and b brightness Also, I have added a threshold parameter to filter out pixels below it.

aquatiko commented 5 years ago

@giordano I have added the required changes but I don't quite understand the feature going to showmime.jl step.

coveralls commented 5 years ago

Pull Request Test Coverage Report for Build 35


Changes Missing Coverage Covered Lines Changed/Added Lines %
src/showmime.jl 3 4 75.0%
<!-- Total: 3 4 75.0% -->
Totals Coverage Status
Change from base Build 20: 9.5%
Covered Lines: 20
Relevant Lines: 21

💛 - Coveralls
codecov-io commented 5 years ago

Codecov Report

Merging #7 into master will increase coverage by 0.21%. The diff coverage is 75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #7      +/-   ##
==========================================
+ Coverage   97.22%   97.43%   +0.21%     
==========================================
  Files           3        3              
  Lines          36       39       +3     
==========================================
+ Hits           35       38       +3     
  Misses          1        1
Impacted Files Coverage Δ
src/AstroImages.jl 100% <ø> (ø) :arrow_up:
src/showmime.jl 75% <75%> (+75%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ae7af2d...d1edf06. Read the comment docs.

giordano commented 5 years ago

Please, also add a test for this function. A @testset on its own is fine.

In general, it is very important to test every feature you introduce, or bug you fix.

aquatiko commented 5 years ago

@giordano the function visualize just shows the slider interface in IJulia. What should one assert for the tests? Also, can you give some pointers on steps for showmime.jl

giordano commented 5 years ago

Don't worry about using it in showmime, it's trickier than I expected, I need to think more about it. I'll also the test.

aquatiko commented 5 years ago

@giordano would this require any more work before getting merged?

giordano commented 5 years ago

would this require any more work before getting merged?

Not from you, thanks!

I'm waiting for an answer to this question: https://discourse.julialang.org/t/base-show-method-for-showing-a-widget-in-jupyter/22099 I initially thought that simply replacing the render function with the new function in https://github.com/JuliaAstro/AstroImages.jl/blob/282b59e70ec522061f5bc39710c89f3df6adbe50/src/showmime.jl#L2-L3 would have been sufficient. It turned out that this isn't the case, we probably need to use another MIME, but I don't know which one.

giordano commented 5 years ago

The trick is to use text/html: https://discourse.julialang.org/t/base-show-method-for-showing-a-widget-in-jupyter/22099/4 Would you like to have the honour to do the change? :slightly_smiling_face:

aquatiko commented 5 years ago

Yeah sure!! It would help me learn about the Jupyter interface we would be doing later

aquatiko commented 5 years ago

@giordano Would this require further work before merging?

aquatiko commented 5 years ago

@giordano I think this needs a CI re-run.