简体   繁体   English

C# (OpenCV) 中的等效 Java Mat.put()

[英]Equivalent Java Mat.put() in C# (OpenCV)

I have been facing this line of code in a book(JAVA) many times.我已经多次面对一本书(JAVA)中的这行代码。 It seems like it sets matrix with hardcoded values.似乎它设置了带有硬编码值的矩阵。

Mat src = new Mat(4, 1, CvType.CV_32FC2); 
src.put(0, 0,
    0, 0, 
    img.width() - 1, 0, 
    0, img.height() - 1, 
    img.width() - 1, img.height() - 1 
); 

And couldn't find what is equivalent to .put method in C#.并且在 C# 中找不到与.put方法等效的内容。 I have latest 4 version.我有最新的 4 版本。

put method inserts data at starting position specified by row and column . put方法在由rowcolumn指定的开始 position 处插入数据。

public int put(int row, int col, int[] data)

Equivalent in OpenCVSharp is OpenCVSharp 中的等价物是

Mat src = new Mat(4, 1, MatType.CV_32FC2, 
    new [] 
    {
        0, 0, 
        img.Width - 1, 0, 
        0, img.Height - 1, 
        img.Width - 1, img.Height - 1 
    });

Documentation 文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM