【发布时间】:2016-04-27 00:14:25
【问题描述】:
我根据我在这篇文章中提出的问题的建议下载了用于处理的 OpenCV 库:How do I install the openCV library for the Arduino IDE?
但是,除了“LiveCamTest”示例之外,我无法运行任何示例程序。在诸如此类的任何其他示例中:
import gab.opencv.*;
PImage src, dst;
OpenCV opencv;
ArrayList<Contour> contours;
ArrayList<Contour> polygons;
void setup() {
src = loadImage("test.jpg");
size(src.width, src.height/2);
opencv = new OpenCV(this, src);
opencv.gray();
opencv.threshold(70);
dst = opencv.getOutput();
contours = opencv.findContours();
println("found " + contours.size() + " contours");
}
void draw() {
scale(0.5);
image(src, 0, 0);
image(dst, src.width, 0);
noFill();
strokeWeight(3);
for (Contour contour : contours) {
stroke(0, 255, 0);
contour.draw();
stroke(255, 0, 0);
beginShape();
for (PVector point : contour.getPolygonApproximation().getPoints()) {
vertex(point.x, point.y);
}
endShape();
}
}
我收到错误消息:无法从您的代码中确定此草图的大小。 谁能告诉我如何让这些例子发挥作用?谢谢。
【问题讨论】:
标签: opencv processing