{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"A imagem selecionada por enquanto foi a melhor e não a pior opção, pois neste caso os eixos em contraste com o fundo favoreceu sua identificação expressiva. Além disso as linhas horizontais de grade neste exemplo em particular acabaram não interfirindo na identificação do eixo X","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-03-23T03:29:56.261598Z","iopub.execute_input":"2023-03-23T03:29:56.263132Z","iopub.status.idle":"2023-03-23T03:29:56.655052Z","shell.execute_reply.started":"2023-03-23T03:29:56.263034Z","shell.execute_reply":"2023-03-23T03:29:56.653597Z"}}},{"cell_type":"code","source":"import cv2\nimport numpy as np\nimport matplotlib.pyplot as plt","metadata":{"execution":{"iopub.status.busy":"2023-03-23T03:39:36.437788Z","iopub.execute_input":"2023-03-23T03:39:36.438313Z","iopub.status.idle":"2023-03-23T03:39:36.445433Z","shell.execute_reply.started":"2023-03-23T03:39:36.438272Z","shell.execute_reply":"2023-03-23T03:39:36.443813Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"imagem_local = '/kaggle/input/benetech-making-graphs-accessible/train/images/00ca4c339bef.jpg'\n\nimagem = cv2.imread(imagem_local)\nimagem_rgb = cv2.cvtColor(imagem, cv2.COLOR_BGR2RGB)\n\nplt.imshow(imagem_rgb)\nplt.axis('off')  # Remove os eixos do gráfico\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-03-23T03:39:36.877295Z","iopub.execute_input":"2023-03-23T03:39:36.877743Z","iopub.status.idle":"2023-03-23T03:39:37.081716Z","shell.execute_reply.started":"2023-03-23T03:39:36.877706Z","shell.execute_reply":"2023-03-23T03:39:37.078770Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"imagem_cinza = cv2.cvtColor(imagem, cv2.COLOR_BGR2GRAY)\n\nintensidade_media = imagem_cinza.mean()\n    \n_, imagem_binaria = cv2.threshold(imagem_cinza, 0, 255, cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU)\n\naltura, largura = imagem_binaria.shape\nsoma_pixels_brancos = np.zeros(largura)\nsoma_pixels_pretos = np.zeros(largura)\n\nfor j in range(largura):\n    soma_pixels_brancos[j] = np.sum(imagem_binaria[:, j] == 255)\n    soma_pixels_pretos[j] = np.sum(imagem_binaria[:, j] == 0)\n    \nplt.figure(figsize=(12, 6))\nplt.plot(range(largura), soma_pixels_pretos, label='Pixels Pretos', color='red')\nplt.xlabel(\"Posição na Direção X\")\nplt.ylabel(\"Quantidade de Pixels\")\nplt.title(\"Variação da Quantidade de Pixels Brancos e Pretos na Direção X\")\nplt.legend()\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-03-23T03:39:37.628335Z","iopub.execute_input":"2023-03-23T03:39:37.628824Z","iopub.status.idle":"2023-03-23T03:39:37.940600Z","shell.execute_reply.started":"2023-03-23T03:39:37.628782Z","shell.execute_reply":"2023-03-23T03:39:37.939114Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"soma_pixels_brancos = np.zeros(altura)\nsoma_pixels_pretos = np.zeros(altura)\n\nfor j in range(altura):\n    soma_pixels_brancos[j] = np.sum(imagem_binaria[j, :] == 255)\n    soma_pixels_pretos[j] = np.sum(imagem_binaria[j, :] == 0)\n    \nplt.figure(figsize=(12, 6))\nplt.plot(range(altura), soma_pixels_pretos, label='Pixels Pretos', color='red')\nplt.xlabel(\"Posição na Direção X\")\nplt.ylabel(\"Quantidade de Pixels\")\nplt.title(\"Variação da Quantidade de Pixels Brancos e Pretos na Direção Y\")\nplt.legend()\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-03-23T03:39:38.052355Z","iopub.execute_input":"2023-03-23T03:39:38.053490Z","iopub.status.idle":"2023-03-23T03:39:38.354905Z","shell.execute_reply.started":"2023-03-23T03:39:38.053424Z","shell.execute_reply":"2023-03-23T03:39:38.353473Z"},"trusted":true},"execution_count":null,"outputs":[]}]}