Commit 93d1f0da authored by Mark Daoust's avatar Mark Daoust
Browse files

use properties

parent ac41d871
......@@ -536,15 +536,19 @@
" d.update(kwargs)\n",
" return type(self)(**d)\n",
"\n",
" @property\n",
" def center(self)-> Tuple[float, float]:\n",
" return ((self.x0+self.x1)/2, (self.y0+self.y1)/2)\n",
" \n",
" @property\n",
" def width(self) -> float:\n",
" return self.x1 - self.x0\n",
"\n",
" @property\n",
" def height(self) -> float:\n",
" return self.y1 - self.y0\n",
"\n",
" @property\n",
" def area(self)-> float:\n",
" return (self.x1 - self.x0 + 1) * (self.y1 - self.y0 + 1)\n",
" \n",
......@@ -562,9 +566,9 @@
" if intersection is None:\n",
" return 0\n",
" \n",
" ia = intersection.area()\n",
" ia = intersection.area\n",
"\n",
" return ia/(self.area() + other.area() - ia)\n",
" return ia/(self.area + other.area - ia)\n",
" \n",
" def draw(self, image, label=None, color=(0, 140, 255)):\n",
" image = np.asarray(image)\n",
......@@ -740,9 +744,9 @@
" of_params = default_of_params()\n",
"\n",
" bboxes = [det.bbox for det in detections]\n",
" centers = np.float32([[bbox.center() for bbox in bboxes]])\n",
" widths = np.float32([[bbox.width() for bbox in bboxes]])\n",
" heights = np.float32([[bbox.height() for bbox in bboxes]])\n",
" centers = np.float32([[bbox.center for bbox in bboxes]])\n",
" widths = np.float32([[bbox.width for bbox in bboxes]])\n",
" heights = np.float32([[bbox.height for bbox in bboxes]])\n",
"\n",
"\n",
" new_centers, status, error = cv2.calcOpticalFlowPyrLK(\n",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment