-
Notifications
You must be signed in to change notification settings - Fork 27
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
Streamline API for warp and WarpedView #24
Changes from 1 commit
1957490
fccebb1
1015bfd
c257622
38bcb40
6a2d808
e5e6ccb
28aa3f7
2bdbce4
106f2d0
a2aa627
b79619d
a805cc3
fcf939c
5ca0028
86d0afb
ad5cb02
1ae4634
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,10 +74,13 @@ julia> indices(imgr) | |
``` | ||
""" | ||
function warp_new{T}(img::AbstractExtrapolation{T}, tform, inds::Tuple = autorange(img, inv(tform))) | ||
out = OffsetArray(Array{T}(map(length, inds)), inds) | ||
out = _allocate_array(T, inds) | ||
warp!(out, img, tform) | ||
end | ||
|
||
_allocate_array{T,N}(::Type{T}, inds::NTuple{N,Base.OneTo}) = Array{T}(map(length, inds)) | ||
_allocate_array{T,N}(::Type{T}, inds::NTuple{N,AbstractUnitRange}) = OffsetArray(Array{T}(map(length, inds)), inds) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unsure if this change could be considered controversial, but I did it because now behaviour should be consistent between julia> summary(warp(img_camera, tfm, indices(img_camera)))
"512×512 Array{Gray{N0f8},2}"
julia> summary(collect(warpedview(img_camera, tfm, indices(img_camera))))
"512×512 Array{Gray{N0f8},2}" and julia> summary(warp(img_camera, tfm))
"-78:591×-78:591 OffsetArray{Gray{N0f8},2}"
julia> summary(collect(warpedview(img_camera, tfm)))
"-78:591×-78:591 OffsetArray{Gray{N0f8},2}" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The behavior of Nevertheless I like this change overall. I would write the second, however, as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh, yeah. that is a lot nicer. thanks |
||
|
||
# this function was never exported, so no need to deprecate | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed. |
||
function warp!(out, img::AbstractExtrapolation, tform) | ||
@inbounds for I in CartesianRange(indices(out)) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[0m[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;234;48;5;240m▀[38;5;239;48;5;247m▀[38;5;239;48;5;247m▀[38;5;239;48;5;247m▀[38;5;240;48;5;247m▀[38;5;240;48;5;247m▀[38;5;240;48;5;248m▀[38;5;240;48;5;248m▀[38;5;240;48;5;248m▀[38;5;240;48;5;248m▀[38;5;240;48;5;248m▀[38;5;240;48;5;248m▀[38;5;240;48;5;248m▀[38;5;240;48;5;248m▀[38;5;240;48;5;249m▀[38;5;235;48;5;247m▀[38;5;233;48;5;243m▀[38;5;232;48;5;238m▀[38;5;232;48;5;233m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[0m | ||
[0m[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;234;48;5;238m▀[38;5;244;48;5;246m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;248m▀[38;5;248;48;5;248m▀[38;5;248;48;5;248m▀[38;5;248;48;5;248m▀[38;5;248;48;5;248m▀[38;5;248;48;5;248m▀[38;5;248;48;5;248m▀[38;5;248;48;5;248m▀[38;5;248;48;5;248m▀[38;5;248;48;5;249m▀[38;5;249;48;5;249m▀[38;5;249;48;5;249m▀[38;5;249;48;5;249m▀[38;5;248;48;5;249m▀[38;5;245;48;5;249m▀[38;5;240;48;5;248m▀[38;5;235;48;5;246m▀[38;5;232;48;5;242m▀[38;5;232;48;5;236m▀[38;5;232;48;5;233m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[0m | ||
[0m[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;233;48;5;236m▀[38;5;243;48;5;246m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;248m▀[38;5;248;48;5;248m▀[38;5;248;48;5;248m▀[38;5;248;48;5;248m▀[38;5;248;48;5;248m▀[38;5;248;48;5;248m▀[38;5;248;48;5;248m▀[38;5;248;48;5;248m▀[38;5;248;48;5;247m▀[38;5;248;48;5;239m▀[38;5;248;48;5;237m▀[38;5;249;48;5;242m▀[38;5;249;48;5;248m▀[38;5;249;48;5;249m▀[38;5;249;48;5;249m▀[38;5;248;48;5;249m▀[38;5;248;48;5;248m▀[38;5;248;48;5;248m▀[38;5;248;48;5;248m▀[38;5;247;48;5;248m▀[38;5;244;48;5;247m▀[38;5;238;48;5;247m▀[38;5;234;48;5;245m▀[38;5;232;48;5;240m▀[38;5;232;48;5;234m▀[0m | ||
[0m[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;232;48;5;234m▀[38;5;241;48;5;245m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;248;48;5;247m▀[38;5;248;48;5;245m▀[38;5;248;48;5;242m▀[38;5;247;48;5;237m▀[38;5;244;48;5;234m▀[38;5;246;48;5;235m▀[38;5;248;48;5;239m▀[38;5;248;48;5;239m▀[38;5;240;48;5;234m▀[38;5;233;48;5;236m▀[38;5;233;48;5;234m▀[38;5;234;48;5;234m▀[38;5;242;48;5;235m▀[38;5;248;48;5;246m▀[38;5;248;48;5;248m▀[38;5;248;48;5;248m▀[38;5;248;48;5;248m▀[38;5;248;48;5;248m▀[38;5;248;48;5;248m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;239;48;5;239m▀[0m | ||
[0m[38;5;232;48;5;232m▀[38;5;232;48;5;233m▀[38;5;239;48;5;244m▀[38;5;246;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;246;48;5;241m▀[38;5;242;48;5;234m▀[38;5;237;48;5;233m▀[38;5;235;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;235;48;5;237m▀[38;5;238;48;5;241m▀[38;5;240;48;5;237m▀[38;5;243;48;5;244m▀[38;5;242;48;5;243m▀[38;5;237;48;5;240m▀[38;5;245;48;5;242m▀[38;5;248;48;5;246m▀[38;5;248;48;5;248m▀[38;5;248;48;5;248m▀[38;5;248;48;5;248m▀[38;5;248;48;5;248m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;246m▀[38;5;239;48;5;239m▀[0m | ||
[0m[38;5;232;48;5;233m▀[38;5;237;48;5;242m▀[38;5;246;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;241;48;5;245m▀[38;5;233;48;5;235m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;236;48;5;234m▀[38;5;236;48;5;235m▀[38;5;235;48;5;237m▀[38;5;243;48;5;245m▀[38;5;240;48;5;238m▀[38;5;238;48;5;237m▀[38;5;241;48;5;240m▀[38;5;243;48;5;244m▀[38;5;248;48;5;246m▀[38;5;248;48;5;248m▀[38;5;248;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;246m▀[38;5;246;48;5;246m▀[38;5;239;48;5;239m▀[0m | ||
[0m[38;5;234;48;5;236m▀[38;5;244;48;5;242m▀[38;5;246;48;5;245m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;246m▀[38;5;245;48;5;239m▀[38;5;235;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;234m▀[38;5;233;48;5;235m▀[38;5;234;48;5;234m▀[38;5;235;48;5;234m▀[38;5;235;48;5;233m▀[38;5;234;48;5;233m▀[38;5;236;48;5;236m▀[38;5;244;48;5;245m▀[38;5;244;48;5;249m▀[38;5;240;48;5;240m▀[38;5;238;48;5;241m▀[38;5;245;48;5;247m▀[38;5;244;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;246;48;5;246m▀[38;5;246;48;5;246m▀[38;5;246;48;5;246m▀[38;5;239;48;5;239m▀[0m | ||
[0m[38;5;236;48;5;237m▀[38;5;242;48;5;241m▀[38;5;244;48;5;240m▀[38;5;246;48;5;240m▀[38;5;246;48;5;237m▀[38;5;238;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;234;48;5;233m▀[38;5;235;48;5;234m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;234m▀[38;5;236;48;5;236m▀[38;5;236;48;5;237m▀[38;5;237;48;5;235m▀[38;5;240;48;5;245m▀[38;5;246;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;246m▀[38;5;246;48;5;246m▀[38;5;246;48;5;246m▀[38;5;246;48;5;246m▀[38;5;239;48;5;239m▀[0m | ||
[0m[38;5;238;48;5;238m▀[38;5;243;48;5;244m▀[38;5;243;48;5;238m▀[38;5;236;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;234m▀[38;5;234;48;5;241m▀[38;5;239;48;5;245m▀[38;5;235;48;5;238m▀[38;5;236;48;5;241m▀[38;5;240;48;5;245m▀[38;5;235;48;5;240m▀[38;5;241;48;5;244m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;247m▀[38;5;247;48;5;246m▀[38;5;247;48;5;246m▀[38;5;247;48;5;246m▀[38;5;247;48;5;247m▀[38;5;247;48;5;246m▀[38;5;246;48;5;246m▀[38;5;246;48;5;246m▀[38;5;246;48;5;246m▀[38;5;245;48;5;245m▀[38;5;239;48;5;239m▀[0m | ||
[0m[38;5;238;48;5;238m▀[38;5;240;48;5;241m▀[38;5;234;48;5;234m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;236m▀[38;5;241;48;5;242m▀[38;5;247;48;5;242m▀[38;5;240;48;5;240m▀[38;5;241;48;5;245m▀[38;5;246;48;5;246m▀[38;5;246;48;5;244m▀[38;5;240;48;5;239m▀[38;5;244;48;5;245m▀[38;5;247;48;5;248m▀[38;5;247;48;5;247m▀[38;5;247;48;5;246m▀[38;5;246;48;5;247m▀[38;5;247;48;5;248m▀[38;5;247;48;5;247m▀[38;5;246;48;5;246m▀[38;5;246;48;5;246m▀[38;5;246;48;5;246m▀[38;5;246;48;5;246m▀[38;5;245;48;5;245m▀[38;5;245;48;5;245m▀[38;5;239;48;5;238m▀[0m | ||
[0m[38;5;238;48;5;238m▀[38;5;244;48;5;242m▀[38;5;236;48;5;235m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;235m▀[38;5;236;48;5;242m▀[38;5;246;48;5;244m▀[38;5;243;48;5;239m▀[38;5;237;48;5;240m▀[38;5;240;48;5;241m▀[38;5;245;48;5;243m▀[38;5;247;48;5;243m▀[38;5;246;48;5;244m▀[38;5;240;48;5;240m▀[38;5;244;48;5;243m▀[38;5;248;48;5;248m▀[38;5;247;48;5;248m▀[38;5;246;48;5;246m▀[38;5;247;48;5;248m▀[38;5;248;48;5;248m▀[38;5;247;48;5;246m▀[38;5;246;48;5;246m▀[38;5;246;48;5;247m▀[38;5;246;48;5;246m▀[38;5;245;48;5;245m▀[38;5;245;48;5;245m▀[38;5;244;48;5;241m▀[38;5;235;48;5;232m▀[0m | ||
[0m[38;5;238;48;5;236m▀[38;5;238;48;5;235m▀[38;5;235;48;5;236m▀[38;5;234;48;5;235m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;233m▀[38;5;233;48;5;234m▀[38;5;234;48;5;239m▀[38;5;241;48;5;244m▀[38;5;244;48;5;242m▀[38;5;240;48;5;237m▀[38;5;238;48;5;241m▀[38;5;243;48;5;243m▀[38;5;243;48;5;245m▀[38;5;242;48;5;244m▀[38;5;242;48;5;244m▀[38;5;241;48;5;243m▀[38;5;238;48;5;239m▀[38;5;239;48;5;239m▀[38;5;243;48;5;240m▀[38;5;246;48;5;240m▀[38;5;246;48;5;240m▀[38;5;247;48;5;246m▀[38;5;247;48;5;247m▀[38;5;246;48;5;246m▀[38;5;246;48;5;245m▀[38;5;246;48;5;246m▀[38;5;246;48;5;246m▀[38;5;245;48;5;245m▀[38;5;245;48;5;243m▀[38;5;236;48;5;233m▀[38;5;232;48;5;232m▀[0m | ||
[0m[38;5;234;48;5;234m▀[38;5;235;48;5;235m▀[38;5;236;48;5;237m▀[38;5;237;48;5;239m▀[38;5;234;48;5;234m▀[38;5;233;48;5;235m▀[38;5;233;48;5;237m▀[38;5;237;48;5;241m▀[38;5;243;48;5;242m▀[38;5;243;48;5;238m▀[38;5;239;48;5;239m▀[38;5;242;48;5;244m▀[38;5;244;48;5;244m▀[38;5;243;48;5;244m▀[38;5;245;48;5;245m▀[38;5;243;48;5;244m▀[38;5;243;48;5;243m▀[38;5;244;48;5;244m▀[38;5;240;48;5;239m▀[38;5;241;48;5;241m▀[38;5;242;48;5;244m▀[38;5;238;48;5;244m▀[38;5;237;48;5;242m▀[38;5;240;48;5;240m▀[38;5;248;48;5;243m▀[38;5;248;48;5;244m▀[38;5;247;48;5;244m▀[38;5;246;48;5;243m▀[38;5;246;48;5;243m▀[38;5;245;48;5;243m▀[38;5;238;48;5;234m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[0m | ||
[0m[38;5;233;48;5;232m▀[38;5;237;48;5;236m▀[38;5;241;48;5;240m▀[38;5;238;48;5;237m▀[38;5;235;48;5;236m▀[38;5;236;48;5;237m▀[38;5;242;48;5;243m▀[38;5;244;48;5;243m▀[38;5;241;48;5;244m▀[38;5;238;48;5;245m▀[38;5;241;48;5;243m▀[38;5;242;48;5;243m▀[38;5;243;48;5;243m▀[38;5;243;48;5;243m▀[38;5;244;48;5;244m▀[38;5;244;48;5;244m▀[38;5;244;48;5;244m▀[38;5;244;48;5;244m▀[38;5;240;48;5;241m▀[38;5;240;48;5;242m▀[38;5;243;48;5;244m▀[38;5;242;48;5;243m▀[38;5;243;48;5;242m▀[38;5;244;48;5;242m▀[38;5;244;48;5;242m▀[38;5;242;48;5;243m▀[38;5;241;48;5;243m▀[38;5;238;48;5;240m▀[38;5;238;48;5;237m▀[38;5;237;48;5;233m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[0m | ||
[0m[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;233;48;5;232m▀[38;5;234;48;5;232m▀[38;5;235;48;5;232m▀[38;5;239;48;5;235m▀[38;5;243;48;5;238m▀[38;5;242;48;5;243m▀[38;5;246;48;5;244m▀[38;5;244;48;5;243m▀[38;5;243;48;5;243m▀[38;5;243;48;5;244m▀[38;5;244;48;5;243m▀[38;5;243;48;5;243m▀[38;5;244;48;5;243m▀[38;5;244;48;5;244m▀[38;5;244;48;5;244m▀[38;5;244;48;5;244m▀[38;5;241;48;5;240m▀[38;5;242;48;5;240m▀[38;5;244;48;5;243m▀[38;5;244;48;5;243m▀[38;5;243;48;5;243m▀[38;5;243;48;5;243m▀[38;5;242;48;5;243m▀[38;5;242;48;5;243m▀[38;5;243;48;5;242m▀[38;5;243;48;5;242m▀[38;5;240;48;5;236m▀[38;5;233;48;5;232m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[0m | ||
[0m[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;234;48;5;232m▀[38;5;237;48;5;232m▀[38;5;241;48;5;233m▀[38;5;243;48;5;236m▀[38;5;243;48;5;239m▀[38;5;243;48;5;242m▀[38;5;243;48;5;243m▀[38;5;243;48;5;243m▀[38;5;243;48;5;244m▀[38;5;243;48;5;243m▀[38;5;244;48;5;243m▀[38;5;241;48;5;243m▀[38;5;241;48;5;244m▀[38;5;243;48;5;243m▀[38;5;243;48;5;243m▀[38;5;243;48;5;243m▀[38;5;242;48;5;243m▀[38;5;243;48;5;243m▀[38;5;243;48;5;242m▀[38;5;243;48;5;243m▀[38;5;241;48;5;238m▀[38;5;233;48;5;232m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[38;5;232;48;5;232m▀[0m | ||
[0m[38;5;232m▀[38;5;232m▀[38;5;232m▀[38;5;232m▀[38;5;232m▀[38;5;232m▀[38;5;232m▀[38;5;232m▀[38;5;232m▀[38;5;232m▀[38;5;232m▀[38;5;232m▀[38;5;234m▀[38;5;237m▀[38;5;238m▀[38;5;238m▀[38;5;238m▀[38;5;237m▀[38;5;237m▀[38;5;238m▀[38;5;237m▀[38;5;237m▀[38;5;238m▀[38;5;237m▀[38;5;237m▀[38;5;237m▀[38;5;237m▀[38;5;234m▀[38;5;232m▀[38;5;232m▀[38;5;232m▀[38;5;232m▀[38;5;232m▀[0m |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Someday this will have to become
tform::InvertibleTransformation
or similar.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Presumably invertibility is more of a trait? I can't see it fitting neatly into the type hierarchy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, yes, agreed.