导航:首页 > 机械设备 > opencv机械手标定

opencv机械手标定

发布时间:2021-02-27 13:24:54

① 用opencv的程序做摄像机标定,需要输入什么参数

需要输入标定板得大小信息,也就是你的方格的大小,还有就是标定板得长和宽,还有就是标定的图片的数量。int n_board=9;
int n_board_1=9;
int sn_board=0;
int sn_board_1=0;
int board_w=9;
int board_h=6;
int board_n=board_w*board_h;

② 之前您的那个opencv标定代码是怎么改的

整个项目的结构图:

编写DetectFaceDemo.java,代码如下:

[java] view
plainprint?

package com.njupt.zhb.test;

import org.opencv.core.Core;

import org.opencv.core.Mat;

import org.opencv.core.MatOfRect;

import org.opencv.core.Point;

import org.opencv.core.Rect;

import org.opencv.core.Scalar;

import org.opencv.highgui.Highgui;

import org.opencv.objdetect.CascadeClassifier;

//

// Detects faces in an image, draws boxes around them, and writes the results

// to "faceDetection.png".

//

public class DetectFaceDemo {

public void run() {

System.out.println("\nRunning DetectFaceDemo");

System.out.println(getClass().getResource("lbpcascade_frontalface.xml").getPath());

// Create a face detector from the cascade file in the resources

// directory.

//CascadeClassifier faceDetector = new CascadeClassifier(getClass().getResource("lbpcascade_frontalface.xml").getPath());

//Mat image = Highgui.imread(getClass().getResource("lena.png").getPath());

//注意:源程序的路径会多打印一个‘/’,因此总是出现如下错误

/*

* Detected 0 faces Writing faceDetection.png libpng warning: Image

* width is zero in IHDR libpng warning: Image height is zero in IHDR

* libpng error: Invalid IHDR data

*/

//因此,我们将第一个字符去掉

String xmlfilePath=getClass().getResource("lbpcascade_frontalface.xml").getPath().substring(1);

CascadeClassifier faceDetector = new CascadeClassifier(xmlfilePath);

Mat image = Highgui.imread(getClass().getResource("we.jpg").getPath().substring(1));

// Detect faces in the image.

// MatOfRect is a special container class for Rect.

MatOfRect faceDetections = new MatOfRect();

faceDetector.detectMultiScale(image, faceDetections);

System.out.println(String.format("Detected %s faces", faceDetections.toArray().length));

// Draw a bounding box around each face.

for (Rect rect : faceDetections.toArray()) {

Core.rectangle(image, new Point(rect.x, rect.y), new Point(rect.x + rect.width, rect.y + rect.height), new Scalar(0, 255, 0));

}

// Save the visualized detection.

String filename = "faceDetection.png";

System.out.println(String.format("Writing %s", filename));

Highgui.imwrite(filename, image);

}

}
package com.njupt.zhb.test;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.MatOfRect;
import org.opencv.core.Point;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.highgui.Highgui;
import org.opencv.objdetect.CascadeClassifier;

//
// Detects faces in an image, draws boxes around them, and writes the results
// to "faceDetection.png".
//
public class DetectFaceDemo {
public void run() {
System.out.println("\nRunning DetectFaceDemo");
System.out.println(getClass().getResource("lbpcascade_frontalface.xml").getPath());
// Create a face detector from the cascade file in the resources
// directory.
//CascadeClassifier faceDetector = new CascadeClassifier(getClass().getResource("lbpcascade_frontalface.xml").getPath());
//Mat image = Highgui.imread(getClass().getResource("lena.png").getPath());
//注意:源程序的路径会多打印一个‘/’,因此总是出现如下错误
/*
* Detected 0 faces Writing faceDetection.png libpng warning: Image
* width is zero in IHDR libpng warning: Image height is zero in IHDR
* libpng error: Invalid IHDR data
*/
//因此,我们将第一个字符去掉
String xmlfilePath=getClass().getResource("lbpcascade_frontalface.xml").getPath().substring(1);
CascadeClassifier faceDetector = new CascadeClassifier(xmlfilePath);
Mat image = Highgui.imread(getClass().getResource("we.jpg").getPath().substring(1));
// Detect faces in the image.
// MatOfRect is a special container class for Rect.
MatOfRect faceDetections = new MatOfRect();
faceDetector.detectMultiScale(image, faceDetections);

System.out.println(String.format("Detected %s faces", faceDetections.toArray().length));

// Draw a bounding box around each face.
for (Rect rect : faceDetections.toArray()) {
Core.rectangle(image, new Point(rect.x, rect.y), new Point(rect.x + rect.width, rect.y + rect.height), new Scalar(0, 255, 0));
}

// Save the visualized detection.
String filename = "faceDetection.png";
System.out.println(String.format("Writing %s", filename));
Highgui.imwrite(filename, image);
}
}

3.编写测试类:

[java] view
plainprint?

package com.njupt.zhb.test;

public class TestMain {

public static void main(String[] args) {

System.out.println("Hello, OpenCV");

// Load the native library.

System.loadLibrary("opencv_java246");

new DetectFaceDemo().run();

}

}

//运行结果:

//Hello, OpenCV

//

//Running DetectFaceDemo

///E:/eclipse_Jee/workspace/JavaOpenCV246/bin/com/njupt/zhb/test/lbpcascade_frontalface.xml

//Detected 8 faces

//Writing faceDetection.png
package com.njupt.zhb.test;
public class TestMain {
public static void main(String[] args) {
System.out.println("Hello, OpenCV");
// Load the native library.
System.loadLibrary("opencv_java246");
new DetectFaceDemo().run();
}
}
//运行结果:
//Hello, OpenCV
//
//Running DetectFaceDemo
///E:/eclipse_Jee/workspace/JavaOpenCV246/bin/com/njupt/zhb/test/lbpcascade_frontalface.xml
//Detected 8 faces
//Writing faceDetection.png

③ openCV摄像机标定

外参数中的R就是旋转矩阵,t就是平移向量。

④ 如何利用opencv计算图像畸变系数,并进行校正与摄像机标定

如果知道图像,不知道相机还怎么通过相机来标定畸变。

1:只给定一张图片回可以根据图像中相关特答征进行标定,简单讲就是利用: line is straight 这个原理。

2:目前最常用的方法,是通过二维标定板,通过对 reprojection error 最小化进行非线性优化,来实现对相机的标定。并非根据看似高大上的训练集来标定。

3:畸变参数只是标定法所求参数的一部分,即:两个径向畸变系数和两个切向畸变系数。消除畸变的目的是让相机尽量地逼近针孔相机模型,这样相机成像时直线才会保持其直线性。

4:一般常见的畸变校正算法都是根据这一原理来实现的。当然,还有二般的情况。

⑤ opencv中使用的标定函数是什么算法

张正友的
A Flexible New Technique for Camera
Calibration
模型专是属
A Generic Camera Model and Calibration Method for Conventional,
Wide-Angle, and Fish-Eye Lenses

⑥ opencv里的标定精度怎么样

我是来要测平面上的激源光光斑的中心位置,可以不用考虑Z坐标了。目前仅利用透视变换,标定后的绝对误差大概十几二十个微米,可是我要测的是3个微米或者4个微米的样子,感觉这没法测啊,误差都大于要测量的长度。标定好后粗略算了下,图像上相差一个像素的距离换算到实际距离也都有10来微米。。

⑦ 用opencv进行摄像头的标定时,怎么求取基线距离,焦距f,dx,dy,均已知!

stereocalib后 输出的结果中 T 中的第一个数值 即为基线距离 即Tx

⑧ 有用过opencv的师兄么,现在导师让我用opencv+机械手搞工件分拣,opencv我才刚接触,对于我要实现的功能

这个说实话我是真的不知道

⑨ opencv标定程序相关

有路径后用cvLoadImage读。
Image<uchar> view(filename);这句就是读入图片?没见过。

阅读全文

与opencv机械手标定相关的资料

热点内容
黑龙江特种设备检验研究院 浏览:210
机械化养护中心 浏览:838
上海特种设备管理 浏览:48
机械师改枪 浏览:181
机械化剪纸 浏览:757
美燃环保设备 浏览:809
济南北斗星数控设备有限公司 浏览:838
自动喷涂机械手 浏览:457
中小型农业机械加工项目建议书 浏览:251
不锈钢加工设备市转让 浏览:441
水稻生产全程机械化 浏览:110
扳手机械原理 浏览:61
凯格精密机械有限公司 浏览:61
广毅机电设备 浏览:805
重庆三阳办公设备有限公司 浏览:494
华技达自动化设备 浏览:631
东莞石碣自动化设备厂 浏览:131
机械制图陈列柜 浏览:246
郑州奥鑫游乐设备公司 浏览:733
美邦环保设备有限公司 浏览:386