MingZhe
V2EX  ›  问与答

请教一个图像相关的问题。如何把图像上的一条曲线拉直。

  •  
  •   MingZhe · Dec 3, 2014 · 4929 views
    This topic created in 4212 days ago, the information mentioned may be changed or developed.
    简单的说就是题上所描述的。

    就好像是要把一条彩虹拉直一样,要顾及到带上的点都跟着动。我现在已经用一个函数拟合出这条“彩虹”的轨迹,下一步就打算把这个函数变成直线,并且带动周围的点也跟着动。不知道这样的思路是不是不对,还请我大V友给点意见。

    Any suggestion!!!
    7 replies    2014-12-04 09:11:44 +08:00
    BGLL
        1
    BGLL  
       Dec 3, 2014   ❤️ 1
    操作贝塞尔曲线的各种方法
    staticor
        2
    staticor  
       Dec 3, 2014   ❤️ 1
    我想到一个数学上的方法不知道可操作与否:
    取出所有点 然后最小二乘得到回归直线再画上.

    如果是要把曲线带换成直线带的话得再对偏移量进行设置
    MingZhe
        3
    MingZhe  
    OP
       Dec 3, 2014
    @staticor 用最小二乘法拟合轨迹已经做了,但是把一条曲线变成直线有点无从下手。。。不知道有没有什么库可以解决这种问题。
    staticor
        4
    staticor  
       Dec 3, 2014
    @MingZhe Least Square 可以根据已经的 N个点 (x_i, y_i) 算出对一阶系数和常数项(截矩)估计值.

    提供个参考链接 (python) http://python.todaysummary.com/q_python_46753.html
    MingZhe
        5
    MingZhe  
    OP
       Dec 3, 2014
    @staticor 看了你给的链接,还以为自己打开的方式不对。。。哈哈,我研究研究
    staticor
        6
    staticor  
       Dec 4, 2014
    @MingZhe 具体公式我也不记得的啦 不过要算 mean(x) mean(y) mean(xy)
    可以给出你现在的数据矩阵看看格式然后明天我再想想:)
    MingZhe
        7
    MingZhe  
    OP
       Dec 4, 2014
    @staticor 非常感谢了!~
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   945 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 21:22 · PVG 05:22 · LAX 14:22 · JFK 17:22
    ♥ Do have faith in what you're doing.