本文整理了Java中org.opencv.core.KeyPoint
类的一些代码示例,展示了KeyPoint
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。KeyPoint
类的具体详情如下:
包路径:org.opencv.core.KeyPoint
类名称:KeyPoint
暂无
代码示例来源:origin: openpnp/openpnp
private static KeyPoint convertToKeyPoint(Object keyPointHolder) throws Exception {
if (keyPointHolder instanceof Result.Circle) {
Result.Circle circle = (Result.Circle) keyPointHolder;
return new KeyPoint((float) circle.x, (float) circle.y, (float) circle.diameter);
}
else if (keyPointHolder instanceof Point) {
Point point = (Point) keyPointHolder;
return new KeyPoint((float) point.x, (float) point.y, 0);
}
else if (keyPointHolder instanceof RotatedRect) {
RotatedRect rotatedRect = (RotatedRect) keyPointHolder;
return new KeyPoint((float) rotatedRect.center.x, (float) rotatedRect.center.y, 0,
(float) rotatedRect.angle);
}
else if (keyPointHolder instanceof TemplateMatch) {
TemplateMatch templateMatch = (TemplateMatch) keyPointHolder;
float width = (float) templateMatch.width;
float height = (float) templateMatch.height;
float x = (float) templateMatch.x + (width / 2);
float y = (float) templateMatch.y + (height / 2);
float score = (float) templateMatch.score;
return new KeyPoint(x, y, width + height, score);
}
else {
throw new Exception("Don't know how to convert " + keyPointHolder + "to KeyPoint.");
}
}
}
代码示例来源:origin: kongqw/OpenCVForAndroid
public KeyPoint[] toArray() {
int num = (int) total();
KeyPoint[] a = new KeyPoint[num];
if(num == 0)
return a;
float buff[] = new float[num * _channels];
get(0, 0, buff); //TODO: check ret val!
for(int i=0; i<num; i++)
a[i] = new KeyPoint( buff[_channels*i+0], buff[_channels*i+1], buff[_channels*i+2], buff[_channels*i+3],
buff[_channels*i+4], (int) buff[_channels*i+5], (int) buff[_channels*i+6] );
return a;
}
代码示例来源:origin: leadrien/opencv_native_androidstudio
public KeyPoint[] toArray() {
int num = (int) total();
KeyPoint[] a = new KeyPoint[num];
if(num == 0)
return a;
float buff[] = new float[num * _channels];
get(0, 0, buff); //TODO: check ret val!
for(int i=0; i<num; i++)
a[i] = new KeyPoint( buff[_channels*i+0], buff[_channels*i+1], buff[_channels*i+2], buff[_channels*i+3],
buff[_channels*i+4], (int) buff[_channels*i+5], (int) buff[_channels*i+6] );
return a;
}
代码示例来源:origin: farkam135/GoIV
public KeyPoint[] toArray() {
int num = (int) total();
KeyPoint[] a = new KeyPoint[num];
if(num == 0)
return a;
float buff[] = new float[num * _channels];
get(0, 0, buff); //TODO: check ret val!
for(int i=0; i<num; i++)
a[i] = new KeyPoint( buff[_channels*i+0], buff[_channels*i+1], buff[_channels*i+2], buff[_channels*i+3],
buff[_channels*i+4], (int) buff[_channels*i+5], (int) buff[_channels*i+6] );
return a;
}
代码示例来源:origin: imistyrain/EasyPR4Android
public KeyPoint[] toArray() {
int num = (int) total();
KeyPoint[] a = new KeyPoint[num];
if(num == 0)
return a;
float buff[] = new float[num * _channels];
get(0, 0, buff); //TODO: check ret val!
for(int i=0; i<num; i++)
a[i] = new KeyPoint( buff[_channels*i+0], buff[_channels*i+1], buff[_channels*i+2], buff[_channels*i+3],
buff[_channels*i+4], (int) buff[_channels*i+5], (int) buff[_channels*i+6] );
return a;
}
代码示例来源:origin: tz28/Chinese-number-gestures-recognition
public KeyPoint[] toArray() {
int num = (int) total();
KeyPoint[] a = new KeyPoint[num];
if(num == 0)
return a;
float buff[] = new float[num * _channels];
get(0, 0, buff); //TODO: check ret val!
for(int i=0; i<num; i++)
a[i] = new KeyPoint( buff[_channels*i+0], buff[_channels*i+1], buff[_channels*i+2], buff[_channels*i+3],
buff[_channels*i+4], (int) buff[_channels*i+5], (int) buff[_channels*i+6] );
return a;
}
代码示例来源:origin: InnoFang/Android-Code-Demos
public KeyPoint[] toArray() {
int num = (int) total();
KeyPoint[] a = new KeyPoint[num];
if(num == 0)
return a;
float buff[] = new float[num * _channels];
get(0, 0, buff); //TODO: check ret val!
for(int i=0; i<num; i++)
a[i] = new KeyPoint( buff[_channels*i+0], buff[_channels*i+1], buff[_channels*i+2], buff[_channels*i+3],
buff[_channels*i+4], (int) buff[_channels*i+5], (int) buff[_channels*i+6] );
return a;
}
代码示例来源:origin: SOFTPOWER1991/OpenCVCheck
public KeyPoint[] toArray() {
int num = (int) total();
KeyPoint[] a = new KeyPoint[num];
if(num == 0)
return a;
float buff[] = new float[num * _channels];
get(0, 0, buff); //TODO: check ret val!
for(int i=0; i<num; i++)
a[i] = new KeyPoint( buff[_channels*i+0], buff[_channels*i+1], buff[_channels*i+2], buff[_channels*i+3],
buff[_channels*i+4], (int) buff[_channels*i+5], (int) buff[_channels*i+6] );
return a;
}
代码示例来源:origin: SouvDc/face-detection
public KeyPoint[] toArray() {
int num = (int) total();
KeyPoint[] a = new KeyPoint[num];
if(num == 0)
return a;
float buff[] = new float[num * _channels];
get(0, 0, buff); //TODO: check ret val!
for(int i=0; i<num; i++)
a[i] = new KeyPoint( buff[_channels*i+0], buff[_channels*i+1], buff[_channels*i+2], buff[_channels*i+3],
buff[_channels*i+4], (int) buff[_channels*i+5], (int) buff[_channels*i+6] );
return a;
}
代码示例来源:origin: hschott/Camdroid
public KeyPoint[] toArray() {
int num = (int) total();
KeyPoint[] a = new KeyPoint[num];
if(num == 0)
return a;
float buff[] = new float[num * _channels];
get(0, 0, buff); //TODO: check ret val!
for(int i=0; i<num; i++)
a[i] = new KeyPoint( buff[_channels*i+0], buff[_channels*i+1], buff[_channels*i+2], buff[_channels*i+3],
buff[_channels*i+4], (int) buff[_channels*i+5], (int) buff[_channels*i+6] );
return a;
}
代码示例来源:origin: DuckDeck/AndroidDemo
public KeyPoint[] toArray() {
int num = (int) total();
KeyPoint[] a = new KeyPoint[num];
if(num == 0)
return a;
float buff[] = new float[num * _channels];
get(0, 0, buff); //TODO: check ret val!
for(int i=0; i<num; i++)
a[i] = new KeyPoint( buff[_channels*i+0], buff[_channels*i+1], buff[_channels*i+2], buff[_channels*i+3],
buff[_channels*i+4], (int) buff[_channels*i+5], (int) buff[_channels*i+6] );
return a;
}
代码示例来源:origin: nroduit/Weasis
public KeyPoint[] toArray() {
int num = (int) total();
KeyPoint[] a = new KeyPoint[num];
if(num == 0)
return a;
float buff[] = new float[num * _channels];
get(0, 0, buff); //TODO: check ret val!
for(int i=0; i<num; i++)
a[i] = new KeyPoint( buff[_channels*i+0], buff[_channels*i+1], buff[_channels*i+2], buff[_channels*i+3],
buff[_channels*i+4], (int) buff[_channels*i+5], (int) buff[_channels*i+6] );
return a;
}
代码示例来源:origin: ctodobom/OpenCV-3.1.0-Android
public KeyPoint[] toArray() {
int num = (int) total();
KeyPoint[] a = new KeyPoint[num];
if(num == 0)
return a;
float buff[] = new float[num * _channels];
get(0, 0, buff); //TODO: check ret val!
for(int i=0; i<num; i++)
a[i] = new KeyPoint( buff[_channels*i+0], buff[_channels*i+1], buff[_channels*i+2], buff[_channels*i+3],
buff[_channels*i+4], (int) buff[_channels*i+5], (int) buff[_channels*i+6] );
return a;
}
代码示例来源:origin: akshika47/OpencvAndroid
public KeyPoint[] toArray() {
int num = (int) total();
KeyPoint[] a = new KeyPoint[num];
if(num == 0)
return a;
float buff[] = new float[num * _channels];
get(0, 0, buff); //TODO: check ret val!
for(int i=0; i<num; i++)
a[i] = new KeyPoint( buff[_channels*i+0], buff[_channels*i+1], buff[_channels*i+2], buff[_channels*i+3],
buff[_channels*i+4], (int) buff[_channels*i+5], (int) buff[_channels*i+6] );
return a;
}
代码示例来源:origin: raulh82vlc/Image-Detection-Samples
public KeyPoint[] toArray() {
int num = (int) total();
KeyPoint[] a = new KeyPoint[num];
if(num == 0)
return a;
float buff[] = new float[num * _channels];
get(0, 0, buff); //TODO: check ret val!
for(int i=0; i<num; i++)
a[i] = new KeyPoint( buff[_channels*i+0], buff[_channels*i+1], buff[_channels*i+2], buff[_channels*i+3],
buff[_channels*i+4], (int) buff[_channels*i+5], (int) buff[_channels*i+6] );
return a;
}
代码示例来源:origin: akshika47/OpencvAndroid
public static void Mat_to_vector_KeyPoint(Mat m, List<KeyPoint> kps) {
if (kps == null)
throw new java.lang.IllegalArgumentException("Output List can't be null");
int count = m.rows();
if (CvType.CV_64FC(7) != m.type() || m.cols() != 1)
throw new java.lang.IllegalArgumentException(
"CvType.CV_64FC(7) != m.type() || m.cols()!=1\n" + m);
kps.clear();
double[] buff = new double[7 * count];
m.get(0, 0, buff);
for (int i = 0; i < count; i++) {
kps.add(new KeyPoint((float) buff[7 * i], (float) buff[7 * i + 1], (float) buff[7 * i + 2], (float) buff[7 * i + 3],
(float) buff[7 * i + 4], (int) buff[7 * i + 5], (int) buff[7 * i + 6]));
}
}
代码示例来源:origin: raulh82vlc/Image-Detection-Samples
public static void Mat_to_vector_KeyPoint(Mat m, List<KeyPoint> kps) {
if (kps == null)
throw new java.lang.IllegalArgumentException("Output List can't be null");
int count = m.rows();
if (CvType.CV_64FC(7) != m.type() || m.cols() != 1)
throw new java.lang.IllegalArgumentException(
"CvType.CV_64FC(7) != m.type() || m.cols()!=1\n" + m);
kps.clear();
double[] buff = new double[7 * count];
m.get(0, 0, buff);
for (int i = 0; i < count; i++) {
kps.add(new KeyPoint((float) buff[7 * i], (float) buff[7 * i + 1], (float) buff[7 * i + 2], (float) buff[7 * i + 3],
(float) buff[7 * i + 4], (int) buff[7 * i + 5], (int) buff[7 * i + 6]));
}
}
代码示例来源:origin: kongqw/OpenCVForAndroid
public static void Mat_to_vector_KeyPoint(Mat m, List<KeyPoint> kps) {
if (kps == null)
throw new java.lang.IllegalArgumentException("Output List can't be null");
int count = m.rows();
if (CvType.CV_64FC(7) != m.type() || m.cols() != 1)
throw new java.lang.IllegalArgumentException(
"CvType.CV_64FC(7) != m.type() || m.cols()!=1\n" + m);
kps.clear();
double[] buff = new double[7 * count];
m.get(0, 0, buff);
for (int i = 0; i < count; i++) {
kps.add(new KeyPoint((float) buff[7 * i], (float) buff[7 * i + 1], (float) buff[7 * i + 2], (float) buff[7 * i + 3],
(float) buff[7 * i + 4], (int) buff[7 * i + 5], (int) buff[7 * i + 6]));
}
}
代码示例来源:origin: DuckDeck/AndroidDemo
public static void Mat_to_vector_KeyPoint(Mat m, List<KeyPoint> kps) {
if (kps == null)
throw new java.lang.IllegalArgumentException("Output List can't be null");
int count = m.rows();
if (CvType.CV_64FC(7) != m.type() || m.cols() != 1)
throw new java.lang.IllegalArgumentException(
"CvType.CV_64FC(7) != m.type() || m.cols()!=1\n" + m);
kps.clear();
double[] buff = new double[7 * count];
m.get(0, 0, buff);
for (int i = 0; i < count; i++) {
kps.add(new KeyPoint((float) buff[7 * i], (float) buff[7 * i + 1], (float) buff[7 * i + 2], (float) buff[7 * i + 3],
(float) buff[7 * i + 4], (int) buff[7 * i + 5], (int) buff[7 * i + 6]));
}
}
代码示例来源:origin: farkam135/GoIV
public static void Mat_to_vector_KeyPoint(Mat m, List<KeyPoint> kps) {
if (kps == null)
throw new java.lang.IllegalArgumentException("Output List can't be null");
int count = m.rows();
if (CvType.CV_64FC(7) != m.type() || m.cols() != 1)
throw new java.lang.IllegalArgumentException(
"CvType.CV_64FC(7) != m.type() || m.cols()!=1\n" + m);
kps.clear();
double[] buff = new double[7 * count];
m.get(0, 0, buff);
for (int i = 0; i < count; i++) {
kps.add(new KeyPoint((float) buff[7 * i], (float) buff[7 * i + 1], (float) buff[7 * i + 2], (float) buff[7 * i + 3],
(float) buff[7 * i + 4], (int) buff[7 * i + 5], (int) buff[7 * i + 6]));
}
}
内容来源于网络,如有侵权,请联系作者删除!