我在 Android 4.0.3 上使用 JavaCV 它运行出错
OpenCV Error: Assertion failed (ssize.area() > 0) in unknown function, file C:\slave\WinInstallerMegaPack\src\opencv\modules\imgproc\src\imgwarp.cpp, line 1432
寻找特征...
Exception in thread "main" java.lang.RuntimeException: C:\slave\WinInstallerMegaPack\src\opencv\modules\imgproc\src\imgwarp.cpp:1432: error: (-215) ssize.area() > 0
在com.googlecode.javacv.cpp.opencv_stitching$Stitcher.stitch(Native Method)
在Lesson3_Stitch.main(Lesson3_Stitch.java:17)
任何人都可以教我如何解决它?谢谢你。
这是我的代码:
public static void main(String[] args) {
Stitcher stitcher = Stitcher.createDefault(true);
MatVector images = new MatVector(2);
images.put(0, cvLoadImage("sample1.png"));
images.put(1, cvLoadImage("sample2.png"));
IplImage result = new IplImage();
int status = stitcher.stitch(images, images);
if (status != Stitcher.OK) {
cvSaveImage("result.png", result);
System.out.println("cant stitch image" + status);
}
result = cvLoadImage("sample1.png");
final CanvasFrame canvas = new CanvasFrame("My Image", 1);
// Request closing of the application when the image window is closed.
canvas.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
// Show image on window.
// canvas.showImage(result);
}
private static void cvSaveImage(String string, IplImage result) {
// TODO Auto-generated method stub
}
private static IplImage cvLoadImage(String string) {
// TODO Auto-generated method stub
return null;
}