Skip to content

Commit

Permalink
add a colour backfill
Browse files Browse the repository at this point in the history
  • Loading branch information
jonocarroll committed Feb 3, 2024
1 parent 7397437 commit 45828e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ triangles where possible
* `debug=false`: draw the sampled points and edges explicitly
* `showimage=true`: show a grayscale version of the original image beneath the
debug points
* `showimagecol=true`: show a colour version of the original image beneath the
debug points

```
triangulArt(bird, npts=500)
Expand Down
11 changes: 8 additions & 3 deletions src/TriangulArt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ end
fast::Bool=false,
refine::Bool=false,
debug::Bool=false,
showimage::Bool=true
showimage::Bool=false,
showimagecol::Bool=false
)
Create an artistic Delaunay Triangulation from an image
Expand All @@ -103,7 +104,8 @@ Create an artistic Delaunay Triangulation from an image
- `fast::Bool=false`: if `true`, use random sampling, otherwise use the local entropy to select the vertices
- `refine::Bool=false`: use `DelaunayTriangulation::refine()` to refine the vertices
- `debug::Bool=false`: use debug mode; plot the triangle vertices and edges
- `showimage::Bool=false`: in debug mode, plot a grayscale version of the original image beneath the points
- `showimage::Bool=false`: plot a grayscale version of the original image beneath the points
- `showimagecol::Bool=false`: plot a colour version of the original image beneath the points
"""
function triangulArt(
Expand All @@ -112,7 +114,8 @@ function triangulArt(
fast::Bool=false,
refine::Bool=false,
debug::Bool=false,
showimage::Bool=true
showimage::Bool=false,
showimagecol::Bool=false
)
orig_image = copy(image)
# use a 3D representation
Expand Down Expand Up @@ -169,6 +172,8 @@ function triangulArt(

if showimage
pl = plot(Gray.(img_HWC[:, :, 1, 1]), showaxis=false, xlim=(1, sizex), ylim=(1, sizey), aspect_ratio=:auto)
elseif showimagecol
pl = plot(orig_image, showaxis=false, xlim=(1, sizex), ylim=(1, sizey), aspect_ratio=:auto)
else
pl = plot(showaxis=false, yflip=true, xlim=(1, sizex), ylim=(1, sizey))
end
Expand Down

0 comments on commit 45828e7

Please sign in to comment.