OpenCV Code: Operations on Mat element

Posted JimmyTY

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了OpenCV Code: Operations on Mat element相关的知识,希望对你有一定的参考价值。

cv::Mat img = cv::imread("image.jpg");

Method 1:

img.at<uchar>(i, j, k)

Method 2:

img.at<Vec3b>(i, j)[0]

 

Note: definitions for Vec

typedef Vec<uchar, 2> Vec2b;
typedef Vec<uchar, 3> Vec3b;
typedef Vec<uchar, 4> Vec4b;

typedef Vec<short, 2> Vec2s;
typedef Vec<short, 3> Vec3s;
typedef Vec<short, 4> Vec4s;

typedef Vec<int, 2> Vec2i;
typedef Vec<int, 3> Vec3i;
typedef Vec<int, 4> Vec4i;

typedef Vec<float, 2> Vec2f;
typedef Vec<float, 3> Vec3f;
typedef Vec<float, 4> Vec4f;
typedef Vec<float, 6> Vec6f;

typedef Vec<double, 2> Vec2d;
typedef Vec<double, 3> Vec3d;
typedef Vec<double, 4> Vec4d;
typedef Vec<double, 6> Vec6d;

 

以上是关于OpenCV Code: Operations on Mat element的主要内容,如果未能解决你的问题,请参考以下文章

Core Operations

《计算机视觉和图像处理简介 - 中英双语版》:使用 OpenCV对图像进行几何变换及数学变换Geometric Operations

Wait Event "Disk file operations I/O"

Diagnose High-Latency I/O Operations Using SystemTap

Pytorch tensor(1.3):Reshape Operations--flatten

expression and operations添加运算符