计算机视觉基础computerVersion

本文介绍了计算机视觉的基础知识,包括相机参数模型,并深入探讨了传统计算机视觉方法,如模型拟合与转换中的RANSAC算法及多视图几何中的稀疏与密集重建。通过Python代码示例详细讲解RANSAC算法的应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1 introducion

从事计算机视觉,不得不补充一下计算机视觉的基础知识
some traditonal and machine learning methods about computer version.

2 基础知识

2.1 相机参数

相机参数模型
在这里插入图片描述
https://www.cnblogs.com/majiale/p/9293499.html

3 traditional methods

3.1 model fitting and transform

3.1.1 RANSAC

import numpy as np
import math
import matplotlib.pyplot as plt
import random

def fit_line_by_ransac(x,y,sigma,iters=10000,p=0.99):
    n=len(x)
    best_a=0
    best_b=0
    pretotal=0
    for i in range(iters):
        sample_index=random.sample(range(n),2)
        x_1,y_1=x[sample_index[0]],y[sample_index[0]]
        x_2,y_2=x[sample_index[1]],y[sample_index[1]]
        a=(y_2-y_1)/(x_2-x_1)
        b=y_1-a*x_1 
        
        total_inlier=0
        for index in range(n):
            y_estmate=a*x[index]+b
            if abs(y_estmate-y[index])<sigma:
                total_inlier=total_inlier+1
        if total_inlier>pretotal:
            iters=np.log(1-p)/np.log(1-pow(total_inlier/(n),2))
            pretotal=total_inlier
            best_a=a
            best_b=b
        if total_inlier>n/1.5:
            print(i,total_inlier)
            break
    return best_a,best_b

if __name__=="__main__":
    n=100
    a0=1
    b0=1
    x=np.linspace(0,10,n)
    y=a0*x+b0+np.random.rand(n)*1
    random_x,random_y=[],[]
    for i in range(n):
        random_x.append(x[i]+np.random.random()*1)
        random_y.append(y[i]+np.random.random()*1)
    a,b=fit_line_by_ransac(np.array(random_x),np.array(random_y),sigma=3)
    y_=a*x+b
    plt.scatter(x,y_)
    plt.scatter(random_x,random_y)
    plt.show()

在这里插入图片描述

3.2 multiview

if you want to learn this section,slam 14 is a good work

3.2.1 sparse and dense reconstruction

在这里插入图片描述

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值