Skip to content

oftx/Phos

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Phos - 基于计算光学的胶片模拟

Open In Colab

综述 General

你说的对,但是 Phos. 是基于「计算光学」概念的胶片模拟。通过计算光在底片上的行为,复现自然、柔美、立体的胶片质感。

Hello! Phos. is a film simulation app based on the idea of "Computational optical imaging“. By calculating the optical effects on the film,we could recurrent the natural, soft, and elegant tone of these classical films.

这是一个原理验证demo,图像处理部分基于opencv,交互基于streamlit平台制作,部分代码使用了AI辅助生成。

This is a demo for idea testing. The image processing part is based on OpenCV, and the interaction is built on the Streamlit platform. Some of the code was generated with the assistance of AI.

如果您发现了项目中的问题,或是有更好的想法想要分享,还请通过邮箱 lyco_p@163.com 与我联系,我将不胜感激。

If you find any issues in the project or have better ideas you would like to share, please contact me via email at lyco_p@163.com. I would be very grateful.

特性 Features

  • 胶片预设: NC200 (彩色), AS100 (黑白), FS200 (高反差黑白)
  • 视频支持: 支持 .mp4, .mov, .avi 视频文件的逐帧胶片模拟
  • GPU 加速: 支持 NVIDIA CUDA 和 Apple Metal (MPS) 加速
  • 双端交互: 提供 Web UI (Streamlit) 和 命令行 CLI

依赖 Requirements

本项目基于 Python 3.12+ 编写

本项目依赖以下库:

  • numpy
  • opencv-python-headless
  • streamlit
  • pillow
  • tqdm
  • torch
  • torchvision (用于MPS加速支持)

兼容性尚不明确,如果运行出现问题,请以 requirements.txt 为准。

使用 Usage

1. Web App

启动本地 Web 界面:

streamlit run app.py
  • 支持拖拽上传图片或视频
  • 视频处理支持实时预览和 H.264 编码下载

2. Command Line Interface (CLI)

使用命令行处理图片或视频:

# 处理图片
python cli.py -i input.jpg -f NC200

# 处理视频 (保持原分辨率)
python cli.py -i video.mp4 -f NC200 -r 0

参数说明:

  • -i: 输入文件路径
  • -f: 胶片类型 (NC200, AS100, FS200)
  • -r: 分辨率 (短边长度,0表示保持原大小)
  • -g: 颗粒风格 (默认, 柔和, 较粗, 不使用)
  • -t: 映射算法 (reinhard, filmic)

3. Google Colab

点击上方 "Open in Colab" 按钮,使用免费 GPU 资源在线处理视频。

许可证 License

本项目采用 AGPL-3.0 许可证。

This project is licensed under AGPL-3.0.

你可以:

You may:

自由使用、研究、修改源代码

Freely use, study, and modify the source code

用于个人或教育项目

Use for personal or educational projects

用于开源项目(同样遵循AGPL)

Use for open source projects (also following AGPL)

你必须:

You must:

公开任何基于本项目的修改代码

Publicly release any modified code based on this project

保留原作者版权声明

Preserve the original author's copyright notice

同样采用AGPL许可证分发衍生作品

Distribute derivative works under the same AGPL license

商业使用请联系作者获取授权。

For commercial use, please contact the author for authorization.

完整许可证条款见 LICENSE 文件。

Full license terms are available in the LICENSE file.

原作者 Author

由@LYCO6273开发

developed by @LYCO6273

https://github.com/LYCO6273/Phos

联系方式:lyco_p@163.com

contact at: lyco_p@163.com

About

基于「计算光学」概念的胶片模拟

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 69.7%
  • Jupyter Notebook 30.3%