OpenCVSharp 4.5 单应性矩阵 - 透视校正

本文详细介绍了如何使用OpenCVSharp 4.5实现官方教程中的透视校正功能,包括查找棋盘角点、计算仿射变换和应用到图片上,展示了关键步骤和代码实例。

用 OpenCVSharp 4.5 跑一遍 OpenCV 官方教程。

原OpenCV官方教程链接:挂啦(2021-7-19)

using System;
using OpenCvSharp;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class tutorial54 : ITutorial
    {


        enum Pattern { CHESSBOARD, CIRCLES_GRID, ASYMMETRIC_CIRCLES_GRID };

        RNG rng = new RNG();

        private Scalar randomColor(RNG rng)
        {
            int icolor = (int)rng;
            return new Scalar(icolor & 255, (icolor >> 8) & 255, (icolor >> 16) & 255);
        }

        private Point2d[] ConvertToPoint2d(Point2f[] input)
        {
            Point2d[] output = new Point2d[input.Length];
            for (int i = 0; i < input.Length; i++)
            {
                output[i] = new Point2d(input[i].X, input[i].Y);
            }
            return output;
        }
        private void perspectiveCorrection(string img1Path, string img2Path, Size patternSize, RN
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值