使用Img.at< cv :: vec3 ???>获取无符号的短值. [英] Getting a unsigned short value using Img.at<cv::vec3???>

查看:195
本文介绍了使用Img.at< cv :: vec3 ???>获取无符号的短值.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在为我的班级之一研究高动态范围算法.而且我在使用OpenCV时遇到问题.

I'm currently working on an High Dynamic Range algorithm for one of my class. And I've a problem using OpenCV.

我有一个16位的原始图像,我正在尝试使用

I have a 16 bits raw image and I'm trying to display the value in this image using

image.at<cv::Vec3s>(y,x)[0];

但是我得到的是负值.另外,我使用CV_16UC3矩阵,所以肯定有问题.

but I'm getting negative values. Also I work with a CV_16UC3 matrix, so something must be wrong.

是否有一种获取unsigned short值的方法?

Is there a way to get an unsigned short value?

推荐答案

要从CV_16UC3图片中读取值,您应该使用Vec3w,它是3 unsigned short的向量:

To read values from a CV_16UC3 image you should use a Vec3w, which is a vector of 3 unsigned short:

typedef Vec<ushort, 3> Vec3w;


您还可以使用Mat3w(又名Mat_<Vec3w>)并访问不带.at<Vec3w>的值,但只能带括号.


You can also use a Mat3w (aka Mat_<Vec3w>) and access values without .at<Vec3w>, but only with parenthesis.

这篇关于使用Img.at&lt; cv :: vec3 ???&gt;获取无符号的短值.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆