Skip to content

Commit 3356c46

Browse files
committed
WIP: replace Images with specific packages
Currently the bottleneck is `gaussian_pyramid` which is still in Images.jl
1 parent 2153078 commit 3356c46

23 files changed

+49
-41
lines changed

Project.toml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,26 @@ version = "0.5.0"
44

55
[deps]
66
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
7-
Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0"
7+
ImageBase = "c817782e-172a-44cc-b673-b171935fbb9e"
8+
ImageContrastAdjustment = "f332f351-ec65-5f6a-b3d1-319c6670881a"
9+
ImageCore = "a09fc81d-aa75-5fe9-8630-4744c3626534"
10+
ImageCorners = "89d5987c-236e-4e32-acd0-25bd6bd87b70"
11+
ImageFiltering = "6a3955dd-da59-5b1f-98d4-e7296123deb5"
12+
ImageTransformations = "02fcd773-0e25-5acc-982a-7f6622650795"
13+
IntegralArrays = "1d092043-8f09-5a30-832f-7509e371ab51"
814
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
915
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1016

1117
[compat]
1218
Distributions = "0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25"
13-
Images = "0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 0.24, 0.25"
19+
ImageCore = "0.10"
1420
julia = "1.6"
1521

1622
[extras]
17-
ImageMagick = "6218d12a-5da1-5696-b52f-db25d2ecc6d1"
23+
ImageIO = "82e4d734-157c-48bb-816b-45c225c6df19"
1824
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1925
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2026
TestImages = "5e47fb64-e119-507b-a336-dd2b206d9990"
2127

2228
[targets]
23-
test = ["ImageMagick", "LinearAlgebra", "Test", "TestImages"]
29+
test = ["ImageIO", "LinearAlgebra", "Test", "TestImages"]

docs/Project.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ CoordinateTransformations = "150eb455-5306-5404-9cee-2592286d6298"
33
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
44
ImageDraw = "4381153b-2b60-58ae-a1ba-fd683676385f"
55
ImageFeatures = "92ff4b2b-8094-53d3-b29d-97f740f06cef"
6-
ImageMagick = "6218d12a-5da1-5696-b52f-db25d2ecc6d1"
7-
Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0"
86
Rotations = "6038ab10-8711-5258-84ad-4b1120ba62dc"
97
TestImages = "5e47fb64-e119-507b-a336-dd2b206d9990"
108

docs/make.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Documenter, ImageFeatures, Images
1+
using Documenter, ImageFeatures, ImageCore
22

33
makedocs(sitename = "ImageFeatures",
44
format = Documenter.HTML(prettyurls = get(ENV, "CI", nothing) == "true"),

docs/src/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,3 @@ Installing the package is extremely easy with julia's package manager -
2323
Pkg.add("ImageFeatures")
2424
```
2525

26-
ImageFeatures.jl requires [Images.jl](https://github.com/JuliaImages/Images.jl).

docs/src/tutorials/brief.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ BRIEF is a very simple feature descriptor and does not provide scale or rotation
1616

1717
## Example
1818

19-
Let us take a look at a simple example where the BRIEF descriptor is used to match two images where one has been translated by `(100, 200)` pixels. We will use the `lena_gray` image from the [TestImages](https://github.com/timholy/TestImages.jl) package for this example.
19+
Let us take a look at a simple example where the BRIEF descriptor is used to match two images where one has been translated by `(100, 200)` pixels. We will use the `lena_gray` image from the [TestImages](https://github.com/JuliaImages/TestImages.jl) package for this example.
2020

2121

2222
Now, let us create the two images we will match using BRIEF.
2323

2424
```@example 1
25-
using ImageFeatures, TestImages, Images, ImageDraw, CoordinateTransformations
25+
using ImageFeatures, TestImages, ImageCore, ImageDraw, CoordinateTransformations
2626
2727
img = testimage("lighthouse")
2828
img1 = Gray.(img)

docs/src/tutorials/brisk.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ The descriptor is built using intensity comparisons. For each short pair if the
1313

1414
## Example
1515

16-
Let us take a look at a simple example where the BRISK descriptor is used to match two images where one has been translated by `(50, 40)` pixels and then rotated by an angle of 75 degrees. We will use the `lighthouse` image from the [TestImages](https://github.com/timholy/TestImages.jl) package for this example.
16+
Let us take a look at a simple example where the BRISK descriptor is used to match two images where one has been translated by `(50, 40)` pixels and then rotated by an angle of 75 degrees. We will use the `lighthouse` image from the [TestImages](https://github.com/JuliaImages/TestImages.jl) package for this example.
1717

1818
First, let us create the two images we will match using BRISK.
1919

2020
```@example 4
21-
using ImageFeatures, TestImages, Images, ImageDraw, CoordinateTransformations, Rotations
21+
using ImageFeatures, TestImages, ImageCore, ImageDraw, CoordinateTransformations, Rotations
2222
2323
img = testimage("lighthouse")
2424
img1 = Gray.(img)

docs/src/tutorials/freak.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ The descriptor is built using intensity comparisons of a predetermined set of 51
99

1010
## Example
1111

12-
Let us take a look at a simple example where the FREAK descriptor is used to match two images where one has been translated by `(50, 40)` pixels and then rotated by an angle of 75 degrees. We will use the `lighthouse` image from the [TestImages](https://github.com/timholy/TestImages.jl) package for this example.
12+
Let us take a look at a simple example where the FREAK descriptor is used to match two images where one has been translated by `(50, 40)` pixels and then rotated by an angle of 75 degrees. We will use the `lighthouse` image from the [TestImages](https://github.com/JuliaImages/TestImages.jl) package for this example.
1313

1414
First, let us create the two images we will match using FREAK.
1515

1616
```@example 3
17-
using ImageFeatures, TestImages, Images, ImageDraw, CoordinateTransformations, Rotations
17+
using ImageFeatures, TestImages, ImageCore, ImageDraw, CoordinateTransformations, Rotations
1818
1919
img = testimage("lighthouse")
2020
img1 = Gray.(img)

docs/src/tutorials/object_detection.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ representation which is invariant to local geometric and photometric changes (i.
1111
Download the script to get the training data [here](https://drive.google.com/file/d/11G_9zh9N-0veQ2EL5WDGsnxRpihsqLX5/view?usp=sharing). Download tutorial.zip, decompress it and run get_data.bash. (Change the variable `path_to_tutorial` in preprocess.jl and path to julia executable in get_data.bash). This script will download the required datasets. We will start by loading the data and computing HOG features of all the images.
1212

1313
```julia
14-
using Images, ImageFeatures
14+
using ImageCore, ImageFeatures
1515

1616
path_to_tutorial = "" # specify this path
1717
pos_examples = "$path_to_tutorial/tutorial/humans/"
1818
neg_examples = "$path_to_tutorial/tutorial/not_humans/"
1919

2020
n_pos = length(readdir(pos_examples)) # number of positive training examples
2121
n_neg = length(readdir(neg_examples)) # number of negative training examples
22-
n = n_pos + n_neg # number of training examples
23-
data = Array{Float64}(undef, 3780, n) # Array to store HOG descriptor of each image. Each image in our training data has size 128x64 and so has a 3780 length
22+
n = n_pos + n_neg # number of training examples
23+
data = Array{Float64}(undef, 3780, n) # Array to store HOG descriptor of each image. Each image in our training data has size 128x64 and so has a 3780 length
2424
labels = Vector{Int}(undef, n) # Vector to store label (1=human, 0=not human) of each image.
2525

2626
for (i, file) in enumerate([readdir(pos_examples); readdir(neg_examples)])
@@ -31,7 +31,7 @@ for (i, file) in enumerate([readdir(pos_examples); readdir(neg_examples)])
3131
end
3232
```
3333

34-
Basically we now have an encoded version of images in our training data. This encoding captures useful information but discards extraneous information
34+
Basically we now have an encoded version of images in our training data. This encoding captures useful information but discards extraneous information
3535
(illumination changes, pose variations etc). We will train a linear SVM on this data.
3636

3737
```julia
@@ -94,7 +94,7 @@ end
9494

9595
![Original](../img/scores.png)
9696

97-
You can see that classifier gave low score to not-human class (i.e. high score to human class) at positions corresponding to humans in the original image.
97+
You can see that classifier gave low score to not-human class (i.e. high score to human class) at positions corresponding to humans in the original image.
9898
Below we threshold the image and supress non-minimal values to get the human locations. We then plot the bounding boxes using `ImageDraw`.
9999

100100
```julia

docs/src/tutorials/orb.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Let us take a look at a simple example where the ORB descriptor is used to match
2020
First, let us create the two images we will match using ORB.
2121

2222
```@example 2
23-
using ImageFeatures, TestImages, Images, ImageDraw, CoordinateTransformations, Rotations
23+
using ImageFeatures, TestImages, ImageCore, ImageDraw, CoordinateTransformations, Rotations
2424
2525
img = testimage("lighthouse")
2626
img1 = Gray.(img)

src/ImageFeatures.jl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
module ImageFeatures
22

33
# package code goes here
4-
using Images, Distributions
4+
using ImageCore
5+
using ImageCore: NumberLike
6+
using ImageBase
7+
using ImageTransformations # imresize
8+
using ImageCorners
9+
using ImageFiltering
10+
using ImageContrastAdjustment # build_histogram
11+
using IntegralArrays
12+
using Distributions
513
using SparseArrays
614
import Random.seed!
7-
using Images.ImageTransformations.Interpolations
15+
using ImageTransformations.Interpolations
816

917
include("core.jl")
1018
include("const.jl")

0 commit comments

Comments
 (0)