Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
22_23-J-84
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
KSH.Mohamed
22_23-J-84
Commits
9162fb2b
Commit
9162fb2b
authored
Apr 19, 2023
by
Mohammed Azzam M.A
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
a0f9dc62
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
0 deletions
+56
-0
kalmen.py.txt
kalmen.py.txt
+56
-0
No files found.
kalmen.py.txt
0 → 100644
View file @
9162fb2b
import numpy as np
self.kf.Q[4:, 4:] *= 0.01
self.ylist.append(zbox[1][0])
else:
self.ylist.append(zbox[1][0])
if len(self.xlist) > 1:
# print(self.xlist)
xstd = statistics.stdev(self.xlist)
ystd = statistics.stdev(self.ylist)
if xstd < self.stdvar and ystd < self.stdvar and len(self.xlist) >= self.length :
self.dynamicstste = 0
else:
self.dynamicstste = 1
if len(self.ylist) >= int(config.fps):
if self.ylist[-1] > self.ylist[-int(config.fps)]:
self.reversevar = 1
elif self.ylist[-1] < self.ylist[-int(config.fps)]:
self.reversevar = -1
else:
self.reversevar = 0
# print('0',self.ylist[-int(config.fps)],'-1',self.ylist[-1])
return np.concatenate((convert_x_to_bbox(zbox)[0],[self.dynamicstste],[self.reversevar]))
def convert_bbox_to_z(bbox):
"""
Takes a bounding box in the form [x1,y1,x2,y2] and returns z in the form
[x,y,s,r] where x,y is the centre of the box and s is the scale/area and r is
the aspect ratio
"""
w = bbox[2] - bbox[0]
h = bbox[3] - bbox[1]
x = bbox[0] + w/2.
y = bbox[1] + h/2.
s = w * h
r = w / float(h)
return np.array([x, y, s, r]).reshape((4, 1))
def convert_x_to_bbox(x,score=None):
"""
Takes a bounding box in the centre form [x,y,s,r] and returns it in the form
[x1,y1,x2,y2] where x1,y1 is the top left and x2,y2 is the bottom right
"""
w = np.sqrt(x[2] * x[3])
h = x[2] / w
if score == None:
return np.array([x[0]-w/2., x[1]-h/2., x[0]+w/2., x[1]+h/2.]).reshape((1, 4))
else:
return np.array([x[0]-w/2., x[1]-h/2., x[0]+w/2., x[1]+h/2., score]).reshape((1, 5))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment