Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/265.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 运动检测&x27;如果'';句子_C#_Grammar - Fatal编程技术网

C# 运动检测&x27;如果'';句子

C# 运动检测&x27;如果'';句子,c#,grammar,C#,Grammar,我一直在写这个运动检测程序,遇到了一个关于“如果句子”的问题,代码如下: for (int i = 0; i < frameSize; i++, backFrame++, currFrame++) { // difference diff = ((int)*currFrame) - ((int)*backFrame); // threshold

我一直在写这个运动检测程序,遇到了一个关于“如果句子”的问题,代码如下:

       for (int i = 0; i < frameSize; i++, backFrame++, currFrame++)
            {
                // difference
                diff = ((int)*currFrame) - ((int)*backFrame);
               // threshold
                if ((diff >= differenceThreshold) || (diff <= differenceThresholdNeg))
                {
                    *currFrame = (byte)255;
                    if (i < 640)
                    {
                        x[i] = i;
                        y[i] = 0;
                    }
                    else
                    {
                        x[i] = i % 640;
                        y[i] = i / 640;
                    }
                    if (xMax < x[i]) xMax = x[i];
                    if (xMin > x[i]) xMin = x[i];
                    if (yMax < y[i]) yMax = y[i];
                    if (yMin > y[i]) yMin = y[i];
                    xC = ((xMax - xMin) / 2) + xMin;
                    yC = ((yMax - yMin) / 2) + yMin; 
                }
                else
                {
                    *currFrame = (byte)0;
                }
             }
for(int i=0;i=differenceThreshold)| |(diff x[i])xMin=x[i];
如果(yMaxy[i])yMin=y[i];
xC=((xMax-xMin)/2)+xMin;
yC=((yMax-yMin)/2)+yMin;
}
其他的
{
*currFrame=(字节)0;
}
}
问题是它跳过“if”之后的代码,并执行“else”,即使条件

(((diff >= differenceThreshold) || (diff <= differenceThresholdNeg))) is true.

((diff>=differenceThreshold)| |(diff为什么不简单地如果(diff>=differenceThreshold | | diff如何确定该条件是否为真?您是否有调试输出或断点?您可以尝试将differenceThreshold和differenceThresholdNeg设置为0,然后该条件始终为真,并且if块中的代码应该执行。谢谢,伙计!这里没有语法错误?我做了我一步一步地调试,所以我知道这一点,但也许我错了。