2 import java
.awt
.image
.BufferedImage
;
4 import org
.opencv
.core
.Core
;
5 import org
.opencv
.core
.Mat
;
6 import org
.opencv
.core
.Scalar
;
7 import org
.opencv
.imgcodecs
.Imgcodecs
;
9 public class IsolateImage
extends Panel
{
10 BufferedImage filteredImage
;
11 BufferedImage origImage
;
13 public static Mat matOriginal
;
14 public static Mat filtered
;
16 public static final Scalar LOWER_BOUNDS
= new Scalar(103, 164, 169);
17 public static final Scalar UPPER_BOUNDS
= new Scalar(125, 229, 255);
20 System
.loadLibrary(Core
.NATIVE_LIBRARY_NAME
);
23 public IsolateImage() {
27 public static void main(String args
[]) throws Exception
{
29 matOriginal
= new Mat();
35 public static void processImage() {
36 matOriginal
= Imgcodecs
.imread("imgs/testpicture.png"); // convert image
39 Core
.inRange(matOriginal
, LOWER_BOUNDS
, UPPER_BOUNDS
, filtered
);
41 Imgcodecs
.imwrite("output.png", filtered
);