Skip to content

Commit 10c79b4

Browse files
committed
working on edge filtering methods
1 parent 978ade9 commit 10c79b4

27 files changed

Lines changed: 401 additions & 61 deletions

.DS_Store

6 KB
Binary file not shown.
99.7 KB
Binary file not shown.
99.7 KB
Binary file not shown.
Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,30 @@
11
import gab.opencvpro.*;
22
import java.awt.Rectangle;
3-
import org.opencv.core.Mat;
4-
import org.opencv.core.Core;
5-
import org.opencv.core.CvType;
6-
import org.opencv.imgproc.Imgproc;
7-
import java.awt.List;
8-
import java.awt.image.BufferedImage;
9-
import java.awt.image.DataBufferInt;
10-
113

124
OpenCVPro opencv;
13-
PImage img, gray;
5+
6+
PImage img;
7+
Rectangle[] faces;
8+
149
void setup() {
1510
opencv = new OpenCVPro(this, "test.jpg");
1611
size(opencv.width, opencv.height);
1712

18-
opencv.loadCascade(OpenCVPro.CASCADE_FRONTALFACE_ALT);
19-
img = opencv.getImage();
13+
img = opencv.getInputImage();
2014

21-
gray = createImage(img.width, img.height, RGB);
22-
23-
Mat grayscale = opencv.gray(opencv.getColorBuffer());
24-
25-
opencv.toPImage(grayscale, gray);
15+
opencv.loadCascade(OpenCVPro.CASCADE_FRONTALFACE_ALT);
16+
faces = opencv.detect();
2617

18+
noFill();
19+
stroke(0, 255, 0);
20+
strokeWeight(3);
2721
}
2822

2923
void draw() {
30-
scale(0.5, 0.5);
3124
image(img, 0, 0);
32-
image(gray, img.width, 0);
25+
26+
for (int i = 0; i < faces.length; i++) {
27+
rect(faces[i].x, faces[i].y, faces[i].width, faces[i].height);
28+
}
3329
}
3430

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import gab.opencvpro.*;
2+
import java.awt.Rectangle;
3+
import org.opencv.core.Mat;
4+
import org.opencv.core.CvType;
5+
6+
import org.opencv.imgproc.Imgproc;
7+
8+
OpenCVPro cannyFilter, sobelFilter;
9+
10+
PImage src, canny, sobel;
11+
12+
void setup() {
13+
src = loadImage("test.jpg");
14+
cannyFilter = new OpenCVPro(this, src);
15+
sobelFilter = new OpenCVPro(this, src);
16+
17+
size(cannyFilter.width, cannyFilter.height);
18+
19+
20+
//sobel = createImage(src.width, src.height, RGB);
21+
//sobel = sobelFilter.findSobelEdges(2,2);
22+
sobel = sobelFilter.findScharrX();
23+
canny = cannyFilter.findCannyEdges(20, 75);
24+
25+
// Mat src = sobelFilter.getColorBuffer();
26+
// Mat dst = new Mat(src.height(), src.width(), src.type());
27+
//
28+
// Imgproc.Sobel(src, dst, -1, 1, 1);
29+
30+
//Imgproc.Scharr(src, dst, -1, 1, 0);
31+
32+
//
33+
//sobelFilter.toPImage(dst, sobel);
34+
35+
//opencv.toPImage(opencv.findSobelEdges(20, 75), canny);
36+
37+
noFill();
38+
stroke(0, 255, 0);
39+
strokeWeight(3);
40+
}
41+
42+
void draw() {
43+
scale(0.5);
44+
image(src, 0, 0);
45+
image(canny,src.width,0);
46+
image(sobel,src.width, src.height);
47+
}
48+
99.8 KB
Loading

distribution/OpenCVPro-1/examples/LoadAndDisplayImage/LoadAndDisplayImage.pde

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ void setup() {
66
opencv = new OpenCVPro(this, "test.jpg");
77
size(opencv.width, opencv.height);
88

9-
img = opencv.getImage();
9+
img = opencv.getInputImage();
1010
}
1111

1212
void draw() {

distribution/OpenCVPro-1/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ <h1>OpenCVPro</h1>
4242
<h2>OpenCVPro</h2>
4343
<p>
4444
A library by <a href="http://gregborenstein.com">Greg Borenstein</a> for the <a href="http://www.processing.org" target="_blank">Processing</a> programming environment.<br>
45-
Last update, 04/08/2013.
45+
Last update, 04/09/2013.
4646
</p>
4747
<p>
4848
Computer vision with OpenCV based on the official OpenCV Java API.<br>
@@ -78,7 +78,7 @@ <h2>Installation</h2>
7878
<h2>Examples</h2>
7979
<p>Find a list of examples in the current distribution of OpenCVPro, or have a look at them by following the links below.</p>
8080
<ul>
81-
<li><a href="examples/FaceDetection/FaceDetection.pde">FaceDetection</a></li> <li><a href="examples/LoadAndDisplayImage/LoadAndDisplayImage.pde">LoadAndDisplayImage</a></li>
81+
<li><a href="examples/FaceDetection/FaceDetection.pde">FaceDetection</a></li> <li><a href="examples/FindEdges/FindEdges.pde">FindEdges</a></li> <li><a href="examples/LoadAndDisplayImage/LoadAndDisplayImage.pde">LoadAndDisplayImage</a></li>
8282
</ul>
8383
</div>
8484

distribution/OpenCVPro-1/reference/allclasses-frame.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
<!--NewPage-->
33
<HTML>
44
<HEAD>
5-
<!-- Generated by javadoc (build 1.6.0_37) on Mon Apr 08 13:15:40 EDT 2013 -->
5+
<!-- Generated by javadoc (build 1.6.0_37) on Tue Apr 09 14:54:12 EDT 2013 -->
66
<TITLE>
77
All Classes (Javadocs: OpenCVPro)
88
</TITLE>
99

10-
<META NAME="date" CONTENT="2013-04-08">
10+
<META NAME="date" CONTENT="2013-04-09">
1111

1212
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
1313

distribution/OpenCVPro-1/reference/allclasses-noframe.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
<!--NewPage-->
33
<HTML>
44
<HEAD>
5-
<!-- Generated by javadoc (build 1.6.0_37) on Mon Apr 08 13:15:40 EDT 2013 -->
5+
<!-- Generated by javadoc (build 1.6.0_37) on Tue Apr 09 14:54:12 EDT 2013 -->
66
<TITLE>
77
All Classes (Javadocs: OpenCVPro)
88
</TITLE>
99

10-
<META NAME="date" CONTENT="2013-04-08">
10+
<META NAME="date" CONTENT="2013-04-09">
1111

1212
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
1313

0 commit comments

Comments
 (0)