Skip to content

Commit

Permalink
Merge branch 'main' into 479-imbrighten
Browse files Browse the repository at this point in the history
  • Loading branch information
cpaniaguam authored Nov 8, 2024
2 parents 89d480d + 3e74b31 commit a2f24bf
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 114 deletions.
2 changes: 1 addition & 1 deletion src/IceFloeTracker.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ include("special_strels.jl")
include("tilingutils.jl")
include("histogram_equalization.jl")
include("brighten.jl")

include("imcomplement.jl")

const sk_measure = PyNULL()
const sk_exposure = PyNULL()
Expand Down
7 changes: 7 additions & 0 deletions src/imcomplement.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
function imcomplement(img::Matrix{T}) where {T<:Union{Unsigned,Int}}
return 255 .- img
end

function imcomplement(img::Matrix{Gray{Float64}})
return 1 .- img
end
138 changes: 26 additions & 112 deletions src/special_strels.jl

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ testnames = [n[6:(end-3)] for n in alltests]

to_test = alltests # uncomment this line to run all tests or add individual files below
[
# "test-create-landmask.jl",
# "test-latlon.jl",
# "test-create-cloudmask.jl",
# "test-normalize-image.jl",
# "test-persist.jl",
Expand Down
9 changes: 9 additions & 0 deletions test/test-imcomplement.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using IceFloeTracker: imcomplement

@testset "imcomplement" begin
img = rand(0:255, 10, 10)
@test imcomplement(img) == 255 .- img

img = Gray.(img ./ 255)
@test imcomplement(img) == 1 .- img
end
15 changes: 15 additions & 0 deletions test/test-special-strels.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using IceFloeTracker: se_disk4, se_disk20, se_disk50

@testset "Special strels" begin
@testset "se_disk4" begin
@test sum(se_disk4()) == 37
end

@testset "se_disk20" begin
@test sum(se_disk20()) == 1301
end

@testset "se_disk50/se for landmask dilation" begin
@test sum(se_disk50()) == 8177
end
end

0 comments on commit a2f24bf

Please sign in to comment.