{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "2a03baec-a078-45db-ae0b-a3fd1416f185",
   "metadata": {},
   "source": [
    "### [Notebook anlatimi](https://www.edureka.co/blog/wp-content/uploads/2018/10/Jupyter_Notebook_CheatSheet_Edureka.pdf)\n",
    "\n",
    "### [Markdown anlatimi](https://www.markdownguide.org/cheat-sheet)\n",
    "\n",
    "### [Overleaf LaTeX KTU](https://overleaf.ktu.edu.tr/)\n",
    "### [Overleaf LaTeX](https://www.overleaf.com/project)\n",
    "\n",
    "\\begin{align}\n",
    "    f(x) &= \\frac{a_0}{2} + \\sum_{n=1}^{\\infty} \\left( a_n \\cos\\left(\\frac{n\\pi x}{L}\\right) + b_n \\sin\\left(\\frac{n\\pi x}{L}\\right) \\right) \\\\\n",
    "    \\text{where } a_n &= \\frac{1}{L} \\int_{-L}^{L} f(x) \\cos\\left(\\frac{n\\pi x}{L}\\right) \\, \\mathrm{d}x, \\quad \n",
    "    b_n = \\frac{1}{L} \\int_{-L}^{L} f(x) \\sin\\left(\\frac{n\\pi x}{L}\\right) \\, \\mathrm{d}x \\nonumber\n",
    "\\end{align}"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2a373f8f-8c79-464b-8772-2249ff6f79df",
   "metadata": {},
   "source": [
    "\\begin{align}\n",
    "    f(x) &= \\frac{a_0}{2} + \\sum_{n=1}^{\\infty} \\left( a_n \\cos\\left(\\frac{n\\pi x}{L}\\right) + b_n \\sin\\left(\\frac{n\\pi x}{L}\\right) \\right) \\\\\n",
    "    \\text{where } a_n &= \\frac{1}{L} \\int_{-L}^{L} f(x) \\cos\\left(\\frac{n\\pi x}{L}\\right) \\, \\mathrm{d}x, \\quad \n",
    "    b_n = \\frac{1}{L} \\int_{-L}^{L} f(x) \\sin\\left(\\frac{n\\pi x}{L}\\right) \\, \\mathrm{d}x \\nonumber\n",
    "\\end{align}"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "83f12de4-d8e1-47c7-a6d8-b2aa594b2458",
   "metadata": {},
   "source": [
    "# H1\n",
    "## H2\n",
    "### H3"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4712279f-074b-453f-91f8-eba9107d572a",
   "metadata": {},
   "source": [
    "print(\"merhaba\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "33d80fe0-8c64-425b-a1aa-d9193e12ad51",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "merhaba\n"
     ]
    }
   ],
   "source": [
    "print(\"merhaba\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "9d80257f-769a-45cc-bbc9-3718281fd485",
   "metadata": {},
   "outputs": [],
   "source": [
    "import cv2\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "a1afe8a5-9fe5-427d-b5ab-c541dfc26d76",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# numpy.zeros(shape, dtype=None, order='C', *, device=None, like=None)\n",
    "# Create a 300x300 image with 3 vertical stripes: Blue, Green, Red\n",
    "canvas = np.zeros((300, 300, 3), dtype=np.uint8)\n",
    "canvas[:, :100] = [255, 0, 0]    # Blue strip\n",
    "canvas[:, 100:200] = [0, 255, 0]  # Green strip\n",
    "canvas[:, 200:] = [0, 0, 255]    # Red strip\n",
    "cv2.imwrite(\"test_stripes.png\", canvas)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "f6555ccc-080c-4f8b-bae3-10271079501a",
   "metadata": {},
   "outputs": [],
   "source": [
    "Blue = [255, 0, 0]\n",
    "Green =  [0, 255, 0]\n",
    "Red = [0, 0, 255]\n",
    "\n",
    "def SeritCiz(olcu):\n",
    "    cerceve = np.zeros((olcu,olcu,3), dtype=np.uint8)\n",
    "    cerceve[:, :round(olcu/3)] = Blue\n",
    "    cerceve[:, round(2*olcu/3) : olcu] = Green\n",
    "    cerceve[:, round(olcu/3) : round(2*olcu/3)] = Red\n",
    "    cv2.imwrite(\"test_bant.png\", cerceve)\n",
    "\n",
    "def SeritCiz4(olcu):\n",
    "    cerceve = np.zeros((olcu,olcu,3), dtype=np.uint8)\n",
    "    cerceve[:, 0 :round(olcu/4)] = Blue\n",
    "    cerceve[:, round(1*olcu/4) : round(2*olcu/4)] = Green\n",
    "    cerceve[:, round(2*olcu/4) : round(3*olcu/4)] = Red\n",
    "    cerceve[:, round(3*olcu/4) : round(olcu)] = Blue\n",
    "    cv2.imwrite(\"test_bant.png\", cerceve)\n",
    "\n",
    "SeritCiz4(505)\n",
    "SeritCiz(505)\n",
    "def Quiz(olcu, boyut=3):\n",
    "    if boyut == 3:\n",
    "        SeritCiz(olcu)\n",
    "    elif boyut  == 4:\n",
    "        SeritCiz4(olcu)\n",
    "\n",
    "Quiz(500, 4)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0611e1fc-b3cc-4f6c-9e84-dd09d8283020",
   "metadata": {},
   "source": [
    "### Yapilacak\n",
    "olcu ve boyut parametrelerinden boyut parametresi sadece 3 ve 4 icin calisir durumdaydi.\n",
    "olcu parametresi full fonksiyoneldi."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "id": "20b7c97c-0508-4340-883f-d00338d8396c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Blue :  0 : 0\n",
      "Blue :  168 : 224\n",
      "Blue :  336 : 448\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "Blue  = [255, 0, 0]\n",
    "Green =  [0, 255, 0]\n",
    "Red   = [0, 0, 255]\n",
    "\n",
    "\n",
    "\n",
    "def SeritCiz(olcu, boyut):\n",
    "    cerceve = np.zeros((olcu,olcu,3), dtype=np.uint8)\n",
    "    for ind in range(math.ceil(boyut/3.0)):\n",
    "        genislik = int(ind*round(olcu/boyut)*3)\n",
    "        cerceve[:, genislik+0 : genislik+round(olcu/boyut)] = Blue\n",
    "        print(\"Blue : \", genislik+0, \":\", genislik+ind*round(olcu/boyut))\n",
    "        cerceve[:, genislik+round(1*olcu/boyut) : genislik+round(2*olcu/boyut)] = Green\n",
    "        cerceve[:, genislik+round(2*olcu/boyut) : genislik+round(3*olcu/boyut)] = Red\n",
    "    cv2.imwrite(\"test_bant.png\", cerceve)\n",
    "\n",
    "SeritCiz(500, 9)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ead0cd6f-a0aa-4683-8688-868ea6df1cb2",
   "metadata": {},
   "source": [
    "- https://docs.python.org/3.6/library/functions.html?highlight=round\n",
    "- https://docs.python.org"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "c72d7c41-c351-473e-8d7e-d1c589593783",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import math\n",
    "math.ceil(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "68b04086-e1df-44a1-88b5-d15bd47db2d0",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "1\n",
      "2\n",
      "3\n",
      "4\n",
      "5\n",
      "6\n",
      "7\n",
      "8\n",
      "9\n",
      "10\n",
      "11\n",
      "12\n",
      "13\n",
      "14\n",
      "15\n",
      "16\n",
      "17\n",
      "18\n",
      "19\n",
      "20\n",
      "21\n",
      "22\n",
      "23\n",
      "24\n",
      "25\n",
      "26\n",
      "27\n",
      "28\n",
      "29\n",
      "30\n",
      "31\n",
      "32\n",
      "33\n"
     ]
    }
   ],
   "source": [
    "boyut = 100\n",
    "import math\n",
    "for ind in range(math.ceil(boyut/3.0)):\n",
    "    print(ind)"
   ]
  }
 ],
 "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.13.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
