推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
livevilwt
V2EX  ›  Python

请问怎么用 Python 把图片上的两个点拉伸到固定的位置?

  •  
  •   livevilwt · Oct 17, 2015 · 4209 views
    This topic created in 3880 days ago, the information mentioned may be changed or developed.
    在论坛发了半天没人理...我想问怎么把图片中的两个紫色点固定到蓝色点所在的位置,做到点与点的重合?新人求解答
    图片在此: http://7sbqim.com1.z0.glb.clouddn.com/img_test.jpg
    7 replies    2015-10-17 19:22:16 +08:00
    Szcnorya
        1
    Szcnorya  
       Oct 17, 2015   ❤️ 1
    如果说蓝色点是 UI 层的固定点的话,那你要做的就相当于用平移,拉伸,旋转让蓝色点连线和紫色点连线重合,旋转你可以通过计算两条直线夹角,拉伸长度可以通过线段长度比计算出,最后用平移对准。大体可以用这样的思路实现。
    zerh925
        2
    zerh925  
       Oct 17, 2015 via iPhone
    可以详细描述下吗
    ccdjh
        3
    ccdjh  
       Oct 17, 2015 via Android
    直接找到蓝色位置,覆盖
    livevilwt
        4
    livevilwt  
    OP
       Oct 17, 2015
    @zerh925 左图中的两个蓝色点在图片中是固定的,紫色点则是眼睛的位置,现在我想要做的是把两个眼睛的位置(紫色点)拉长到两个蓝色点那,使得之后眼睛的位置变成之前的眼角的位置(蓝色点)。
    livevilwt
        5
    livevilwt  
    OP
       Oct 17, 2015
    @ccdjh 可否稍微具体一些?谢谢
    Giki
        6
    Giki  
       Oct 17, 2015   ❤️ 1
    好像 affine transform
    Giki
        7
    Giki  
       Oct 17, 2015
    Affine transformation and its application in image warping
    http://hamilab.com/research/cv/affinewarp.html

    看看是不是你想要的
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3250 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 14:07 · PVG 22:07 · LAX 07:07 · JFK 10:07
    ♥ Do have faith in what you're doing.