Skip to content

Commit

Permalink
Use unionFeatureMountain!
Browse files Browse the repository at this point in the history
  • Loading branch information
Affie committed Feb 21, 2024
1 parent 3934f85 commit adfd400
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ext/CaesarImagesExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import Caesar: PackedScatterAlignPose2, PackedScatterAlignPose3
import Caesar: ImageTracks, FEATURE_VIA, FeatTrackValue, FeaturesDict, FeatureTracks, FeatureMountain, PIXELTRACK, MANYTRACKS
import Caesar: addFeatureTracks_Frame1_Q!, addFeatureTracks_Frame2_PfwdQ!, addFeatureTracks_Frame2_QbckR!
import Caesar: addFeatureTracks, consolidateFeatureTracks!, summarizeFeatureTracks!, buildFeatureMountain, buildFeatureMountainDistributed
import Caesar: unionFeatureMountain, sortKeysMinSighting
import Caesar: unionFeatureMountain, unionFeatureMountain!, sortKeysMinSighting

# NOTE usage requires ImageFeatures.jl
import Caesar: curateFeatureTracks
Expand Down
28 changes: 23 additions & 5 deletions ext/Images/FeatureMountain.jl
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,6 @@ end

## union features



function unionFeatureMountain(
fMa::Dict{Tuple{Symbol,Int},MANYTRACKS},
fMb::Dict{Tuple{Symbol,Int},MANYTRACKS},
Expand All @@ -437,7 +435,27 @@ function unionFeatureMountain(
return rM
end


function unionFeatureMountain!(
fMa::Dict{Tuple{Symbol,Int},MANYTRACKS},
fMb::Dict{Tuple{Symbol,Int},MANYTRACKS},
)
# Modify fMa by adding everything from fMb
for (ka,va) in fMb
# @info ka
# union if already exists
if haskey(fMa, ka)
# @info "CHECK TYPES" typeof(fMb[ka]) typeof(fMa[ka])
for (kr,vr) in va
if !haskey(fMa[ka], kr)
fMa[ka][kr] = vr # union(fMb[ka], fMa[ka])
end
end
else
fMa[ka] = va
end
end
return fMa
end

function sortKeysMinSighting(
featM::Dict{Tuple{Symbol,Int},<:Any};
Expand Down Expand Up @@ -492,10 +510,10 @@ function buildFeatureMountainDistributed(
featM = deepcopy(featM_1[1])
# union other tracks into featM
for fM in featM_1[2:end]
featM = Caesar.unionFeatureMountain(featM, fM)
featM = Caesar.unionFeatureMountain!(featM, fM)
end
for fM in featM_2
featM = Caesar.unionFeatureMountain(featM, fM)
featM = Caesar.unionFeatureMountain!(featM, fM)
end

return featM
Expand Down
1 change: 1 addition & 0 deletions ext/WeakdepsPrototypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ function buildFeatureMountain end
function buildFeatureMountainDistributed end

function unionFeatureMountain end
function unionFeatureMountain! end
function sortKeysMinSighting end

## ==============================================
Expand Down

0 comments on commit adfd400

Please sign in to comment.