Skip to content

Commit

Permalink
change input binary image dtype
Browse files Browse the repository at this point in the history
  • Loading branch information
yl-jiang committed Jan 6, 2023
1 parent f23aa31 commit aa0161b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions contour_tracing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@
"source": [
"class ComponentLabeling:\n",
" def __init__(self, binary_img) -> None:\n",
" self.img = binary_img\n",
" self.lab = np.zeros_like(binary_img)\n",
" self.img = binary_img.astype(np.int32)\n",
" self.lab = np.zeros_like(self.img)\n",
" self.tracer = ContourTracer()\n",
" self.internal_points = []\n",
" self.external_points = []\n",
Expand Down Expand Up @@ -170,7 +170,7 @@
"source": [
"def show_contour_tracing(binary_image_path):\n",
" img = cv2.imread(binary_image_path, 0)\n",
" labeling = ComponentLabeling(img.astype(np.int16))\n",
" labeling = ComponentLabeling(img)\n",
" labeling()\n",
" res = np.zeros(shape=list(labeling.lab.shape) + [3]).astype(np.uint8)\n",
" # for lab in np.unique(labeling.lab):\n",
Expand Down Expand Up @@ -389,7 +389,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.15"
"version": "3.8.15 (default, Nov 24 2022, 15:19:38) \n[GCC 11.2.0]"
},
"orig_nbformat": 4,
"vscode": {
Expand Down

0 comments on commit aa0161b

Please sign in to comment.