c++ - 如何计算图像的分辨率?

标签 c++ visual-c++ opencv

如何使用 OpenCV 确定图像(Mat 格式)的分辨率(宽 x 高)?

我有一个线程接收很 multimap 像..一次一个。我想确定图像的分辨率,当线程接收到它时(以获得以像素为单位的宽度和高度尺寸)。

最佳答案

像这样:

cv::Mat someMat;
int width;
int height;

width = someMat.cols;
height = someMat.rows;

或:

width = someMat.size().width;
height = someMat.size().height;

关于c++ - 如何计算图像的分辨率?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21859164/

相关文章:

python - 输出数组 img 的布局与 cv::Mat 不兼容(step[ndims-1] != elemsize 或 step[1] != elemsize*nchannels)

c++ - 为什么系统托盘图标会清除之前显示的图标?

visual-c++ - Visual C++ 中的 128 位除法内在函数

c++ directshow filter 私有(private)接口(interface)

opencv - 打开 CV 编解码器 FFMPEG 错误后备以使用标记 0x7634706d/'mp4v'

android - 字段/常量 CV_FILLED 属于哪个 OpenCV4Android 类?

c++ - STL-Sort 未按预期工作

c++ - 如何根据物体位置和速度、玩家位置和前向 vector 计算左耳和右耳的音量? (3D 声音)

c++ - 重载运算符的模板 : error: overloaded 'operator*' must have at least one parameter of class or enumeration type

c++ - 为什么 CLS() 在 C++11 中有不同的含义