【发布时间】:2010-02-25 06:56:43
【问题描述】:
我希望将像素处的数据与颜色进行比较,然后我想找到轮廓然后取轮廓的质心点,所以我使用这样的方法来查找 countourdata 我在这个语句中是否错了
int pos = i * w * Channels + j; //channels is 3 as rgb
// if any data exists
if (data->imageData[pos]>0)
代码是这样的
for (int i = x; i < x+h; i++) //height of frame pixels
{
for (int j = y; j < y+w; j++)//width of frame pixels
{
int pos = i * w * Channels + j; //channels is 3 as rgb
// if any data exists
if (data->imageData[pos]>0) //Taking data (here is the problem how to take)
{
xPos += j;
yPos += i;
nPix++;
}
}
}
【问题讨论】:
-
嘿,你能不能把代码作为一个“代码块”...它很难阅读,看看你想做什么
-
是的 - 重复自己的问题 stackoverflow.com/questions/2325576 并且似乎没有阅读为上一个问题提供的答案
-
我在答案 3 处发布了我的确切代码,请查看它,你重复了,因为我没有得到确切的答案仍然有疑问
-
以后不要因为你的老问题没有得到好的答案就开始新的问题。其次,如果回复以添加有关您的问题的信息,您应该编辑您的问题。