staring to integrate TextRecognizer
This commit is contained in:
@@ -78,6 +78,89 @@
|
|||||||
"print('needsUpdate:', needsUpdate)"
|
"print('needsUpdate:', needsUpdate)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "markdown",
|
||||||
|
"id": "f3f94f5a",
|
||||||
|
"metadata": {},
|
||||||
|
"source": [
|
||||||
|
"## Solve CAPTCHA"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "c2d1f298",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"baseDir = \"~/AndroidStudioProjects/TextRecognizer\"\n",
|
||||||
|
"\n",
|
||||||
|
"def detectTextInImage(captchaImage):\n",
|
||||||
|
" ! cp $captchaImage $baseDir/app/src/main/assets/captchas/captcha_image.jpeg\n",
|
||||||
|
" ! cd $baseDir;./gradlew connectedAndroidTest\n",
|
||||||
|
" textInImage = ! adb shell \"run-as org.textrecognizer cat /data/data/org.textrecognizer/files/captcha_image.txt\"\n",
|
||||||
|
" return textInImage"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "3be7e021",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import os\n",
|
||||||
|
"\n",
|
||||||
|
"def startEmulator():\n",
|
||||||
|
" os.system(\"/home/frankknoll/Android/Sdk/emulator/emulator -avd Pixel_2_API_30 -no-window &\")\n",
|
||||||
|
" \n",
|
||||||
|
"def stopEmulator():\n",
|
||||||
|
" ! adb emu kill"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "fb3755a6",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"startEmulator()"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "c113e49d",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"textByImage = {}\n",
|
||||||
|
"for i in range(1, 2):\n",
|
||||||
|
" captchaImage = \"captchaImage\" + str(i) + \".jpeg\"\n",
|
||||||
|
" textByImage[captchaImage] = detectTextInImage(\"/home/frankknoll/Dokumente/Corona/CAPTCHA/images/VAERS/\" + captchaImage)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "cdf3fbe1",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"stopEmulator()"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": null,
|
||||||
|
"id": "6ba0ad8e",
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"textByImage"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
@@ -1020,7 +1103,7 @@
|
|||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"kernelspec": {
|
"kernelspec": {
|
||||||
"display_name": "Python 3.10.4 64-bit",
|
"display_name": "Python 3 (ipykernel)",
|
||||||
"language": "python",
|
"language": "python",
|
||||||
"name": "python3"
|
"name": "python3"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user