qt - 使用opencV从RGB图像中提取一个 channel 图像

标签 qt opencv

我正在使用 QT 和 OpenCV,我有一个需要提取的正方形,但我需要使用从 RGB 到一个 channel (基本上是 RED)的转换。任何建议都将非常受欢迎,请随时建议使用哪些功能。提前致谢。

最佳答案

另一种方法是使用 extractChannel :

cv::Mat channel;
//image is already loaded
cv::extractChannel(image, channel, 2);

这将从 image 中提取第三个 channel 并将结果保存在 channel 中。也可以使用 extractImageCOImixChannels 提取特定 channel 。

关于qt - 使用opencV从RGB图像中提取一个 channel 图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9046265/

相关文章:

c++ - 将 QDate 转换为 Qstring?

qt - 如何在 QT OpenGL Widget 上使用 OpenGL 函数?

c++ - 如何在 QML 上设置值轴标签格式从毫秒到毫米 :ss?

ios - 在 iOS 中使用 imread()

python - 解析 LINEMOD 6d 姿态估计数据集

c++ - 生成唯一的多个随机数

c++ - QTableWidget 与 QTableView

python - 使用 Hough 变换、OpenCV 和 python 进行平行线检测

c++ - OpenCV 用另一个值替换特定像素值

c++ - 使用 Opencv : BlobDetector 时出现 undefined reference 错误