Comments (2)
I think I know what the issue is here. Can you post your full sketch so I can run it locally?
from opencv-processing.
Hi Greg,
Sorry for the slow reply, I got your notification emails into the spam folder. Here's the complete sketch. The line that makes the sketch crash is the 40, where I set the color mode back to RGB. I tested it with the last lib version (0.45).
import gab.opencv.*;
import processing.video.*;
import java.awt.Rectangle;
Capture video;
OpenCV opencv;
PImage src, processedImage, cannyImage, contoursImage;
ArrayList<Contour> contours;
void setup() {
video = new Capture(this, 640, 480);
opencv = new OpenCV(this, video.width, video.height);
size(video.width, video.height, P2D);
contours = new ArrayList<Contour>();
video.start();
}
void draw() {
// Load current frame
opencv.useColor();
opencv.loadImage(video);
src = opencv.getSnapshot();
opencv.useColor(HSB); // Change to HSB color space
opencv.setGray(opencv.getS().clone());
opencv.threshold(95);
opencv.erode();
processedImage = opencv.getSnapshot();
// Contours
contours = opencv.findContours(true, true);
contoursImage = opencv.getSnapshot();
// Canny Edges
opencv.loadImage(src);
opencv.useColor(RGB); // Change back to RGB color space
opencv.findCannyEdges(20,75);
opencv.dilate();
opencv.erode();
cannyImage = opencv.getSnapshot();
displayImages();
}
void displayImages() {
pushMatrix();
scale(0.5);
image(src, 0, 0);
image(processedImage, src.width, 0);
image(cannyImage, 0, src.height);
image(src, src.width, src.height);
popMatrix();
text("Source", 10, 25);
text("Pre-processed Image", src.width/2 + 10, 25);
text("Canny Edges", 10, src.height/2 + 25);
text("Contours", src.width/2 + 10, src.height/2 + 25);
displayContours();
}
void displayContours() {
pushMatrix();
scale(0.5);
translate(src.width, src.height);
noFill();
strokeWeight(3);
for (Contour contour : contours) {
Rectangle r = contour.getBoundingBox();
if ((contour.area() > 0.9 * src.width * src.height) ||
(r.width < 30 || r.height < 30))
continue;
stroke(255, 0, 0);
fill(255, 0, 0, 150);
strokeWeight(2);
rect(r.x, r.y, r.width, r.height);
}
popMatrix();
}
void captureEvent(Capture c) {
c.read();
}
from opencv-processing.
Related Issues (20)
- Error in opening movie files HOT 2
- Issue to built the lib for Raspberry PI (arm and x86) HOT 2
- setROI()
- How can i used your library in Netbeans IDE ?
- Request: Update to OpenCV 3.0?
- Library Processing.video error HOT 2
- crash while running P3D, P2D
- Display contours over image HOT 1
- issue with getAverageFlowInRegion HOT 1
- I cannot find radon transform.
- LiveCamTest.pde is crashing on macOS Catalina HOT 2
- Can't load library in macOS Catalina HOT 1
- All examples give NullPointerException error HOT 5
- OpenCV not Working on Processing 3, on Ubuntu 18.04
- Illegal reflective operation warning in Processing 4 HOT 1
- HSVColorTracking Example not responding
- UnsatisfiedLinkError HOT 6
- Update readme or merge latest development with this repo? HOT 2
- [JAVA opencv library] Have you tried the 'WhichFace' example?
- HoughLineDetection example: another result HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opencv-processing.