Skip to content

Commit e70629f

Browse files
committed
update getSnapshot() so it returns a PImage corresponding to the ROI if one is set. Closes atduskgreg#52 and atduskgreg#60.
1 parent d153427 commit e70629f

3 files changed

Lines changed: 19 additions & 9 deletions

File tree

examples/RegionOfInterest/RegionOfInterest.pde

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ void draw() {
2323

2424
opencv.findCannyEdges(20,75);
2525
image(opencv.getOutput(), 0, 0);
26+
27+
// if an ROI is in-use then getSnapshot()
28+
// will return an image with the dimensions
29+
// and content of the ROI
30+
if(useROI){
31+
image(opencv.getSnapshot(), width-roiWidth,0);
32+
}
2633
}
2734

2835
// toggle ROI on and off

resources/build.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,12 @@ source.repository=https://github.com/atduskgreg/OpenCVPro
149149
# This is used to compare different versions of the same library, and check if
150150
# an update is available.
151151

152-
library.version=13
152+
library.version=14
153153

154154

155155
# The version as the user will see it.
156156

157-
library.prettyVersion=0.5.2
157+
library.prettyVersion=0.5.3
158158

159159

160160
library.copyright=(c) 2013

src/gab/opencv/OpenCV.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,16 +1284,19 @@ public PImage getOutput(){
12841284
public PImage getSnapshot(){
12851285
PImage result;
12861286

1287-
if(useColor){
1288-
if(colorSpace == PApplet.HSB){
1289-
result = getSnapshot(matHSV);
1287+
if(useROI){
1288+
result = getSnapshot(matROI);
1289+
} else {
1290+
if(useColor){
1291+
if(colorSpace == PApplet.HSB){
1292+
result = getSnapshot(matHSV);
1293+
} else {
1294+
result = getSnapshot(matBGRA);
1295+
}
12901296
} else {
1291-
result = getSnapshot(matBGRA);
1297+
result = getSnapshot(matGray);
12921298
}
1293-
} else {
1294-
result = getSnapshot(matGray);
12951299
}
1296-
12971300
return result;
12981301
}
12991302

0 commit comments

Comments
 (0)