Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions R/Experiments/C1/Tracking_01_2017-11-17-10-35_86.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
["Tracking_01","Description: Camera for evaluation placed on the showcase faced to the suit.","Height: 2.10","Coordinate_X: 12345","Coordinate_Y: 12345","Coordinate_Z: 12345","Tilt_X: 12.3","Tilt_X: 12.3","Tilt_X: 12.3"]{"bodies_data":{"72057594037960681":[{"x":1.709,"y":-0.826,"height":1.569,"time":"15:04:49.7397877","is_happy":"Neutral","is_wearing_glasses":"Unknown","is_mouth_open":"Unknown","is_mouth_moved":"Unknown","pitch":0,"yaw":0,"roll":0,"left_arm_length":0.633,"right_arm_length":0.516,"shoulders_length":0.323,"left_leg_length":0.646,"right_leg_length":0.709,"body_length":0.512,"body_angle":147.804,"posture":"Undefined","joints_data":{"SpineBase":[0.8144801,-0.7953524,1.7385571],"SpineMid":[0.826328039,-0.50357765,1.70896471],"Neck":[0.8314136,-0.215775222,1.666851],"Head":[0.8223766,-0.09065604,1.64847016],"ShoulderLeft":[0.744041443,-0.281644225,1.82655668],"ElbowLeft":[0.7015463,-0.5782227,1.95023429],"WristLeft":[0.6338373,-0.8074445,1.98114836],"HandLeft":[0.605758667,-0.870826,1.97099674],"ShoulderRight":[0.9157719,-0.32666713,1.55656135],"ElbowRight":[0.9552392,-0.56338954,1.51070225],"WristRight":[0.921833456,-0.802177548,1.47727036],"HandRight":[0.9062353,-0.8293991,1.48250628],"HipLeft":[0.7621151,-0.7719579,1.75885427],"HipRight":[0.8403889,-0.7928879,1.66167307],"SpineShoulder":[0.8312899,-0.287171721,1.67952621],"HandTipLeft":[0.5777031,-0.9272986,1.95382035],"ThumbLeft":[0.568690658,-0.833035767,1.97329426]}},{"x":1.74,"y":-0.689,"height":1.676,"time":"15:04:50.3333723","is_happy":"No","is_wearing_glasses":"No","is_mouth_open":"No","is_mouth_moved":"No","pitch":-20,"yaw":-10,"roll":-5,"left_arm_length":0.648,"right_arm_length":0.525,"shoulders_length":0.306,"left_leg_length":0.731,"right_leg_length":0.831,"body_length":0.514,"body_angle":146.094,"posture":"Undefined","joints_data":{"SpineBase":[0.6813991,-0.782696962,1.76216722],"SpineMid":[0.689357162,-0.489040971,1.73965752],"Neck":[0.69141084,-0.199569046,1.70413542],"Head":[0.6673449,-0.04703246,1.686218],"ShoulderLeft":[0.60745573,-0.2737781,1.84771109],"ElbowLeft":[0.6026056,-0.5354018,1.99143434],"WristLeft":[0.601070344,-0.795671046,2.05671215],"HandLeft":[0.5868262,-0.877607644,2.06230927],"ShoulderRight":[0.7751325,-0.310775578,1.59441614],"ElbowRight":[0.8065901,-0.5614084,1.5430553],"WristRight":[0.773462832,-0.784083843,1.52020156],"HandRight":[0.749907136,-0.822335839,1.53028047],"HipLeft":[0.629839838,-0.772300065,1.77556646],"KneeLeft":[0.613258243,-1.03329778,1.93761384],"HipRight":[0.7102354,-0.767172754,1.69032776],"SpineShoulder":[0.691880465,-0.2713456,1.71524608],"HandTipLeft":[0.574507,-0.936797738,2.057638],"ThumbLeft":[0.5638555,-0.846395,2.0672102],"ThumbRight":[0.7568285,-0.8155228,1.47407722]}},{"x":1.704,"y":-0.487,"height":1.66,"time":"15:04:50.8817976","is_happy":"No","is_wearing_glasses":"No","is_mouth_open":"No","is_mouth_moved":"Yes","pitch":-20,"yaw":10,"roll":-10,"left_arm_length":0.621,"right_arm_length":0.517,"shoulders_length":0.288,"left_leg_length":0.725,"right_leg_length":0.798,"body_length":0.518,"body_angle":137.211,"posture":"Undefined","joints_data":{"SpineBase":[0.4557185,-0.788768,1.71426392],"SpineMid":[0.48700875,-0.492808878,1.7042588],"Neck":[0.513106167,-0.20140323,1.68021739],"Head":[0.4939005,-0.05471506,1.66776347],"ShoulderLeft":[0.413714677,-0.298177332,1.79935622],"ElbowLeft":[0.377270043,-0.5427289,1.94699633],"WristLeft":[0.333085775,-0.801109135,2.01423573],"HandLeft":[0.300660849,-0.861747563,2.00547028],"ShoulderRight":[0.5862869,-0.320986867,1.5696584],"ElbowRight":[0.5980998,-0.5795421,1.51642334],"WristRight":[0.5454275,-0.79065,1.48887515],"HandRight":[0.522638,-0.818949,1.48534036],"HipLeft":[0.404435,-0.775581956,1.72800994],"KneeLeft":[0.355418146,-1.02609062,1.88704348],"HipRight":[0.4906419,-0.7742529,1.640324],"SpineShoulder":[0.5074253,-0.2736124,1.68858254],"HandTipLeft":[0.2693715,-0.922641337,1.99513113],"ThumbLeft":[0.2847316,-0.8355024,2.009],"ThumbRight":[0.537501752,-0.818746448,1.44583344]}},{"x":1.736,"y":-0.337,"height":1.69,"time":"15:04:51.3961653","is_happy":"No","is_wearing_glasses":"No","is_mouth_open":"No","is_mouth_moved":"Yes","pitch":-15,"yaw":5,"roll":-10,"left_arm_length":0.617,"right_arm_length":0.517,"shoulders_length":0.32,"left_leg_length":0.737,"right_leg_length":0.794,"body_length":0.522,"body_angle":130.824,"posture":"Undefined","joints_data":{"SpineBase":[0.317707658,-0.7868602,1.76175618],"SpineMid":[0.3366121,-0.489070445,1.73557138],"Neck":[0.351569027,-0.195542529,1.694951],"Head":[0.3366289,-0.0566868,1.67811847],"ShoulderLeft":[0.230237335,-0.271383,1.81695652],"ElbowLeft":[0.197390571,-0.5208563,1.9395349],"WristLeft":[0.171697557,-0.769421041,2.00251675],"HandLeft":[0.15127936,-0.8469487,2.01168156],"ShoulderRight":[0.4606848,-0.3133378,1.59869432],"ElbowRight":[0.502846241,-0.5669039,1.56133485],"WristRight":[0.477201819,-0.774141967,1.52144969],"HandRight":[0.466287166,-0.82023865,1.53407311],"HipLeft":[0.263487965,-0.776848137,1.76847613],"HipRight":[0.36063236,-0.7694516,1.6937952],"SpineShoulder":[0.348445326,-0.268296361,1.70754325],"HandTipLeft":[0.143072411,-0.9214187,2.01118422],"ThumbLeft":[0.132047728,-0.8814825,1.96781826],"ThumbRight":[0.438191652,-0.808006048,1.56748319]}},{"x":1.796,"y":-0.234,"height":1.695,"time":"15:04:51.9426190","is_happy":"No","is_wearing_glasses":"No","is_mouth_open":"No","is_mouth_moved":"Yes","pitch":-20,"yaw":-10,"roll":0,"left_arm_length":0.623,"right_arm_length":0.564,"shoulders_length":0.346,"left_leg_length":0.74,"right_leg_length":0.791,"body_length":0.527,"body_angle":117.637,"posture":"Undefined","joints_data":{"SpineBase":[0.237477764,-0.782002449,1.83065128],"SpineMid":[0.23367314,-0.4824207,1.796167],"Neck":[0.2262737,-0.1867537,1.74726427],"Head":[0.214298531,-0.05229519,1.72202337],"ShoulderLeft":[0.07023303,-0.2705223,1.85424316],"ElbowLeft":[0.02379208,-0.5341487,1.93377781],"WristLeft":[-0.0321529359,-0.801815867,1.94379091],"HandLeft":[-0.0441541448,-0.8710034,1.92432714],"ShoulderRight":[0.372734159,-0.300031245,1.68879759],"ElbowRight":[0.443138659,-0.565903,1.69436789],"WristRight":[0.4555539,-0.7765687,1.67803359],"HandRight":[0.448373824,-0.854485154,1.6959883],"HipLeft":[0.174575776,-0.7735568,1.82663321],"HipRight":[0.291891724,-0.7640165,1.77260268],"SpineShoulder":[0.228566483,-0.2600672,1.76194644],"HandTipLeft":[-0.0485177636,-0.9288732,1.89846992],"ThumbLeft":[-0.08979261,-0.853144467,1.92353845],"HandTipRight":[0.451802671,-0.9283223,1.69391024],"ThumbRight":[0.407504529,-0.8173736,1.686577]}},{"x":1.658,"y":-0.192,"height":1.678,"time":"15:04:52.5843277","is_happy":"No","is_wearing_glasses":"No","is_mouth_open":"No","is_mouth_moved":"Yes","pitch":-25,"yaw":-20,"roll":5,"left_arm_length":0.609,"right_arm_length":0.538,"shoulders_length":0.341,"left_leg_length":0.746,"right_leg_length":0.732,"body_length":0.516,"body_angle":106.906,"posture":"Undefined","joints_data":{"SpineBase":[0.200293824,-0.8208871,1.6956476],"SpineMid":[0.1920787,-0.5277466,1.6583966],"Neck":[0.182271928,-0.238013878,1.60635149],"Head":[0.175874889,-0.103234172,1.58326185],"ShoulderLeft":[0.01921765,-0.3262555,1.68191922],"ElbowLeft":[-0.019155724,-0.5874136,1.7662667],"WristLeft":[-0.04971871,-0.851043642,1.79529977],"HandLeft":[-0.0403801,-0.9176957,1.78830338],"ShoulderRight":[0.344705373,-0.3436725,1.58118],"ElbowRight":[0.419448,-0.607480645,1.628559],"WristRight":[0.4567928,-0.810102046,1.62415528],"HandRight":[0.4514948,-0.865180254,1.62282932],"HipLeft":[0.130981684,-0.8117613,1.68241227],"HipRight":[0.262515754,-0.800389469,1.64750516],"SpineShoulder":[0.1849936,-0.3099171,1.621873],"HandTipLeft":[-0.0220886264,-0.977535367,1.7754966],"ThumbLeft":[0.010765885,-0.931575358,1.75133324],"ThumbRight":[0.415692061,-0.8526627,1.61542881]}},{"x":1.46,"y":-0.261,"height":1.534,"time":"15:04:53.2110218","is_happy":"Neutral","is_wearing_glasses":"Unknown","is_mouth_open":"Unknown","is_mouth_moved":"Unknown","pitch":-35,"yaw":-30,"roll":5,"left_arm_length":0.482,"right_arm_length":0.432,"shoulders_length":0.326,"left_leg_length":0.588,"right_leg_length":0.762,"body_length":0.484,"body_angle":93.42,"posture":"Undefined","joints_data":{"SpineBase":[0.2597718,-0.8124045,1.51728332],"SpineMid":[0.260685921,-0.5418898,1.46022749],"Neck":[0.259361267,-0.274279982,1.38571072],"Head":[0.269720316,-0.146735877,1.3594209],"ShoulderLeft":[0.09959331,-0.344801039,1.42582107],"ElbowLeft":[0.0173986573,-0.5954902,1.46461129],"WristLeft":[-0.03015192,-0.7916014,1.44272649],"HandLeft":[-0.03215971,-0.801362157,1.42811692],"ShoulderRight":[0.42028,-0.364601433,1.37075913],"ElbowRight":[0.47767356,-0.5844974,1.379661],"HipLeft":[0.181608662,-0.7951365,1.50223076],"FootLeft":[-0.004458973,-0.808632433,1.42496014],"HipRight":[0.327940434,-0.797697663,1.47242379],"SpineShoulder":[0.2601546,-0.34076798,1.40700769],"ThumbLeft":[0.00187753071,-0.8050487,1.41965365]}},{"x":1.334,"y":-0.27,"height":1.509,"time":"15:04:53.7304046","is_happy":"Neutral","is_wearing_glasses":"Unknown","is_mouth_open":"Unknown","is_mouth_moved":"Unknown","pitch":-50,"yaw":-35,"roll":15,"left_arm_length":0.51,"right_arm_length":0.515,"shoulders_length":0.317,"left_leg_length":0.672,"right_leg_length":0.772,"body_length":0.471,"body_angle":81.809,"posture":"Undefined","joints_data":{"SpineMid":[0.2695191,-0.5652759,1.33358872],"Neck":[0.242582247,-0.3088716,1.24943173],"Head":[0.2609318,-0.187646136,1.2227807],"ShoulderLeft":[0.09078004,-0.387820631,1.26028013],"ElbowLeft":[0.007998936,-0.6273745,1.32194531],"ShoulderRight":[0.407400638,-0.406523466,1.25560963],"ElbowRight":[0.476308018,-0.6361736,1.308836],"AnkleLeft":[0.0296643637,-0.780948043,1.465376],"SpineShoulder":[0.249675855,-0.372717619,1.27308726]}},{"x":1.18,"y":-0.152,"height":1.62,"time":"15:04:54.2768579","is_happy":"Neutral","is_wearing_glasses":"Unknown","is_mouth_open":"Unknown","is_mouth_moved":"Unknown","pitch":-45,"yaw":-40,"roll":5,"left_arm_length":0.51,"right_arm_length":0.5,"shoulders_length":0.293,"left_leg_length":0.62,"right_leg_length":0.798,"body_length":0.451,"body_angle":75.626,"posture":"Undefined","joints_data":{"SpineMid":[0.151984438,-0.589176238,1.17952275],"Neck":[0.133699566,-0.3514513,1.07055736],"Head":[0.15714398,-0.240626663,1.04059887],"ShoulderLeft":[0.008020215,-0.427223653,1.07486951],"ShoulderRight":[0.3002056,-0.436272919,1.08502269],"ElbowRight":[0.384154081,-0.6155943,1.13841486],"SpineShoulder":[0.138561159,-0.411003768,1.100266]}},{"x":1.078,"y":-0.113,"height":1.596,"time":"15:04:54.7811984","is_happy":"Neutral","is_wearing_glasses":"Unknown","is_mouth_open":"Unknown","is_mouth_moved":"Unknown","pitch":-45,"yaw":-40,"roll":5,"left_arm_length":0.511,"right_arm_length":0.503,"shoulders_length":0.276,"left_leg_length":0.616,"right_leg_length":0.79,"body_length":0.434,"body_angle":77.419,"posture":"Undefined","joints_data":{"SpineMid":[0.113133095,-0.6068915,1.07766068],"Neck":[0.092144005,-0.3754847,0.9777737],"Head":[0.09351064,-0.259460419,0.9601485],"ShoulderLeft":[-0.03760928,-0.427661926,0.98447454],"ShoulderRight":[0.2383264,-0.441383,0.9873068],"SpineShoulder":[0.09757653,-0.43360123,1.005185]}}]}}
37 changes: 6 additions & 31 deletions R/analyzestats.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
source("find_stops.R")
source("aggStats.R")

setClass(Class = "stopmat" , slots = c("breaks","moves") )

setClass(Class = "exportClass" , slots = c("breaks","lClass","moves") )

#This is for printing original globalized_tracks!!
# for(track_id in 1:length(globalized_tracks))
Expand All @@ -12,49 +7,29 @@ setClass(Class = "exportClass" , slots = c("breaks","lClass","moves") )
# }
stat_version = function(merged_tracks)
{
movpat = c()
l = c()

breaks = list()
valid_tracks = 1

for(track_id in 1:length(merged_tracks))
{
#breaks[[track_id]] = demarcate_stops(track_id, merged_tracks,movpat)

stops_return = demarcate_stops(track_id, merged_tracks)

breaks[[track_id]] = stops_return@breaks

if(dim(stops_return@moves)[1]>0) {
movpat[[paste("t0",valid_tracks,sep="")]] = stops_return@moves
l[[paste("t0",valid_tracks,sep="")]] = getTracks(merged_tracks[[track_id]],stops_return@breaks)
valid_tracks = valid_tracks+1
}

breaks[[track_id]] = demarcate_stops(track_id, merged_tracks)

# #The following line for plotting globalized_tracks!
# breaks[[track_id]] = demarcate_stops(track_id, globalized_tracks)
# breaks[[track_id]] = demarcate_stops(track_id, merged_tracks_s)
# breaks[[track_id]] = demarcate_stops(track_id, merged_tracks_d)
}

stops_moves = new("exportClass", breaks = breaks , lClass = l ,moves = movpat)

return(stops_moves)
return(breaks)
}


merged_tracks_s = s_merged[!is.na(s_merged)]
merged_tracks_d = d_merged[!is.na(d_merged)]

null_filter = lapply(X = merged_tracks_d, FUN = is.null)
# merged_tracks_d = d_merged[!is.na(d_merged)]
merged_tracks_d = merged_tracks_d[null_filter == FALSE]

result = stat_version(merged_tracks_d)
# breaks_g = stat_version(globalized_tracks)
# breaks_s = stat_version(merged_tracks_s)
breaks = stat_version(merged_tracks_d)

breaks = result@breaks

print("Finished finding stops!")

source('export.R')
31 changes: 10 additions & 21 deletions R/find_stops.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ find_diffs_it = function(xyb)
return(breaklist[1:length(breaklist)])
}


demarcate_stops = function(track_no, track_bunch)
{
#In demarcate_stops!
Expand All @@ -61,22 +60,18 @@ demarcate_stops = function(track_no, track_bunch)
i = i+1
}

egtrack_coords = coordinates(egtrack)[1:dim(egtrack)-1,]
bpds = as.data.frame(cbind(egtrack_coords, bool_stop))
# egtrack_coords = coordinates(egtrack)[1:dim(egtrack)-1,]
egtrack_coords = coordinates(egtrack)

bpds = as.data.frame(cbind(egtrack_coords, bool_stop))
bpts = find_diffs_it(bpds)


source('extractMoves.R')

x_df = get_x_df(bpts,bpds,egtrack)

# 1

no_of_stop = length(bpts)/2

plot(egtrack, type = 'b', main = track_no)

if(!is.null(bpts))
{
no_of_stop = length(bpts)/2
} else no_of_stop = 0

if(no_of_stop > 0)
{
bpts_mat = matrix(data = bpts, ncol = 2, byrow = TRUE, dimnames = list(c(), c("start", "end")))
Expand All @@ -100,14 +95,8 @@ demarcate_stops = function(track_no, track_bunch)
rect(xleft = affected_bbox[[stops]][1,1], ybottom = affected_bbox[[stops]][2,1], xright = affected_bbox[[stops]][1,2], ytop = affected_bbox[[stops]][2,2], col = rgb(1,0,0,0.1), border = TRUE, lwd = 2)
}
# bbox

bpts_df = cbind(bpts_df, as.data.frame(duration))

classify_bpts_df = new("stopmat", breaks = bpts_df ,moves = x_df)

} else {
classify_bpts_df = new("stopmat", breaks = NA ,moves = x_df)
}
return(classify_bpts_df)
} else bpts_df = NA
return(bpts_df)
}

4 changes: 2 additions & 2 deletions R/import.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ library('jsonlite')
json_data = list(c1 = list(), c2 = list(), c4 = list())

files = list.files(path = "Experiments/", pattern = "*.json", recursive = TRUE, full.names = TRUE)
# files = list.files(path = "ExperimentsTrials/", pattern = "*.json", recursive = TRUE, full.names = TRUE)

for(filename_w_path in files)
{
Expand Down Expand Up @@ -60,7 +61,6 @@ for(filename_w_path in files)
# op <- options(digits.secs=6)
json_data[[cid]][[tailpos]]$time = strptime(json_data[[cid]][[tailpos]]$time, format = "%H:%M:%OS")#, format = "%H:%M:%OS")
json_data[[cid]][[tailpos]]$camera = cid
json_data[[cid]][[tailpos]]$t_id = tailpos

#Find starting & ending times
# print("Start time: ")
Expand Down Expand Up @@ -88,7 +88,7 @@ globalized_tracks = create_trajectories(globalized_json)
print("Finished creating objects of class Tracks to represent visitors' trajectories!")

#"outline_Yuan.R" by Yuan
#source("outline_Yuan.R")
source("outline_Yuan.R")
#globalized_tracks_cleaned = outline(globalized_tracks)
print("Finished cleaning tracks for various errors!")

16 changes: 0 additions & 16 deletions R/main.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,3 @@ source("analyzetracks.R")

#Calculating statistics
source("analyzestats.R")


c
st = c()
mv = c()
for(i in 1: length(xxx$tracks) )
{
t = xxx$tracks[[i]]


st[[i]] = sum( t[t$stop==1,]$percentage )

mv[[i]] = sum( t[t$stop==0,]$percentage )


}
Loading