{"id":19539483,"url":"https://github.com/shahar603/spacextract","last_synced_at":"2025-04-13T11:07:14.740Z","repository":{"id":20992867,"uuid":"88042297","full_name":"shahar603/SpaceXtract","owner":"shahar603","description":"Extraction and analysis of telemetry from rocket launch webcasts (from SpaceX and RocketLab)","archived":false,"fork":false,"pushed_at":"2024-08-30T23:59:02.000Z","size":42938,"stargazers_count":178,"open_issues_count":2,"forks_count":28,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-13T11:07:03.277Z","etag":null,"topics":["analysis","ffmpeg","ocr","opencv","rocketlab","space","spacex","telemetry","webcast"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shahar603.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-12T11:02:13.000Z","updated_at":"2025-02-05T14:18:25.000Z","dependencies_parsed_at":"2024-12-21T08:20:07.393Z","dependency_job_id":null,"html_url":"https://github.com/shahar603/SpaceXtract","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahar603%2FSpaceXtract","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahar603%2FSpaceXtract/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahar603%2FSpaceXtract/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shahar603%2FSpaceXtract/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shahar603","download_url":"https://codeload.github.com/shahar603/SpaceXtract/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248703199,"owners_count":21148118,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analysis","ffmpeg","ocr","opencv","rocketlab","space","spacex","telemetry","webcast"],"created_at":"2024-11-11T02:40:01.712Z","updated_at":"2025-04-13T11:07:14.683Z","avatar_url":"https://github.com/shahar603.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SpaceXtract\n\n![SpaceXtract gif](https://github.com/shahar603/SpaceXtract/blob/master/docs/SpaceXtract.gif)\n\n\nExtraction and analysis of telemetry from launch provders' webcasts (like SpaceX and RocketLab).\nThis module is built for Python 3. You'll need [OpenCV](http://opencv.org/), [NumPy](http://www.numpy.org/), [Streamlink](https://streamlink.github.io/) and [FFMpeg](https://ffmpeg.org/). Video sources are local files or HLS compliant streams.\n\n \n\n\nInstalling the required modules\n==========================\n\n\n\nAll the required modules can be installed using pip in the following manner:\n\n```\npip install -r requirements.txt\n```\n\nOr manualy by installing the individul modules:\n\n```\npip install numpy\npip install opencv-python\npip install streamlink\npip install matplotlib\n```\n\nYou will need [FFMpeg](https://ffmpeg.org/) to be installed and to be in ```PATH```\n\n\nUsage\n=========\n\nTo capture telemetry from SpaceX's webcasts clone this repository and run ```python get_telemetry_spacex.py``` with the webcast (video file).\n\n\nHere's the output of the ```--help``` option:\n\n```\nusage: get_telemetry_spacex.py [-h] [-c CAPTURE_PATH] [-d DESTINATION_PATH]\n                               [-T LAUNCH_TIME] [-o] [-f]\n\nExtract telemetry for SpaceX's launch videos.\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -c CAPTURE_PATH, --capture CAPTURE_PATH\n                        Path (url or local) of the desired video\n  -d DESTINATION_PATH, --destination DESTINATION_PATH\n                        Path to the file that will contain the output\n  -T LAUNCH_TIME, --time LAUNCH_TIME\n                        Time from launch of the video to the time of the\n                        launch (in seconds). If not given and not live, the\n                        capture is set to the launch. If live, the capture\n                        starts from the beginning of the stream\n  -o                    If given results will be printed to stdout\n  -f                    Force override of output file\n```\n\n\n\n\nExtraction of telemetry from other sources\n==============\n\n```get_telemetry_spacex.py``` uses the [SpaceXtract](https://github.com/shahar603/SpaceXtract/tree/master/src/SpaceXtract) package.\n\n[SpaceXtract](https://github.com/shahar603/SpaceXtract/tree/master/src/SpaceXtract) is a package that performes fast OCR by searching and parsing only the data the user needs.\nTo do that it uses JSON configuration files (their format is specified [below]()).\n\n[SpaceXtract](https://github.com/shahar603/SpaceXtract/tree/master/src/SpaceXtract) uses the general_extract.py script to perform OCR.\n\ngeneral_extract.py contains two classes, ```BaseExtract``` and ```RelativeExtract```.\n\n\n```RelativeExtract``` is a subclass of ```BaseExtract```, the main difference between the two is that BaseExtract performes\nOCR on a fixed region of interest on screen. In contrast, RelativeExtract tracks the region of interest even when it moves and changes.\n\n\n\n\nConfiguration files\n------------------\n\nThe configuration file is a JSON file which contains a dictionary (keys - string, value - a list of size 4) that tell BaseExtract and it's subclasses where to perform\nOCR, what characters to search, how clear are the characters and how many characters to expect to find.\n\nThe format of the file is the following:\n\n```javascript\n{\n    \"field_1\": [\n        [top, bottom, left, right],\n        \n        [\"path_to_template_1.png\", \"path_to_template_2.png\", ...],\n        \n        threshold,\n        \n        [expected_length_1, expected_length_2, ...]\n    ],\n    \n    \"field_2\" : [\n        ...\n    ],\n    \n    ...\n    \n}\n```\n\n\n* \"field_1\" - The name of the field to search.\n\n* [top, bottom, left, right] - A list that specify the area to perform OCR. top, bottom, left and right\nare in ratio to screen size.\n\nFor example: The list [0.1, 0.9, 0.4, 0.6] on a 1920x1080 image captures a rectangle with dimentions:\n\n(Rectangle_Width, Rectangle_Height) = (Screen_Width * (right - left), Screen_Height * (bottom - top)) = (1920*(0.6-0.4), 1080*(0.9-0.1)) = (384, 864)\n\nThe location of the rectangle is specific to the Extractor class used and is specified [below]().\n\n\n* [\"path_to_template_1.png\", \"path_to_template_2.png\", ...] - A list of pathes to templates (images) to look for in the image.\nThe images can be colored, but they are converted to grayscale and only prominent features in the image (like edges) are used to detect characters.\n\n\n* threshold - Minimum confidence required to detect a character.\n\n\n* [expected_length_1, expected_length_2, ...] - A list of optional lengths of the output. \n\n\n\n\nRectangle Location\n-----------------\n\n\n## BaseExtractor\n\nThe (top, left) corner of the rectangle is the same as the (top, left) value specified in the configuration file.\n\n## RelativeExtractor\n\nRelativeExtractor uses an *anchor*. A template whos location is used as a reference for the other fields.\n\nIf the anchor top left corner is (anchor_top, anchor_left), then the (top, left) corner of the rectangle RelativeExtract performes OCR in is (anchor_top+top, anchor_left+left).\n\n\nThe anchor is specified in the configuration file as follows:\n\n```javascript\n    \"anchor\": [\n        null,\n        [\n            \"path_to_the_anchor.png\"\n        ],\n        threshold,\n        []\n    ] \n```\n\n\n\nUsage\n-----------\n\nTo use BaseExtract and RelativeExtract first import general_extract.py\n\n```python\nimport general_extract\n```\n\nThen create a BaseExtract instance.\n\n```python\nsession = general_extract.BaseExtract(configuration_file_content)\n```\n\nFor a given OpenCV ```frame```, extract ```'my_field'``` using ```extract_number```:\n\n```python\nmy_field = session.extract_number(frame, 'my_field')\n```\n\n```'my_field'``` is a number that contains the indecies of the templates as defined in ```configuration_file_content['my_field'][1]``` (Path to template list).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshahar603%2Fspacextract","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshahar603%2Fspacextract","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshahar603%2Fspacextract/lists"}