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

various package status improvement #8

Merged
merged 3 commits into from
Nov 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/UnitTest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Unit test

on:
create:
tags:
push:
branches:
- master
pull_request:

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
julia-version: ['1.3', '1', 'nightly']
os: [ubuntu-latest]
arch: [x64]
include:
- os: windows-latest
julia-version: '1'
arch: x64
- os: macOS-latest
julia-version: '1'
arch: x64
- os: ubuntu-latest
julia-version: '1'
arch: x86

steps:
- uses: actions/checkout@v2
- name: "Set up Julia"
uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.julia-version }}
arch: ${{ matrix.arch }}

- name: Cache artifacts
uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- name: "Unit Test"
uses: julia-actions/julia-runtest@master

- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v1
with:
file: lcov.info
41 changes: 41 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Documentation

on:
pull_request:
push:
branches:
- 'master'
- 'release-'
tags: '*'
release:
types: [published]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: [1]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia-version }}
- name: Cache artifacts
uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- name: Install dependencies
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
- name: Build and deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: julia --project=docs/ docs/make.jl
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

23 changes: 4 additions & 19 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,13 @@ authors = ["Peter Kovesi <[email protected]>"]
version = "0.2.1"

[deps]
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
ImageMagick = "6218d12a-5da1-5696-b52f-db25d2ecc6d1"
Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0"
ImageCore = "a09fc81d-aa75-5fe9-8630-4744c3626534"
ImageMorphology = "787d08f9-d448-5407-9aad-5290dd7ab264"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TestImages = "5e47fb64-e119-507b-a336-dd2b206d9990"

[compat]
AbstractFFTs = "0.3, 0.4, 0.5, 1.0"
Documenter = "0.24, 0.25, 0.26, 0.27"
FFTW = "1"
FileIO = "1"
ImageMagick = "1"
Images = "0.9, 0.10, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.24"
TestImages = "1"
ImageCore = "0.9"
ImageMorphology = "0.3"
julia = "1.3"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
12 changes: 12 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[deps]
DemoCards = "311a05b2-6137-4a5a-b473-18580a3d38b5"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
ImageContrastAdjustment = "f332f351-ec65-5f6a-b3d1-319c6670881a"
ImageIO = "82e4d734-157c-48bb-816b-45c225c6df19"
ImageMagick = "6218d12a-5da1-5696-b52f-db25d2ecc6d1"
ImagePhaseCongruency = "10e51d30-6ba1-539a-b97e-c69c597142c4"
Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0"

[compat]
Documenter = "0.27"
DemoCards = "0.4"
11 changes: 11 additions & 0 deletions docs/examples/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"theme": "grid",
"order": [
"phase_congruency",
"test_images",
"misc"
],
"properties": {
"notebook": "false"
}
}
54 changes: 54 additions & 0 deletions docs/examples/misc/perfft2.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# ---
# title: Fourier transform of Moisan periodic image component
# id: demo_perfft2
# cover: assets/perfft2.png
# author: Peter Kovesi
# date: 2018-10-26
# ---

# The function `perfft2()` implements Moisan's "Periodic plus Smooth Image
# Decomposition" which decomposes an image into two components
#
# img = p + s
#
# where `s` is the 'smooth' component with mean 0 and `p` is the 'periodic' component
# which has no sharp discontinuities when one moves cyclically across the image
# boundaries.
#
# This decomposition is very useful when one wants to obtain an FFT of an image
# with minimal artifacts introduced from the boundary discontinuities. The image
# `p` gathers most of the image information but avoids periodization artifacts.
#
# Reference:
# L. Moisan, "Periodic plus Smooth Image Decomposition", Journal of
# Mathematical Imaging and Vision, vol 39:2, pp. 161-179, 2011.

using Images
using FFTW
using ImagePhaseCongruency
using ImageContrastAdjustment
using TestImages

img = Float64.(Gray.(testimage("lena")))

IMG = fft(img) # 'Standard' fft
(P, S, p, s) = perfft2(img) # 'Periodic' fft

mosaic(
adjust_histogram(Gray.(p), LinearStretching()),
adjust_histogram(s, LinearStretching()),
## Note the vertical and horizontal cross in
## the spectrum induced by the non-periodic edges.
adjust_histogram(log.(abs.(fftshift(IMG)) .+ 1), LinearStretching()),
## Note the clean spectrum because p is periodic.
adjust_histogram(log.(abs.(fftshift(P)) .+ 1), LinearStretching());
nrow=2, rowmajor=true
)
# Top 1) left: periodic component 2) right: smooth component
#
# Bottom 3) left: spectrum of standard FFT 4) right: spectrum of periodic component

# save cover image #src
isdir("assets") || mkdir("assets") #src
cover = Gray.(adjust_histogram(log.(abs.(fftshift(P)) .+ 1), LinearStretching())) #src
save(joinpath("assets", "perfft2.png"), cover) #src
30 changes: 30 additions & 0 deletions docs/examples/phase_congruency/phasecong3.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# ---
# title: Log-Gabor filters v3
# id: demo_phasecong3
# cover: assets/phasecong3.png
# author: Peter Kovesi
# date: 2018-10-26
# ---

# Use of the function `phasecong3()` allows corner points to be detected as well. These
# corner points are a subset of the edge image and, unlike other corner detectors, their
# location is precise and stable over different scales.

using TestImages
using Images
using ImagePhaseCongruency

img = restrict(testimage("mandril_gray"))
(edges, corners) = phasecong3(img)

mosaic(
img,
adjust_histogram(Gray.(edges), LinearStretching()),
adjust_histogram(corners, LinearStretching()),
nrow=1
)
# Images from top to right: 1) original image 2) edges 3) corners

# save cover image #src
isdir("assets") || mkdir("assets") #src
save(joinpath("assets", "phasecong3.png"), adjust_histogram(Gray.(edges), LinearStretching())) #src
35 changes: 35 additions & 0 deletions docs/examples/phase_congruency/phasecongmono.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# ---
# title: Monogenic filters
# id: demo_phasecongmono
# cover: assets/phasecongmono.png
# author: Peter Kovesi
# date: 2018-10-26
# ---

# Phase congruency marks all classes of features from steps to lines and is a dimensionless
# quantity that ranges from 0 to 1. This allows fixed thresholds to be used over wide
# classes of images.

using TestImages
using Images
using ImagePhaseCongruency

img = restrict(testimage("mandril_gray"))

(pc, or, ft, T) = phasecongmono(img)
nonmax = Images.thin_edges(pc, or)

mosaic(
img,
adjust_histogram(pc, LinearStretching()),
nonmax,
hysthresh(nonmax, 0.1, 0.2);
nrow=2, rowmajor=true
)

# Images: 1) top left: original image 2) top right: phase congruency 3) bottom left:
# non-maximal suppression 4) bottom right: Hystersis thresholded

# save cover image #src
isdir("assets") || mkdir("assets") #src
save(joinpath("assets", "phasecongmono.png"), adjust_histogram(Gray.(pc), LinearStretching())) #src
30 changes: 30 additions & 0 deletions docs/examples/phase_congruency/phasesymmetry.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# ---
# title: Symmetric monogenic filters
# id: demo_phasesymmono
# cover: assets/phasesymmono.gif
# author: Peter Kovesi
# date: 2018-10-26
# ---

# Phase symmetry responds well to line like features and circular objects. The number of
# filter scales will affect the scale of features that are marked. Phase symmetry marks
# features independently of contrast (a bright circle is not more symmetric than a grey
# circle) and is a dimensionless quantity between 0 and 1. However this may not be what one
# desires in which case the symmetry energy may be of greater interest.

using TestImages
using Images
using ImagePhaseCongruency

img = Gray.(testimage("blobs"))
## Detect regions of bright symmetry (polarity = 1)
phase_bright, = phasesymmono(img; nscale=5, polarity=1)

## Detect regions of dark symmetry (polarity = -1)
phase_dark, = phasesymmono(img; nscale=5, polarity=-1)

mosaic(img, phase_bright, phase_dark; nrow=1)

# save cover image #src
isdir("assets") || mkdir("assets") #src
save(joinpath("assets", "phasesymmono.gif"), Images.gif([phase_bright, phase_dark]); fps=1) #src
33 changes: 33 additions & 0 deletions docs/examples/phase_congruency/ppdenoise.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# ---
# title: Denoise
# id: demo_ppdenoise
# cover: assets/ppdenoise.png
# author: Peter Kovesi
# date: 2018-10-26
# ---

using TestImages
using Images
using ImageContrastAdjustment
using ImagePhaseCongruency
using Random #hide
Random.seed!(1234) #hide

## Values in the range 0 to 1
img = centered(Gray.(restrict(testimage("lighthouse"))))[-127:128, -127:128]

## Add noise with standard deviation of 0.25
img .+= 0.25 * randn(size(img))

cleanimg = ppdenoise(img; nscale=6, norient=6, mult=2.5, minwavelength=2, sigmaonf=0.55, dthetaonsigma=1.0, k=3, softness=1.0)

mosaic(
adjust_histogram(img, LinearStretching()),
adjust_histogram(cleanimg, LinearStretching());
nrow=1
)

# save cover image #src
isdir("assets") || mkdir("assets") #src
cover = adjust_histogram(Gray.(cleanimg), LinearStretching()) #src
save(joinpath("assets", "ppdenoise.png"), cover) #src
Loading