Skip to content

Commit

Permalink
docs: update the jupiter notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanchristopheruel committed Aug 22, 2024
1 parent b94b8f2 commit d7915c2
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions notebooks/general_template_matching_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@
"This notebook demonstrates general template matching using the OpenFDCM library.\n",
"Unlike the [other notebook which focused on pose estimation](https://github.com/Innoptech/OpenFDCM/blob/main/notebooks/pose_extimation_example.ipynb), this notebook covers basic template matching techniques.\n",
"We will:\n",
"- Decode images from Base64 strings,\n",
"- Detect lines using OpenCV's Fast Line Detector,\n",
"- Match templates efficiently using the OpenFDCM library.\n",
"\n",
"Let's get started by importing the necessary libraries and defining utility functions.\n"
"- Match templates efficiently using the OpenFDCM library.\n"
]
},
{
Expand Down Expand Up @@ -226,7 +223,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": null,
"id": "a676c48e",
"metadata": {
"colab": {
Expand Down Expand Up @@ -257,8 +254,11 @@
}
],
"source": [
"# Here we define two different template images\n",
"tmpl1_image = cv2.imread(tmpl1_image_path)\n",
"tmpl2_image = cv2.imread(tmpl2_image_path)\n",
"\n",
"# The scene image\n",
"scene_image = cv2.imread(scene_image_path)\n",
"\n",
"# Define a resolution scale (influence speed)\n",
Expand All @@ -269,13 +269,14 @@
"tmpl2_lines = detect_lines(tmpl2_image)*scale\n",
"scene_lines = detect_lines(scene_image)*scale\n",
"\n",
"# Define a template for multiple scales\n",
"# Define a template for multiple scales, use only if you need to be scale invariant\n",
"# as it increase the search space and decrease speed\n",
"templates1 = [tmpl1_lines * scale for scale in np.linspace(0.1, 0.8, 25)]\n",
"templates2 = [tmpl2_lines * scale for scale in np.linspace(0.3, 1, 20)]\n",
"all_templates = templates1 + templates2\n",
"\n",
"# Perform template matching using OpenFDCM\n",
"max_tmpl_lines, max_scene_lines = 3, 10 # Combinatory search parameters.\n",
"max_tmpl_lines, max_scene_lines = 3, 10 # Combinatory search parameters, the greater deetctions the better but slower.\n",
"depth = 30 # The [0, pi] discretization.\n",
"scene_padding = 1.0 # A ratio to pad the scene images used in the FDCM algorithm, use if best match may appear on image boundaries.\n",
"coeff = 5.0 # A weighting factor to enhance the angular cost vs distance cost in FDCM algorithm.\n",
Expand Down

0 comments on commit d7915c2

Please sign in to comment.