init-GrandPrix+dataset_v1-15kps
This commit is contained in:
83
Grand_Prix/Supervisely/GrandPrix_create_3d_15.ipynb
Normal file
83
Grand_Prix/Supervisely/GrandPrix_create_3d_15.ipynb
Normal file
@@ -0,0 +1,83 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "9b13894c",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import pandas as pd\n",
|
||||
"import numpy as np\n",
|
||||
"import cv2 \n",
|
||||
"import plotly.express as px\n",
|
||||
"import plotly.graph_objects as go\n",
|
||||
"# from utils import *\n",
|
||||
"\n",
|
||||
"def roration(x):\n",
|
||||
" x = np.deg2rad(x)\n",
|
||||
" return np.array([[np.cos(x), -np.sin(x)],\n",
|
||||
" [np.sin(x), np.cos(x)]])\n",
|
||||
"\n",
|
||||
"arrow = np.float32([[0,1,0],\n",
|
||||
" [0,-1,0]])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 178,
|
||||
"id": "39604368",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"img = cv2.imread('Grand_Prix_GPS-double.png')\n",
|
||||
"df = pd.read_csv('raw_keypoints.csv',index_col='index')\n",
|
||||
"df.loc[[1,2], ['x','y']] -=3\n",
|
||||
"df_raw = df.copy()\n",
|
||||
"center = (1164, 703)\n",
|
||||
"df[['x', 'y']]-= center\n",
|
||||
"df = df.astype('float32')\n",
|
||||
"df['z'] = 4.2*np.float32([0, 0, 0, 0, 3, 6.33, 7.33, 3.33, 2.33, 2.33, 2.33, 2.5, 2.5, 1.2,1.5])\n",
|
||||
"df[['x', 'y']] /= 8.4\n",
|
||||
"df[['x', 'y']] = df.values[:, :2]@roration(-135) # поворот x и y в плоскости земли\n",
|
||||
"# df.to_csv('GrandPrix_15kps.csv')\n",
|
||||
"\n",
|
||||
"# rvec, tvec, camMatrx, dist = fit(img.shape[:2], df_raw, df)\n",
|
||||
"# imgpts = cv.projectPoints(5*arrow, rvec, tvec, camMatrx, dist)[0][:, 0].astype(int)\n",
|
||||
"# for i, p in enumerate(imgpts):\n",
|
||||
"# cv2.circle(img, p, 3*(i+1), color=(200,25,200), thickness=-1)\n",
|
||||
"# px.imshow(img)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "82d1f0f1",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"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.9.7"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
Reference in New Issue
Block a user