编程语言
首页 > 编程语言> > [原创]移动相机九点标定工具原理及实现(包涵部分源码)

[原创]移动相机九点标定工具原理及实现(包涵部分源码)

作者:互联网

1. 移动相机标定与固定相机的标定有什么差异?

2. 解决办法?

3. 详细操作步骤?

4. 适用范围

5. 源码

image.png

        private void updatePoiMatrix(Position pcbPoi,Position poi1, Position poi2,Position takePhotoPoi)
        {
            //更新对应的数组
            imagePoiList.Add(new Position() { X = (poi1.X + poi2.X) / 2, Y = (poi1.Y + poi2.Y) / 2 });
            System.Windows.Point p1=new System.Windows.Point();
            p1.X = pcbPoi.X - takePhotoPoi.X;
            p1.Y = pcbPoi.Y - takePhotoPoi.Y;

            Position newDstPoi = new Position();
            newDstPoi.X = p1.X;
            newDstPoi.Y = p1.Y;
            robotPoiList.Add(newDstPoi);
        }
        private void btnSaveCalibration_Click(object sender, EventArgs e)
        {
            try
            {
                NcHelper.GetInstance().SaveMat(imagePoiList, robotPoiList, this.matPath);
            }
            catch (Exception ex)
            {
                this.printException(ex);
            }
        }
        
        public void SaveMat(List<Position> imageList, List<Position> robotPoiList, string path)
        {
            HTuple imageXList = new HTuple(), imageYList = new HTuple();
            HTuple robotXList = new HTuple(), robotYList = new HTuple();

            for (int i = 0; i < imageList.Count; i++)
            {
                imageXList[i] = imageList[i].X;
                imageYList[i] = imageList[i].Y;
                robotXList[i] = robotPoiList[i].X;
                robotYList[i] = robotPoiList[i].Y;
            }

            HTuple hv_HomMat2D = new HTuple(), hv_SerializedItemHandle = new HTuple();
            HTuple hv_FileHandle = new HTuple();
            ////标定
            hv_HomMat2D.Dispose();
            HOperatorSet.VectorToHomMat2d(imageXList, imageYList, robotXList, robotYList, out hv_HomMat2D);

            //保存变换矩阵
            hv_SerializedItemHandle.Dispose();
            HOperatorSet.SerializeHomMat2d(hv_HomMat2D, out hv_SerializedItemHandle);
            hv_FileHandle.Dispose();
            HOperatorSet.OpenFile(path, "output_binary", out hv_FileHandle);
            HOperatorSet.FwriteSerializedItem(hv_FileHandle, hv_SerializedItemHandle);
            HOperatorSet.CloseFile(hv_FileHandle);

            imageXList.Dispose();
            imageYList.Dispose();
            robotXList.Dispose();
            robotYList.Dispose();
            hv_HomMat2D.Dispose();
            hv_SerializedItemHandle.Dispose();
            hv_FileHandle.Dispose();
        }

6. 后续计划[敬请期待],如需完整代码请微信联系

标签:HTuple,hv,标定,相机,源码,包涵,龙门架,Dispose
来源: https://www.cnblogs.com/Bonker/p/16506199.html