Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.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
Android 由于点来自直线,无法确定角度_Android_Opencv_Point - Fatal编程技术网

Android 由于点来自直线,无法确定角度

Android 由于点来自直线,无法确定角度,android,opencv,point,Android,Opencv,Point,我有一个图像,我从中创建了一些线条。我已经保存了线的起点和终点。线条基本上是矩形的长边,它包围着图像中的一个白色斑点。矩形被放置在一个圆圈中。如下图所示 问题是当矩形在圆的下部形成时,起点可以被认为是圆的最低点,即靠近圆的边缘,但是,当矩形如图中最后一个刻度盘所示在圆的上部形成时,很难确定要选择哪个点作为起点来确定靠近刻度盘中心的起点 在如何交换圆的上部区域中的直线点方面,是否有任何解决方法。请引导我,因为我现在对这件事已经没有想法了 下面是选择矩形最长边并打印其点的代码 int maxInde

我有一个图像,我从中创建了一些线条。我已经保存了线的起点和终点。线条基本上是矩形的长边,它包围着图像中的一个白色斑点。矩形被放置在一个圆圈中。如下图所示

问题是当矩形在圆的下部形成时,起点可以被认为是圆的最低点,即靠近圆的边缘,但是,当矩形如图中最后一个刻度盘所示在圆的上部形成时,很难确定要选择哪个点作为起点来确定靠近刻度盘中心的起点

在如何交换圆的上部区域中的直线点方面,是否有任何解决方法。请引导我,因为我现在对这件事已经没有想法了

下面是选择矩形最长边并打印其点的代码

int maxIndex = 0;
for (int a = 1; a < length.length; a++){
    double newnumber = length[a];
    if ((newnumber > length[maxIndex])){
        maxIndex = a;
    }
} 
System.out.println("Start= "+pts[maxIndex].toString()+" End= "+pts[(maxIndex+1)%4].toString()+", Length="+length[maxIndex]);
intmaxindex=0;
for(int a=1;alength[maxIndex])){
maxIndex=a;
}
} 
System.out.println(“Start=“+pts[maxIndex].toString()+”End=“+pts[(maxIndex+1)%4].toString()+”,Length=“+Length[maxIndex]);

请注意,

这可能是一个bludge,但首先想到的是求角的Y值之和,但不要除以4(不是必需的)。当矩形水平时,如果它们高于阈值4*sum,则您知道它是“向上”

在IF语句中使用此选项切换向上和向下情况的代码

int totalY = 0;

for(int i = 0; i < 4; i++){
    totalY += vectorOfYourPoints[i].y;
}

if(totalY > someThresholdYoullSet){
    //do the thing you need to do if it's UP
} else {
    //do the thing you need to do if it's DOWN
}
inttotaly=0;
对于(int i=0;i<4;i++){
Total y+=点的向量[i].y;
}
如果(Total>someThresholdYoullSet){
//做你需要做的事情,如果它是向上的
}否则{
//如果天气不好,做你需要做的事情
}

也许这是一个bludge,但首先想到的是求角点的Y值之和,但不要除以4(不是必需的)。当矩形水平时,如果它们高于阈值4*sum,则您知道它是“向上”

在IF语句中使用此选项切换向上和向下情况的代码

int totalY = 0;

for(int i = 0; i < 4; i++){
    totalY += vectorOfYourPoints[i].y;
}

if(totalY > someThresholdYoullSet){
    //do the thing you need to do if it's UP
} else {
    //do the thing you need to do if it's DOWN
}
inttotaly=0;
对于(int i=0;i<4;i++){
Total y+=点的向量[i].y;
}
如果(Total>someThresholdYoullSet){
//做你需要做的事情,如果它是向上的
}否则{
//如果天气不好,做你需要做的事情
}

RotatedRect
有一个
角度
@Miki我在-ve值中获取角度。我想要360度的格式。我发现其中一个答案是180度。尝试扩展360
RotatedRect
的答案有一个
angle
@Miki我得到了-ve值中的角度。我想要360度的格式。我发现其中一个答案是180度。试图将答案扩展到360