Calibrate works?
This commit is contained in:
parent
26e34f7671
commit
cc711c6343
1104 changed files with 636510 additions and 75 deletions
|
|
@ -0,0 +1,38 @@
|
|||
import gab.opencv.*;
|
||||
|
||||
OpenCV opencv;
|
||||
ArrayList<Line> lines;
|
||||
|
||||
void setup() {
|
||||
PImage src = loadImage("film_scan.jpg");
|
||||
src.resize(0, 800);
|
||||
size(src.width, src.height);
|
||||
|
||||
opencv = new OpenCV(this, src);
|
||||
opencv.findCannyEdges(20, 75);
|
||||
|
||||
// Find lines with Hough line detection
|
||||
// Arguments are: threshold, minLengthLength, maxLineGap
|
||||
lines = opencv.findLines(100, 30, 20);
|
||||
}
|
||||
|
||||
void draw() {
|
||||
image(opencv.getOutput(), 0, 0);
|
||||
strokeWeight(3);
|
||||
|
||||
for (Line line : lines) {
|
||||
// lines include angle in radians, measured in double precision
|
||||
// so we can select out vertical and horizontal lines
|
||||
// They also include "start" and "end" PVectors with the position
|
||||
if (line.angle >= radians(0) && line.angle < radians(1)) {
|
||||
stroke(0, 255, 0);
|
||||
line(line.start.x, line.start.y, line.end.x, line.end.y);
|
||||
}
|
||||
|
||||
if (line.angle > radians(89) && line.angle < radians(91)) {
|
||||
stroke(255, 0, 0);
|
||||
line(line.start.x, line.start.y, line.end.x, line.end.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BIN
lib/opencv_processing/examples/HoughLineDetection/film_scan.jpg
Normal file
BIN
lib/opencv_processing/examples/HoughLineDetection/film_scan.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 MiB |
Loading…
Add table
Add a link
Reference in a new issue