Stack Exchange
How to convert OpenCV 2.4 source to 3.0 In c#
Difficulty in source conversion
I have looked up the internal functions and related documentation supported by the DLL, but I have difficulty finding matching functions or data types.
[Calibration Find value]
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using OpenCvSharp;`

namespace Project_NFT
{
    class CalibrateCamera
    {
        public const string ImageCalibration = "C:\\Users\\JL\\Documents\\Visual Studio 2008\\Projects\\Project NET\\Project NFT\\Image/{0:D2}.jpg";
        public CalibrateCamera()
        {
            const int IMAGE_NUM = 3;
            const int PAT_ROW = 7;
            const int PAT_COL = 10;
            const int PAT_SIZE = PAT_ROW * PAT_COL;
            const int ALL_POINTS = IMAGE_NUM * PAT_SIZE;
            const float CHESS_SIZE = 24.0f;
            CvSize patternSize = new CvSize(PAT_COL, PAT_ROW);

            IplImage[] srcImg = new IplImage[IMAGE_NUM];
            for (int i = 0; i < IMAGE_NUM; i++)
            {
                string path = string.Format(ImageCalibration, i);
                srcImg[i] = new IplImage(path, LoadMode.Color);
            }

            CvPoint3D32f[] objects = new CvPoint3D32f[ALL_POINTS];
            for (int i = 0; i < IMAGE_NUM; i++)
            {
                for (int j = 0; j < PAT_ROW; j++)
                {
                    for (int k = 0; k < PAT_COL; k++)
                    {
                        objects[(i * PAT_SIZE) + (j * PAT_COL) + k] = new CvPoint3D32f
                        {
                            X = j * CHESS_SIZE,
                            Y = k * CHESS_SIZE,
                            Z = 0.0f
                        };
                    }
                }
            }
            CvMat objectPoints = new CvMat(ALL_POINTS, 3, MatrixType.F32C1, objects);


            int foundNum = 0;
            List<CvPoint2D32f> allCorners = new List<CvPoint2D32f>(ALL_POINTS);
            int[] pCount = new int[IMAGE_NUM];
            using (CvWindow window = new CvWindow("Calibration", WindowMode.AutoSize))
            {
                for (int i = 0; i < IMAGE_NUM; i++)
                {
                    CvPoint2D32f[] corners;
                    bool found = Cv.FindChessboardCorners(srcImg[i], patternSize, out corners);
                    Debug.Print("{0:D2}...", i);
                    if (found)
                    {
                        Debug.Print("ok");
                        foundNum++;
                    }
                    else
                    {
                        Debug.Print("fail");
                    }

                    using (IplImage srcGray = new IplImage(srcImg[i].Size, BitDepth.U8, 1))
                    {
                        Cv.CvtColor(srcImg[i], srcGray, ColorConversion.BgrToGray);
                        Cv.FindCornerSubPix(srcGray, corners, corners.Length, new CvSize(3, 3), new CvSize(-1, -1), new CvTermCriteria(20, 0.03));
                        Cv.DrawChessboardCorners(srcImg[i], patternSize, corners, found);
                        pCount[i] = corners.Length;
                        window.ShowImage(srcImg[i]);
                        Cv.WaitKey(0);
                    }
                    allCorners.AddRange(corners);
                }
                if (foundNum != IMAGE_NUM)
                {
                    Debug.Assert(false);
                }
            }
            CvMat imagePoints = new CvMat(ALL_POINTS, 1, MatrixType.F32C2, allCorners.ToArray());
            CvMat pointCounts = new CvMat(IMAGE_NUM, 1, MatrixType.S32C1, pCount);

            CvMat intrinsic, distortion, rotation, translation;
            Cv.CalibrateCamera2(objectPoints, imagePoints, pointCounts, new CvSize(640, 480), out intrinsic, out distortion, out rotation, out translation, CalibrationFlag.Default);

            CvMat subImagePoints, subObjectPoints;
            Cv.GetRows(imagePoints, out subImagePoints, 0, PAT_SIZE);
            Cv.GetRows(objectPoints, out subObjectPoints, 0, PAT_SIZE);
            Cv.FindExtrinsicCameraParams2(subObjectPoints, subImagePoints, intrinsic, distortion, out rotation, out translation);

            using (CvFileStorage fs = new CvFileStorage("camera.xml", null, FileStorageMode.Write))
            {
                fs.Write("intrinsic", intrinsic);
                fs.Write("rotation", rotation);
                fs.Write("translation", translation);
                fs.Write("distortion", distortion);
            }
            foreach (IplImage img in srcImg)
            {
                img.Dispose();
            }

            Console.WriteLine(File.ReadAllText("camera.xml"));
            Console.Read();
        }
    }
}

[Calibration Apply Value]
CvMat intrinsic, distortion, extrinsic;

CvFileNode param;

using (CvFileStorage fs = new CvFileStorage("camera.xml", null, FileStorageMode.Read))
{
param = Cv.GetFileNodeByName (fs, null, "intrinsic"); 
intrinsic = fs.Read<CvMat>(param); 
param = Cv.GetFileNodeByName (fs, null, "distortion"); 
distortion = fs.Read<CvMat>(param);


}

Cv.FindExtrinsicCameraParams2(object_points, image_points,intrinsic, distortion, 
out rotation_vector, out translation_vector);

The source is the Camera Calibration reference, which is difficult to convert

Difficulty in source conversion What seems to be the problem, I don't exactly know what you mean by converting 2.4 to 3.0. Just use one version?

The top source in reference is written in OpenCV 2.4.
The project I'm working on is currently working on OpenCV 3.0, so I'd like to convert the source code from 2.4 to work on 3.0.

You say "its difficult to convert" What is? Have you tried? What part are you actually stuck on? You can just post the code here and say convert it please (I know you didn't say that :)) there has to be a more specific issue to solve
