{"id":13734303,"url":"https://github.com/rhammell/planet-movement","last_synced_at":"2025-05-08T10:31:31.077Z","repository":{"id":148434671,"uuid":"105724455","full_name":"rhammell/planet-movement","owner":"rhammell","description":"Find and process Planet image pairs to highlight object movement","archived":false,"fork":false,"pushed_at":"2020-08-16T00:35:58.000Z","size":3584,"stargazers_count":19,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-08-04T03:03:35.132Z","etag":null,"topics":["change-detection","image-processing","planet-imagery","remote-sensing","satellite-imagery"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rhammell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-10-04T02:24:46.000Z","updated_at":"2024-07-19T04:13:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"fcfd4f9e-a3b5-4574-8967-343064bfe617","html_url":"https://github.com/rhammell/planet-movement","commit_stats":{"total_commits":31,"total_committers":2,"mean_commits":15.5,"dds":0.09677419354838712,"last_synced_commit":"444a8dcf6150fd529cd884c5bb653d4c8b68322f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhammell%2Fplanet-movement","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhammell%2Fplanet-movement/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhammell%2Fplanet-movement/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhammell%2Fplanet-movement/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rhammell","download_url":"https://codeload.github.com/rhammell/planet-movement/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224720919,"owners_count":17358483,"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":["change-detection","image-processing","planet-imagery","remote-sensing","satellite-imagery"],"created_at":"2024-08-03T03:00:54.437Z","updated_at":"2024-11-15T02:32:33.662Z","avatar_url":"https://github.com/rhammell.png","language":"Python","funding_links":[],"categories":["`Python` processing of optical imagery (non deep learning)","Python"],"sub_categories":["Processing imagery - post processing"],"readme":"# planet-movement\nThe `movement.py` Python module enables the searching and processing of [Planet](https://www.planet.com/) imagery to highlight object movement between valid image pairs. Included are functions for filtering Planet API search results to identify image pairs, and for processing images into visual outputs.\n\n## Methodology\nChange detection algorithms are commonly used in remote sensing imagery analysis to help identify the differences between two images collected over the same geographic area at different times. \n\nPlanet's constellation of small satellites is able to image the earth every day, making daily change detection possible for most of the globe. This collection strategy also provides an unique opportunity for change detection on a much shorter time scale. \n\nImage frames collected during each satellite flight scan contain a small amount of geographic overlap with the previous frame in the scan. Frames are collected less than two seconds apart, so a comparison of these overlapping regions makes rapid change detection possible. \n\nAn example of this overlap between Time 1 and Time 2 images is shown below. \n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"img/overlap.png\" width=\"100%\"\u003e\n\u003c/p\u003e\n\nOn this short time scale, any differences observed in this overlap are largely due to the physical displacement of moving objects on the groud. The `movement.py` module can be used to search and process the overlapping regions of these image pairs to highlight this change.\n\n## Setup\n```bash\n# Clone this repository\ngit clone https://github.com/rhammell/planet-movement.git\n\n# Go into the repository\ncd planet-movement\n\n# Install required modules\npip install -r requirements.txt\n```\n\n## Image Pairs\nImages are determined to be a valid pair if they have:\n1. Equal `satellite_id` values\n2. Equal `strip_id` values\n3. Difference in `acquired` values less than 2\n4. Overlapping image geometry\n\nThe `find_pairs()` function filters Planet API search results to return a list of image pairs. Each pair is contained in a two element tuple, where each image is represented as a Planet API image reference. \n\n```python\n# Python 3\nfrom planet import api\nimport movement\n\n# Planet API client\nclient = api.ClientV1()\n\n# Point of interest\npoi = {\n  \"type\": \"Point\",\n  \"coordinates\": [-122.38640785217285, 37.61647504351534]\n}\n\n# Geometry filter\nquery = api.filters.and_filter(\n  api.filters.geom_filter(poi)\n)\n\n# Build search request\nitem_types = ['PSScene3Band']\nrequest = api.filters.build_search_request(query, item_types)\n\n# Perform quick search\nresults = client.quick_search(request)\n\n# Find image pairs within search results\npairs = movement.find_pairs(results)\nprint('Pairs found: ', len(pairs))\nfor pair in pairs:\n    print(pair[0]['id'], pair[1]['id'])\n```\n\nResults from this filtering can be downloaded using standard Planet API methods. \n\n```python\nfrom planet.api import downloader\n\n# Planet API Downloader\ndl = downloader.create(client)\n\n# Download first pair\ndl.download(iter(pairs[0]), [\"visual\"], r\"C:/destination/folder\")\n```\n\n## Processing\nThe `process_pairs()` function creates new visual outputs from an input image pair. \n\n```python\nmovement.process_pair(r\"C:/path/to/image1.tif\", r\"C:/path/to/image2.tif\")\n```\nThe overlapping region of the pair is cropped out from each image and combined into a GIF animation (.gif) and a Color Multi-view (CMV) (.tif). \n\n### GIF Outputs\nThe GIF animation flickers between both images every half second and allows for easy visual comparison between the two images. Examples are shown below. \n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"img/gif_output_1.gif\" width=\"400px\"\u003e\n  \u003cimg src=\"img/gif_output_2.gif\" width=\"400px\"\u003e\n  \u003cimg src=\"img/gif_output_3.gif\" width=\"400px\"\u003e\n  \u003cimg src=\"img/gif_output_4.gif\" width=\"400px\"\u003e\n\u003c/p\u003e\n\n### CMV Outputs\nThe CMV is a three band image, where the band 1 contains the first input image, converted to a single-band luminance image, and bands 2 \u0026 3 contain the sencond image, converted to a single-band luminance image. Areas of change between the input images show as either red or blue, while unchanged areas remain grayscale. \n\nSpatial reference data is retained in the .tif image, which allows for distance measurements to be made. By measuring the displacement of objects in the scene, and the time between the two images, it becomes possible to calculate the speed of objects movement on the ground. \n\nExamples are shown below.\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"img/cmv_output_1.png\" width=\"400px\"\u003e\n  \u003cimg src=\"img/cmv_output_2.png\" width=\"400px\"\u003e\n  \u003cimg src=\"img/cmv_output_3.png\" width=\"400px\"\u003e\n  \u003cimg src=\"img/cmv_output_4.png\" width=\"400px\"\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhammell%2Fplanet-movement","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frhammell%2Fplanet-movement","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhammell%2Fplanet-movement/lists"}