Skip to content

Commit

Permalink
Merge pull request #114 from JuliaRobotics/23Q3/enh/updates
Browse files Browse the repository at this point in the history
updates and feature plot
  • Loading branch information
dehann authored Sep 21, 2023
2 parents a798092 + 5217b52 commit 6ebcef6
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
TensorCast = "02d47bb6-7ce6-556a-be16-bb1710789e2b"

[compat]
Caesar = "0.14, 0.15"
Caesar = "0.15, 0.16"
ColorSchemes = "3"
DocStringExtensions = "0.8, 0.9"
GLMakie = "0.7, 0.8"
Expand Down
1 change: 1 addition & 0 deletions src/Arena.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ using StaticArrays
include("Exports.jl")
include("services/PlotPointCloudMap.jl")
include("services/PlotBoundingBox.jl")
include("services/PlotFeatureTracks.jl")

end # module
4 changes: 3 additions & 1 deletion src/Exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ export plotPointCloud, plotPointCloudPair
export plotGraphPointClouds
export plotBoundingBox, plotBoundingBox!

export makeWireframeHyperRectangle,calcBoxWireframe,plotBoundingBoxHack,plotBoundingBoxHack!,plotBoundingBoxTool,plotWireframeHyperRectangle
export makeWireframeHyperRectangle,calcBoxWireframe,plotBoundingBoxHack,plotBoundingBoxHack!,plotBoundingBoxTool,plotWireframeHyperRectangle

export plotBlobsImageTracks!
44 changes: 44 additions & 0 deletions src/services/PlotFeatureTracks.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@


# visualization aid

function plotBlobsImageTracks!(
dfg::AbstractDFG,
vlb::Symbol,
key = r"IMG_FEATURE_TRACKS_FWDBCK";
fig = GLMakie.Figure(),
ax = GLMakie.Axis(fig[1,1]),
resolution::Union{Nothing,<:Tuple} = nothing,
img::Union{Nothing,<:AbstractMatrix{<:Colorant}} = nothing,
linewidth = 5
)

height = 0
if !isnothing(img)
image!(ax, rotr90(img))
height = size(img,1)
end

eb = getData(dfg,vlb,key)
img_tracks = JSON3.read(String(eb[2]), Dict{Int, Vector{Vector{Float32}}})

len = length(img_tracks)
UU = [Vector{Float64}() for k in 1:len]
VV = [Vector{Float64}() for k in 1:len]

fbk = floor(Int, (len-1)/2)
for k in 1:len
for i in -fbk:fbk
push!(UU[k], img_tracks[i][k][1])
push!(VV[k], height-img_tracks[i][k][2])
end
lines!(ax, UU[k], VV[k]; color=RGBf(rand(3)...), linewidth)
end
if !isnothing(resolution)
xlims!(ax, 0, resolution[1])
ylims!(ax, height - resolution[2], height)
# ylims!(ax, -resolution[2], 0)
end

fig
end

0 comments on commit 6ebcef6

Please sign in to comment.