Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cansik/opencv-processing
OpenCV for Processing. A creative coding computer vision library based on the official OpenCV Java API
https://github.com/cansik/opencv-processing
computer-vision creative-coding opencv processing
Last synced: 23 days ago
JSON representation
OpenCV for Processing. A creative coding computer vision library based on the official OpenCV Java API
- Host: GitHub
- URL: https://github.com/cansik/opencv-processing
- Owner: cansik
- License: other
- Created: 2020-03-23T10:10:21.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-04-22T16:21:40.000Z (7 months ago)
- Last Synced: 2024-10-03T13:21:56.262Z (about 1 month ago)
- Topics: computer-vision, creative-coding, opencv, processing
- Language: Java
- Homepage:
- Size: 246 MB
- Stars: 24
- Watchers: 6
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: license.txt
Awesome Lists containing this project
README
## OpenCV for Processing
**A Processing library for the [OpenCV](http://opencv.org/) computer vision library.**
#### Why a new fork?
This fork has been created to support more recent OpenCV versions (4.0<) for Processing and also more platforms (ARM & ARMHF).#### Content
OpenCV for Processing is based on OpenCV's official Java bindings. It attempts to provide convenient wrappers for common OpenCV functions that are friendly to beginners and feel familiar to the Processing environment.
See the included examples below for an overview of what's possible and links to the relevant example code. Complete documentation is available here:
**[OpenCV for Processing reference](http://atduskgreg.github.io/opencv-processing/reference/)**
OpenCV for Processing is based on the officially supported [OpenCV Java API](http://docs.opencv.org/java/), currently at version `4.9.0`. In addition to using the wrapped functionality, you can import OpenCV modules and use any of its documented functions: [OpenCV javadocs](http://docs.opencv.org/java/). See the advanced examples (HistogramSkinDetection, DepthFromStereo, and Marker Detection) below for details. (This style of API was inspired by Kyle McDonald's [ofxCv addon](https://github.com/kylemcdonald/ofxCv) for OpenFrameworks.)
Contributions welcome.
### Build
- Install JDK 8 (because of Processing) (JDK 11 for Processing 4)Run gradle to build a new release package under `/release/opencv-processing.zip`:
```bash
# windows
gradlew.bat releaseProcessingLib# mac / unix
./gradlew releaseProcessingLib
```#### Platform Specific
To build only on a specific platform use the property `javacppPlatform`:```bash
# builds with support for all platforms
gradlew.bat releaseProcessingLib -PjavacppPlatform=linux-x86_64,macosx-x86_64,macosx-arm64,windows-x86_64,linux-armhf,linux-arm64
```#### Build Options
- `-Pdisable-fatjar` - Disable fat jar building (all dependencies as separate files)
- `-Pbare` - Do not include dependencies (opencv, openblas). This allows other libraries to provide the opencv implementation.### Installing
OpenCV for Processing currently supports Mac OSX, 32-bit and 64-bit Windows, 32- and 64-bit Linux. Android support is hopefully coming soon (pull requests welcome).
_NB: When running on the Mac, make sure you have Processing set to 64-bit mode in the Preferences_
See [here](https://github.com/cansik/opencv-processing/releases) for the latest release.
### Examples
#### LiveCamTest
Access a live camera and do image processing on the result, specifically face detection.
Code: [LiveCamTest.pde](https://github.com/atduskgreg/opencv-processing/blob/master/examples/LiveCamTest/LiveCamTest.pde)
_Note: There's a bug that prevents live camera access in current versions of Processing 2.0 on machines with a Retina display._
#### FaceDetection
Detect faces in images.
Code: [FaceDetection.pde](https://github.com/atduskgreg/opencv-processing/blob/master/examples/FaceDetection/FaceDetection.pde)
#### BrightnessContrast
Adjust the brightness and contrast of color and gray images.
Code: [BrightnessContrast.pde](https://github.com/atduskgreg/opencv-processing/blob/master/examples/BrightnessContrast/BrightnessContrast.pde)
#### FilterImages
Basic filtering operations on images: threshold, blur, and adaptive thresholds.
Code: [FilterImages.pde](https://github.com/atduskgreg/opencv-processing/blob/master/examples/FilterImages/FilterImages.pde)
#### FindContours
Find contours in images and calculate polygon approximations of the contours (i.e., the closest straight line that fits the contour).
Code: [FindContours.pde](https://github.com/atduskgreg/opencv-processing/blob/master/examples/FindContours/FindContours.pde)
#### FindEdges
Three different edge-detection techniques: Canny, Scharr, and Sobel.
Code: [FindEdges.pde](https://github.com/atduskgreg/opencv-processing/blob/master/examples/FindEdges/FindEdges.pde)
#### FindLines
Find straight lines in the image using Hough line detection.
Code: [HoughLineDetection.pde](https://github.com/atduskgreg/opencv-processing/blob/master/examples/HoughLineDetection/HoughLineDetection.pde)
#### BrightestPoint
Find the brightest point in an image.
Code: [BrightestPoint.pde](https://github.com/atduskgreg/opencv-processing/blob/master/examples/BrightestPoint/BrightestPoint.pde)
#### RegionOfInterest
Assign a sub-section (or Region of Interest) of the image to be processed. Video of this example in action here: [Region of Interest demo on Vimeo](https://vimeo.com/69009345).
Code: [RegionOfInterest.pde](https://github.com/atduskgreg/opencv-processing/blob/master/examples/RegionOfInterest/RegionOfInterest.pde)
#### ImageDiff
Find the difference between two images in order to subtract the background or detect a new object in a scene.
Code: [ImageDiff.pde](https://github.com/atduskgreg/opencv-processing/blob/master/examples/ImageDiff/ImageDiff.pde)
#### DilationAndErosion
Thin (erode) and expand (dilate) an image in order to close holes. These are known as "morphological" operations.
Code: [DilationAndErosion.pde](https://github.com/atduskgreg/opencv-processing/blob/master/examples/DilationAndErosion/DilationAndErosion.pde)
#### BackgroundSubtraction
Detect moving objects in a scene. Use background subtraction to distinguish background from foreground and contour tracking to track the foreground objects.
Code: [BackgroundSubtraction.pde](https://github.com/atduskgreg/opencv-processing/blob/master/examples/BackgroundSubtraction/BackgroundSubtraction.pde)
#### WorkingWithColorImages
Demonstration of what you can do color images in OpenCV (threshold, blur, etc) and what you can't (lots of other operations).
Code: [WorkingWithColorImages.pde](https://github.com/atduskgreg/opencv-processing/blob/master/examples/WorkingWithColorImages/WorkingWithColorImages.pde)
#### ColorChannels ####
Separate a color image into red, green, blue or hue, saturation, and value channels in order to work with the channels individually.
Code: [ColorChannels](https://github.com/atduskgreg/opencv-processing/blob/master/examples/ColorChannels/ColorChannels.pde)
#### FindHistogram
Demonstrates use of the findHistogram() function and the Histogram class to get and draw histograms for grayscale and individual color channels.
Code: [FindHistogram.pde](https://github.com/atduskgreg/opencv-processing/blob/master/examples/FindHistogram/FindHistogram.pde)
#### HueRangeSelection
Detect objects based on their color. Demonstrates the use of HSV color space as well as range-based image filtering.
Code: [HueRangeSelection.pde](https://github.com/atduskgreg/opencv-processing/blob/master/examples/HueRangeSelection/HueRangeSelection.pde)
#### CalibrationDemo (in progress)
An example of the process involved in calibrating a camera. Currently only detects the corners in a chessboard pattern.
Code: [CalibrationDemo.pde](https://github.com/atduskgreg/opencv-processing/blob/master/examples/CalibrationDemo/CalibrationDemo.pde)
#### HistogramSkinDetection
A more advanced example. Detecting skin in an image based on colors in a region of color space. Warning: uses un-wrapped OpenCV objects and functions.
Code: [HistogramSkinDetection.pde](https://github.com/atduskgreg/opencv-processing/blob/master/examples/HistogramSkinDetection/HistogramSkinDetection.pde)
#### DepthFromStereo
An advanced example. Calculates depth information from a pair of stereo images. Warning: uses un-wrapped OpenCV objects and functions.
Code: [DepthFromStereo.pde](https://github.com/atduskgreg/opencv-processing/blob/master/examples/DepthFromStereo/DepthFromStereo.pde)
#### WarpPerspective (in progress)
Un-distort an object that's in perspective. Coming to the real API soon.
Code: [WarpPerspective.pde](https://github.com/atduskgreg/opencv-processing/blob/master/examples/WarpPerspective/WarpPerspective.pde)
#### MarkerDetection
An in-depth advanced example. Detect a CV marker in an image, warp perspective, and detect the number stored in the marker. Many steps in the code. Uses many un-wrapped OpenCV objects and functions.
Code: [MarkerDetection.pde](https://github.com/atduskgreg/opencv-processing/blob/master/examples/MarkerDetection/MarkerDetection.pde)
#### MorphologyOperations
Open and close an image, or do more complicated morphological transformations.
Code: [MorphologyOperations.pde](examples/MorphologyOperations/MorphologyOperations.pde)