如何在Mat中访问像素? [英] How access pixel in a Mat?
本文介绍了如何在Mat中访问像素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Visual C ++和OpenCV。
我想问一下,如何访问像素OpenCV中垫子中的元素。
我的意思是,我想在二进制Mat图像中验证一个像素是1还是0 ...我该怎么做访问带有x和y(或行和coloumn)的像素?
你能帮助我吗?在此先感谢。
Hi,
I'm using Visual C++ and OpenCV.
I want to ask, how can I access to a pixel element in a Mat in OpenCV.
I mean, I want to verify in a binary Mat image if a pixel it's 1 or 0...how can I do to access to a pixel with x and y (or rows and coloumn)?
Can you help me? Thanks in advance.
推荐答案
Quote:
int pixel = MatImage.at< uchar>(行,列);
//像素将给出该特定行和图像中存在的图像的像素值。专栏。
// MatImage是Mat类型。
int pixel = MatImage.at<uchar>(Row,Column) ;
//pixel will give pixel value of image present at that particular Row & Column.
//MatImage is "Mat" Type.
这篇关于如何在Mat中访问像素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文