Skip to content

Commit cf2f910

Browse files
committed
Fix bug in Contour draw() where beginShape() and endShape() were called
per-point, making contours invisible. Also, add access to Contour bounding boxes. Note: Imgproc has different methods for finding bounding boxes of MatOfPoint and MatOfPoint2D
1 parent 2038015 commit cf2f910

19 files changed

Lines changed: 74 additions & 36 deletions

File tree

480 Bytes
Binary file not shown.
480 Bytes
Binary file not shown.

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,6 @@ ArrayList<MatOfPoint2f> selectMarkers(ArrayList<MatOfPoint2f> candidates) {
133133
continue;
134134
}
135135

136-
137-
138-
139136
result.add(candidate);
140137
}
141138

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import gab.opencvpro.*;
22

33
OpenCVPro opencv;
4-
PImage threshold, blur;
4+
PImage threshold, blur, adaptive, gray;
55

66
void setup() {
77
PImage img = loadImage("test.jpg");
8-
size(img.width, img.height/2);
8+
size(img.width, img.height);
99

1010
// By default, OpenCVPro works with a gray
1111
// version of the source image
1212
opencv = new OpenCVPro(this, img);
1313
// but you can tell it explicitly to use color instead:
1414
opencv.useColor();
1515

16-
// A lot of OpenCV operations only work on gray.
16+
// A lot of OpenCV operations only work on grayscale images.
1717
// But some do work in color, like threshold, blur, findCannyEdges, findChessboardCorners, etc.:
1818
opencv.threshold(75);
1919
threshold = opencv.getSnapshot();
@@ -22,17 +22,22 @@ void setup() {
2222
blur = opencv.getSnapshot();
2323

2424
// If you try an operation that does not work in color
25-
// it will raise an exception and print out a message:
26-
try{
27-
opencv.adaptiveThreshold(591, 1);
28-
} catch (Exception e){
29-
}
30-
25+
// it will print out an error message and leave the image unaffected
26+
opencv.adaptiveThreshold(591, 1);
27+
adaptive = opencv.getSnapshot();
28+
29+
// if you convert the image to gray then you can
30+
// do gray-only operations
31+
opencv.gray();
32+
opencv.adaptiveThreshold(591, 1);
33+
gray = opencv.getSnapshot();
3134
}
3235

3336
void draw() {
3437
scale(0.5);
3538
image(threshold, 0, 0);
3639
image(blur, threshold.width,0);
40+
image(adaptive, 0,threshold.height);
41+
image(gray, threshold.width, threshold.height);
3742
}
3843

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!--NewPage-->
33
<HTML>
44
<HEAD>
5-
<!-- Generated by javadoc (build 1.6.0_45) on Tue Jun 25 10:25:22 EDT 2013 -->
5+
<!-- Generated by javadoc (build 1.6.0_45) on Tue Jun 25 16:10:30 EDT 2013 -->
66
<TITLE>
77
All Classes (Javadocs: OpenCVPro)
88
</TITLE>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!--NewPage-->
33
<HTML>
44
<HEAD>
5-
<!-- Generated by javadoc (build 1.6.0_45) on Tue Jun 25 10:25:22 EDT 2013 -->
5+
<!-- Generated by javadoc (build 1.6.0_45) on Tue Jun 25 16:10:30 EDT 2013 -->
66
<TITLE>
77
All Classes (Javadocs: OpenCVPro)
88
</TITLE>

distribution/OpenCVPro-1/reference/constant-values.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!--NewPage-->
33
<HTML>
44
<HEAD>
5-
<!-- Generated by javadoc (build 1.6.0_45) on Tue Jun 25 10:25:22 EDT 2013 -->
5+
<!-- Generated by javadoc (build 1.6.0_45) on Tue Jun 25 16:10:30 EDT 2013 -->
66
<TITLE>
77
Constant Field Values (Javadocs: OpenCVPro)
88
</TITLE>

distribution/OpenCVPro-1/reference/deprecated-list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!--NewPage-->
33
<HTML>
44
<HEAD>
5-
<!-- Generated by javadoc (build 1.6.0_45) on Tue Jun 25 10:25:22 EDT 2013 -->
5+
<!-- Generated by javadoc (build 1.6.0_45) on Tue Jun 25 16:10:30 EDT 2013 -->
66
<TITLE>
77
Deprecated List (Javadocs: OpenCVPro)
88
</TITLE>

distribution/OpenCVPro-1/reference/gab/opencvpro/Contour.html

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!--NewPage-->
33
<HTML>
44
<HEAD>
5-
<!-- Generated by javadoc (build 1.6.0_45) on Tue Jun 25 10:25:22 EDT 2013 -->
5+
<!-- Generated by javadoc (build 1.6.0_45) on Tue Jun 25 16:10:30 EDT 2013 -->
66
<TITLE>
77
Contour (Javadocs: OpenCVPro)
88
</TITLE>
@@ -140,6 +140,14 @@ <H2>
140140
<CODE>&nbsp;void</CODE></FONT></TD>
141141
<TD><CODE><B><A HREF="../../gab/opencvpro/Contour.html#draw()">draw</A></B>()</CODE>
142142

143+
<BR>
144+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
145+
</TR>
146+
<TR BGCOLOR="white" CLASS="TableRowColor">
147+
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
148+
<CODE>&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/awt/Rectangle.html?is-external=true" title="class or interface in java.awt">Rectangle</A></CODE></FONT></TD>
149+
<TD><CODE><B><A HREF="../../gab/opencvpro/Contour.html#getBoundingBox()">getBoundingBox</A></B>()</CODE>
150+
143151
<BR>
144152
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
145153
</TR>
@@ -316,6 +324,17 @@ <H2>
316324
</DL>
317325
</DD>
318326
</DL>
327+
<HR>
328+
329+
<A NAME="getBoundingBox()"><!-- --></A><H3>
330+
getBoundingBox</H3>
331+
<PRE>
332+
public <A HREF="http://java.sun.com/javase/6/docs/api/java/awt/Rectangle.html?is-external=true" title="class or interface in java.awt">Rectangle</A> <B>getBoundingBox</B>()</PRE>
333+
<DL>
334+
<DD><DL>
335+
</DL>
336+
</DD>
337+
</DL>
319338
<!-- ========= END OF CLASS DATA ========= -->
320339
<HR>
321340

distribution/OpenCVPro-1/reference/gab/opencvpro/OpenCVPro.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!--NewPage-->
33
<HTML>
44
<HEAD>
5-
<!-- Generated by javadoc (build 1.6.0_45) on Tue Jun 25 10:25:22 EDT 2013 -->
5+
<!-- Generated by javadoc (build 1.6.0_45) on Tue Jun 25 16:10:30 EDT 2013 -->
66
<TITLE>
77
OpenCVPro (Javadocs: OpenCVPro)
88
</TITLE>

0 commit comments

Comments
 (0)