JuliaImages / JuliaImages/ImageDraw.jl

idea: interpolate the fillvalue

Open
#68 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
27
Forks
16
PR merge metrics
No merged PRs in 30d

Description

It would be nice to allow fill the region with multiple fillvalues:

  • a constant value
  • interpolating/extrapolate a list of values
  • calling a custom function like the etp here
using Interpolations, ImageCore, OffsetArrays, ImageShow
make_circle(r, fillvalues; kwargs...) = make_circle(eltype(fillvalues), r, fillvalues; kwargs...)
function make_circle(T, r, fillvalues::Vector)
    etp = extrapolate(interpolate(fillvalues, BSpline(Linear())), Line())
    sz = (2r+1, 2r+1)
    canvas = OffsetArrays.centered(Array{T, 2}(undef, sz))

    for i in CartesianIndices(canvas)
        d = sqrt(mapreduce(abs2, +, i.I))
        canvas[i] = etp(d)
    end
    return canvas
end

img = mosaic(
    mosaic(
        make_circle(256, collect(0:0.005:0.8)),
        make_circle(256, repeat(collect(0:0.002:0.8))),
        make_circle(256, repeat(collect(0:0.05:0.8), inner=30));
        rowmajor=true, nrow=1
    ),
    mosaic(
        make_circle(256, colormap("Blues")),
        make_circle(256, colormap("Blues", 256)),
        make_circle(256, colormap("Blues", 512));
        rowmajor=true, nrow=1
    )
)

image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how ImageDraw.jl currently handles fillvalue, then compare that behavior with the Julia example using Interpolations and a custom etp function. The issue does not name a source file or test, so the first contribution would need to identify the relevant entry point and define coverage for constant, interpolated or extrapolated, and function-based fillvalues.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.