<jupyter_start><jupyter_text>Generate the camera calibration pattern with Python<NAME>, 2021 Verify that ``requests`` is installed.<jupyter_code>!pip install requests
import requests
# Save gen_pattern and svgfig as file to colab working directory
# If you are using GitHub, make sure you get the "Raw" version of the code
url = 'https://raw.githubusercontent.com/opencv/opencv/master/doc/pattern_tools/gen_pattern.py'
url2 = 'https://raw.githubusercontent.com/opencv/opencv/master/doc/pattern_tools/svgfig.py'

r = requests.get(url)
r2 = requests.get(url2)

# make sure your filename is the same as how you want to import 
with open('gen_pattern.py', 'w') as f:
  f.write(r.text)

with open('svgfig.py', 'w') as f:
  f.write(r2.text)<jupyter_output><empty_output><jupyter_text>Run ``gen_pattern.py`` with the page size, number of circles, type of pattern, etc.<jupyter_code>!head -n20 gen_pattern.py
!python gen_pattern.py -o out.svg -r 21 -c 7 -T acircles -s 10 -R 2.5 -u mm -w 216 -h 279
from IPython.display import SVG
SVG('out.svg')
# Download it 
# Only works on Chrome, else download from the menu
try:
  from google.colab import files
  files.download('out.svg')
except:
  print('Download manually from the menu.')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11581469648562301, 'fraction_numerical': 0.018370607028753993, 'mean_word_length': 4.855140186915888, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '13311', 'license': 'MIT', 'n_tokens_mistral': 452, 'n_tokens_neox': 430, 'n_words': 137, 'path': 'notebooks/Calibration_pattern_generation.ipynb', 'repo_name': 'opi-lab/tools', 'size': '1263'}