Skip to content

Commit

Permalink
Fixed size()
Browse files Browse the repository at this point in the history
Now uses numbers instead of variables.
  • Loading branch information
ncmikkelsen committed Mar 22, 2016
1 parent 387ddbd commit 940fd38
Show file tree
Hide file tree
Showing 23 changed files with 49 additions and 64 deletions.
4 changes: 2 additions & 2 deletions examples/CalibrationDemo/CalibrationDemo.pde
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ OpenCV opencv;
void setup() {
src = loadImage("checkerboard.jpg");
src.resize(500, 0);
size(src.width, src.height);
size(500, 333);

opencv = new OpenCV(this, src);
opencv.gray();
Expand All @@ -22,4 +22,4 @@ void draw() {
for(PVector p : cornerPoints){
ellipse(p.x, p.y, 5, 5);
}
}
}
4 changes: 2 additions & 2 deletions examples/ColorChannels/ColorChannels.pde
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ void setup() {
src = loadImage("green_object.png");
src.resize(800,0);
opencv = new OpenCV(this, src);
size(int(opencv.width*1.5), int(opencv.height * 1.5));
size(1200, 672);

imgH = src.height/2;
imgW = src.width/2;
Expand Down Expand Up @@ -43,4 +43,4 @@ void draw() {
image(h, 0, 2*imgH, imgW, imgH);
image(s, imgW, 2*imgH, imgW, imgH);
image(v, 2*imgW, 2*imgH, imgW, imgH);
}
}
7 changes: 3 additions & 4 deletions examples/DepthFromStereo/DepthFromStereo.pde
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ void setup() {

ocvR = new OpenCV(this, imgR);

size(ocvL.width * 2, ocvL.height*2);

size(768, 576);
ocvL.gray();
ocvR.gray();
Mat left = ocvL.getGray();
Expand Down Expand Up @@ -54,5 +54,4 @@ void draw() {
text("right", 10 + imgL.width, 20);
text("stereo SGBM", 10, imgL.height + 20);
text("stereo BM", 10 + imgL.width, imgL.height+ 20);
}

}
5 changes: 2 additions & 3 deletions examples/DilationAndErosion/DilationAndErosion.pde
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ OpenCV opencv;
void setup() {
src = loadImage("pen_sketch.jpg");
src.resize(src.width/2, 0);
size(src.width*2, src.height*2);
size(800, 786);

opencv = new OpenCV(this, src);

Expand Down Expand Up @@ -47,5 +47,4 @@ void draw() {
text("erode", src.width + 20, 20);
text("dilate", 20, src.height+20);
text("dilate then erode\n(close holes)", src.width+20, src.height+20);
}

}
5 changes: 2 additions & 3 deletions examples/FaceDetection/FaceDetection.pde
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Rectangle[] faces;

void setup() {
opencv = new OpenCV(this, "test.jpg");
size(opencv.width, opencv.height);
size(1080, 720);

opencv.loadCascade(OpenCV.CASCADE_FRONTALFACE);
faces = opencv.detect();
Expand All @@ -21,5 +21,4 @@ void draw() {
for (int i = 0; i < faces.length; i++) {
rect(faces[i].x, faces[i].y, faces[i].width, faces[i].height);
}
}

}
5 changes: 2 additions & 3 deletions examples/FilterImages/FilterImages.pde
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PImage img, thresh, blur, adaptive;

void setup() {
img = loadImage("test.jpg");
size(img.width, img.height);
size(1080, 720);

opencv = new OpenCV(this, img);
PImage gray = opencv.getSnapshot();
Expand Down Expand Up @@ -36,5 +36,4 @@ void draw() {
text("threshold", img.width - 100, 20 );
text("blur", img.width/2 - 100, img.height/2 + 20 );
text("adaptive threshold", img.width - 150, img.height/2 + 20 );
}

}
5 changes: 2 additions & 3 deletions examples/FindContours/FindContours.pde
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ArrayList<Contour> polygons;

void setup() {
src = loadImage("test.jpg");
size(src.width, src.height/2);
size(1080, 360);
opencv = new OpenCV(this, src);

opencv.gray();
Expand Down Expand Up @@ -38,5 +38,4 @@ void draw() {
}
endShape();
}
}

}
5 changes: 2 additions & 3 deletions examples/FindEdges/FindEdges.pde
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PImage src, canny, scharr, sobel;

void setup() {
src = loadImage("test.jpg");
size(src.width, src.height);
size(1080, 720);

opencv = new OpenCV(this, src);
opencv.findCannyEdges(20,75);
Expand Down Expand Up @@ -34,5 +34,4 @@ void draw() {
text("Canny", src.width/2 + 10, 25);
text("Scharr", 10, src.height/2 + 25);
text("Sobel", src.width/2 + 10, src.height/2 + 25);
}

}
4 changes: 2 additions & 2 deletions examples/HSVColorTracking/HSVColorTracking.pde
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void setup() {
opencv = new OpenCV(this, video.width, video.height);
contours = new ArrayList<Contour>();

size(2*opencv.width, opencv.height, P2D);
size(1280, 480, P2D);
}

void draw() {
Expand Down Expand Up @@ -104,4 +104,4 @@ void mousePressed() {

rangeLow = hue - 5;
rangeHigh = hue + 5;
}
}
4 changes: 2 additions & 2 deletions examples/HistogramSkinDetection/HistogramSkinDetection.pde
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Mat skinHistogram;
void setup(){
src = loadImage("test.jpg");
src.resize(src.width/2, 0);
size(src.width*2 + 256, src.height);
size(1336, 360);
// third argument is: useColor
opencv = new OpenCV(this, src, true);

Expand Down Expand Up @@ -58,4 +58,4 @@ void draw(){
image(src,0,0);
image(dst, src.width, 0);
image(hist, src.width*2, 0);
}
}
5 changes: 2 additions & 3 deletions examples/HoughLineDetection/HoughLineDetection.pde
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ArrayList<Line> lines;
void setup() {
PImage src = loadImage("film_scan.jpg");
src.resize(0, 800);
size(src.width, src.height);
size(796, 800);

opencv = new OpenCV(this, src);
opencv.findCannyEdges(20, 75);
Expand Down Expand Up @@ -34,5 +34,4 @@ void draw() {
line(line.start.x, line.start.y, line.end.x, line.end.y);
}
}
}

}
5 changes: 2 additions & 3 deletions examples/HueRangeSelection/HueRangeSelection.pde
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ int upperb = 100;
void setup() {
img = loadImage("colored_balls.jpg");
opencv = new OpenCV(this, img);
size(opencv.width, opencv.height);
size(1024, 768);
opencv.useColor(HSB);
}

Expand Down Expand Up @@ -60,5 +60,4 @@ void mouseMoved() {

upperb = constrain(upperb, lowerb, 255);
lowerb = constrain(lowerb, 0, upperb-1);
}

}
5 changes: 2 additions & 3 deletions examples/ImageDiff/ImageDiff.pde
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ PImage before, after, grayDiff;
void setup() {
before = loadImage("before.jpg");
after = loadImage("after.jpg");
size(before.width, before.height);
size(640, 480);

opencv = new OpenCV(this, before);
opencv.diff(after);
Expand Down Expand Up @@ -34,5 +34,4 @@ void draw() {
text("gray diff", before.width/2 + 10, before.height/2+ 20);

// text("color diff", 10, before.height/2+ 20);
}

}
5 changes: 2 additions & 3 deletions examples/ImageFiltering/ImageFiltering.pde
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void setup() {
opencv = new OpenCV(this, 640, 480);
contours = new ArrayList<Contour>();

size(opencv.width + 200, opencv.height, P2D);
size(840, 480, P2D);

// Init Controls
cp5 = new ControlP5(this);
Expand Down Expand Up @@ -293,5 +293,4 @@ void setLock(Controller theController, boolean theValue) {
theController.setColorBackground(color(buttonBgColor));
theController.setColorForeground(color(buttonColor));
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void setup() {
// Blobs list
blobList = new ArrayList<Blob>();

size(opencv.width + 200, opencv.height, P2D);
size(840, 480, P2D);

// Init Controls
cp5 = new ControlP5(this);
Expand Down Expand Up @@ -451,5 +451,4 @@ void setLock(Controller theController, boolean theValue) {
theController.setColorBackground(color(buttonBgColor));
theController.setColorForeground(color(buttonColor));
}
}

}
5 changes: 2 additions & 3 deletions examples/LoadAndDisplayImage/LoadAndDisplayImage.pde
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ OpenCV opencv;

void setup() {
opencv = new OpenCV(this, "test.jpg");
size(opencv.width, opencv.height);
size(1080, 720);
}

void draw() {
image(opencv.getOutput(), 0, 0);
}

}
5 changes: 3 additions & 2 deletions examples/LumaVsGray/LumaVsGray.pde
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ PImage colorImage, grayImage;
void setup() {
colorImage = loadImage("flashlight.jpg");
opencv = new OpenCV(this, colorImage);
size(opencv.width, opencv.height);
size(1080, 720);

// Save the gray image so we can compare it to Luma
grayImage = opencv.getSnapshot();
// Use built-in OpenCV function to conver the color image from BGR to LAB color space.
Expand All @@ -40,4 +41,4 @@ void draw() {
fill(255);
text("GRAY", 30, height -25);
text("LUMA", width/2 + 30, height - 25);
}
}
5 changes: 2 additions & 3 deletions examples/MarkerDetection/MarkerDetection.pde
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ boolean[][] markerCells;

void setup() {
opencv = new OpenCV(this, "marker_test.jpg");
size(opencv.width, opencv.height/2);
size(1000, 365);
src = opencv.getInput();

// hold on to this for later, since adaptiveThreshold is destructive
Expand Down Expand Up @@ -208,5 +208,4 @@ void draw() {
}

popMatrix();
}

}
4 changes: 2 additions & 2 deletions examples/MultipleColorTracking/MultipleColorTracking.pde
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void setup() {
opencv = new OpenCV(this, video.width, video.height);
contours = new ArrayList<Contour>();

size(opencv.width + opencv.width/4 + 30, opencv.height, P2D);
size(830, 480, P2D);

// Array for detection colors
colors = new int[maxColors];
Expand Down Expand Up @@ -194,4 +194,4 @@ void keyPressed() {

void keyReleased() {
colorToChange = -1;
}
}
5 changes: 2 additions & 3 deletions examples/OpticalFlow/OpticalFlow.pde
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ OpenCV opencv;
Movie video;

void setup() {
size(568*2, 320);
size(1136, 320);
video = new Movie(this, "sample1.mov");
opencv = new OpenCV(this, 568, 320);
video.loop();
Expand All @@ -32,5 +32,4 @@ void draw() {

void movieEvent(Movie m) {
m.read();
}

}
6 changes: 3 additions & 3 deletions examples/RegionOfInterest/RegionOfInterest.pde
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ boolean useROI = true;
void setup() {
src = loadImage("test.jpg");
opencv = new OpenCV(this, src);
size(opencv.width, opencv.height);
size(1080, 720);
println(opencv.width, opencv.height);
}

void draw() {
Expand Down Expand Up @@ -39,5 +40,4 @@ void keyPressed() {
if (!useROI) {
opencv.releaseROI();
}
}

}
5 changes: 2 additions & 3 deletions examples/WarpPerspective/WarpPerspective.pde
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Contour contour;

void setup() {
src = loadImage("cards.png");
size(src.width + cardWidth, src.height);
size(950, 749);
opencv = new OpenCV(this, src);

opencv.blur(1);
Expand Down Expand Up @@ -72,5 +72,4 @@ void draw() {
translate(src.width, 0);
image(card, 0, 0);
popMatrix();
}

}
5 changes: 2 additions & 3 deletions examples/WorkingWithColorImages/WorkingWithColorImages.pde
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PImage threshold, blur, adaptive, gray;

void setup() {
PImage img = loadImage("test.jpg");
size(img.width, img.height);
size(1080, 720);

// By default, OpenCV for Processing works with a gray
// version of the source image
Expand Down Expand Up @@ -39,5 +39,4 @@ void draw() {
image(blur, threshold.width,0);
image(adaptive, 0,threshold.height);
image(gray, threshold.width, threshold.height);
}

}

0 comments on commit 940fd38

Please sign in to comment.