bellingcat/ShadowFinder

GitHub: bellingcat/ShadowFinder

基于阴影分析的地理定位工具,通过物体高度、阴影长度和时间参数计算太阳高度角,在世界地图上可视化可能的拍摄地点分布。

Stars: 519 | Forks: 45

# ShadowFinder Bellingcat logo: Discover BellingcatDiscord logo: Join our communityColab icon: Try it on Colab 一款轻量级工具和 Google Colab notebook,用于估算地球上可能出现特定长度阴影的地点,以用于地理定位。 利用物体的高度、其阴影的长度、日期和时间,ShadowFinder 可以估算出该阴影可能出现的地点。这些可能的地点在地球地图上显示为明亮的条带: ![ExampleShadowFinderOutput](https://static.pigsec.cn/wp-content/uploads/repos/2026/03/e6c06f013b131822.png) ## 使用方法 - Google Colab Notebook 🚀 无需安装,直接使用[这里的 Google Colab notebook](https://colab.research.google.com/github/Bellingcat/ShadowFinder/blob/main/ShadowFinderColab.ipynb) 即可体验! ## 安装 :magic_wand: [![PyPI - Version](https://img.shields.io/pypi/v/ShadowFinder)](https://pypi.org/project/ShadowFinder/) ShadowFinder 以交互式 notebook 为核心构建,可下载并在本地 Jupyter 环境中使用,该包还提供了 Python API 和命令行界面。 ShadowFinder 已发布在 [PyPi](https://pypi.org/project/ShadowFinder/) 上,因此可以通过 `pip` 安装: ``` pip install shadowfinder ``` ## 使用方法 - Python 库 🐍 如果您想直接通过 Python 使用 ShadowFinder,用法如下。 ``` from shadowfinder import ShadowFinder finder = ShadowFinder() # 使用预生成的 timezone grid 以节省时间 # 尝试加载 timezone grid,若失败则生成 grid 并保存到文件 try: finder.load_timezone_grid() except FileNotFoundError: finder.generate_timezone_grid() finder.save_timezone_grid() # timezone_grid.json # 设置场景 # 提供 object_height 和 shadow_length 或 sun_altitude_angle finder.set_details( date_time=date_time, # datetime object with no timezone awareness object_height=object_height, # object height in arbitrary units shadow_length=shadow_length, # shadow length in arbitrary units time_format=time_type, # string, either 'local' or 'utc' sun_altitude_angle=sun_altitude_angle, # altitude angle of the sun, in degrees above the horizon ) # 运行 finder finder.find_shadows() # 访问生成的 figure fig = finder.plot_shadows() ``` ## 使用方法 - 命令行界面 🐌 ``` shadowfinder find 10 5 2024-02-29 13:59:59 --time_format=utc ``` 其中参数分别为 `OBJECT_HEIGHT`(物体高度)、`SHADOW_LENGTH`(阴影长度)、`DATE`(日期)和 `TIME`(时间)。 您也可以直接使用太阳角度(地平线以上,以度为单位): ``` shadowfinder find_sun 50 2024-02-29 13:59:59 --time_format=utc ``` 其中参数分别为 `SUN_ALTITUDE_ANGLE`(太阳高度角)、`DATE`(日期)和 `TIME`(时间)。 运行以下命令可获取更完整的帮助信息: ``` shadowfinder find --help shadowfinder find_sun --help ``` ## 开发 :octocat:
展开查看开发者信息 本节介绍如何安装项目以从源代码运行,例如,如果您想构建新功能。 ``` # 克隆 repository git clone https://github.com/bellingcat/ShadowFinder.git # 将目录更改为项目文件夹 cd ShadowFinder ``` 本项目使用 [Poetry](https://python-poetry.org/docs) 进行依赖管理和打包。 ``` # 如果尚未安装,请安装 poetry pip install poetry # 安装 dependencies poetry install # 设置 pre-commit hooks poetry run pre-commit install # 运行该 tool poetry run shadowfinder --help # 针对当前的 Python interpreter 运行测试 poetry run pytest # 或者,针对所有 shadowfinder 支持的 Python 版本运行 pytest poetry run tox p # p=run in parallel ```
标签:Bellingcat, ESC4, Geo-location, Google Colab, Mutation, NoSQL, OSINT, Python, 代码示例, 位置追踪, 可视化, 图像取证, 地理定位, 太阳高度角, 影子分析, 情报分析, 数据分析, 无后门, 照片验证, 网络诊断, 调查工具, 逆向工具, 阴影计算