{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "c6ee539a-a8d2-44dd-9f1e-730ca87edbd7",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CALIB_USE_QR\n",
      "DECOMP_QR\n",
      "HISTCMP_CHISQR\n",
      "HISTCMP_CHISQR_ALT\n",
      "NORM_L2SQR\n",
      "PROJ_SPHERICAL_EQRECT\n",
      "QRCODE_ENCODER_CORRECT_LEVEL_H\n",
      "QRCODE_ENCODER_CORRECT_LEVEL_L\n",
      "QRCODE_ENCODER_CORRECT_LEVEL_M\n",
      "QRCODE_ENCODER_CORRECT_LEVEL_Q\n",
      "QRCODE_ENCODER_ECI_UTF8\n",
      "QRCODE_ENCODER_MODE_ALPHANUMERIC\n",
      "QRCODE_ENCODER_MODE_AUTO\n",
      "QRCODE_ENCODER_MODE_BYTE\n",
      "QRCODE_ENCODER_MODE_ECI\n",
      "QRCODE_ENCODER_MODE_KANJI\n",
      "QRCODE_ENCODER_MODE_NUMERIC\n",
      "QRCODE_ENCODER_MODE_STRUCTURED_APPEND\n",
      "QRCodeDetector\n",
      "QRCodeEncoder\n",
      "QRCodeEncoder_CORRECT_LEVEL_H\n",
      "QRCodeEncoder_CORRECT_LEVEL_L\n",
      "QRCodeEncoder_CORRECT_LEVEL_M\n",
      "QRCodeEncoder_CORRECT_LEVEL_Q\n",
      "QRCodeEncoder_ECI_UTF8\n",
      "QRCodeEncoder_MODE_ALPHANUMERIC\n",
      "QRCodeEncoder_MODE_AUTO\n",
      "QRCodeEncoder_MODE_BYTE\n",
      "QRCodeEncoder_MODE_ECI\n",
      "QRCodeEncoder_MODE_KANJI\n",
      "QRCodeEncoder_MODE_NUMERIC\n",
      "QRCodeEncoder_MODE_STRUCTURED_APPEND\n",
      "QRCodeEncoder_Params\n",
      "QRCodeEncoder_create\n",
      "sqrBoxFilter\n",
      "sqrt\n"
     ]
    },
    {
     "data": {
      "image/png": "[encoded data, 281908 characters]",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import cv2\n",
    "from matplotlib import pyplot as plt\n",
    "\n",
    "\n",
    "def resize_image_max_edge(image, max_edge=1024):\n",
    "    # Calculate the scaling factor\n",
    "    scale_factor = max_edge / max(image.shape[:2])\n",
    "\n",
    "    # Resize the image\n",
    "    resized_image = cv2.resize(image, (int(image.shape[1] * scale_factor), int(image.shape[0] * scale_factor)))\n",
    "\n",
    "    return resized_image\n",
    "    \n",
    "f = 'dataset/camera/simple.jpg'\n",
    "img = cv2.imread(f)\n",
    "resized = resize_image_max_edge(img)\n",
    "plt.imshow(resized)\n",
    "for x in dir(cv2):\n",
    "    if \"qr\" in x.lower():\n",
    "        print(x)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
