Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
jpsacha committed Oct 31, 2018
2 parents 42740e2 + bb29381 commit a5c2700
Show file tree
Hide file tree
Showing 24 changed files with 2,287 additions and 46 deletions.
17 changes: 9 additions & 8 deletions FlyCapture2-demo/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
import sbt.Keys._

name := "FlyCapture2-demo"
version := "1.3.4"
version := "1.3.6"

scalaVersion := "2.12.4"
scalaVersion := "2.12.7"

// Platform classifier for native library dependencies
lazy val platform = org.bytedeco.javacpp.Loader.getPlatform

// @formatter:off
val commonSettings = Seq(
scalaVersion := "2.12.4",
scalaVersion := "2.12.7",
scalacOptions ++= Seq("-unchecked", "-deprecation", "-Xlint", "-explaintypes"),
// Some dependencies like `javacpp` are packaged with maven-plugin packaging
classpathTypes += "maven-plugin",
libraryDependencies ++= Seq(
"org.bytedeco.javacpp-presets" % "flycapture" % "2.11.3.121-1.4" classifier "",
"org.bytedeco.javacpp-presets" % "flycapture" % "2.11.3.121-1.4" classifier platform,
"org.bytedeco.javacpp-presets" % "flycapture" % "2.11.3.121-1.4.3" classifier "",
"org.bytedeco.javacpp-presets" % "flycapture" % "2.11.3.121-1.4.3" classifier platform,
"log4j" % "log4j" % "1.2.17",
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
"org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.0"
"org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.1",
),
resolvers ++= Seq(
// Resolver.sonatypeRepo("snapshots"),
Expand All @@ -40,8 +40,9 @@ val uiSettings = commonSettings ++ Seq(
"org.clapper" %% "grizzled-slf4j" % "1.3.2",
"org.slf4j" % "slf4j-api" % "1.7.25",
"org.slf4j" % "slf4j-log4j12" % "1.7.25",
"org.scalafx" %% "scalafx" % "8.0.144-R12",
"org.scalafx" %% "scalafxml-core-sfx8" % "0.4"
"org.scalafx" %% "scalafx" % "8.0.181-R13",
"org.scalafx" %% "scalafxml-core-sfx8" % "0.4",
"org.scalafx" %% "scalafx-extras" % "0.2.0"
),
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full)
)
Expand Down
2 changes: 1 addition & 1 deletion FlyCapture2-demo/project/build.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sbt.version=1.1.1
sbt.version=1.2.6

2 changes: 1 addition & 1 deletion FlyCapture2-demo/project/plugin.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ classpathTypes += "maven-plugin"

// javacpp `Loader` is used to determine `platform` classifier in the project`s `build.sbt`
// We define dependency here (in folder `project`) since it is used by the build itself.
libraryDependencies += "org.bytedeco" % "javacpp" % "1.4"
libraryDependencies += "org.bytedeco" % "javacpp" % "1.4.3"


10 changes: 5 additions & 5 deletions OpenCV_Cookbook/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
name := "opencv-cookbook"
organization := "javacv.examples"

val javacppVersion = "1.4"
val javacppVersion = "1.4.3"
version := javacppVersion
scalaVersion := "2.12.4"
scalaVersion := "2.12.7"
scalacOptions ++= Seq("-unchecked", "-deprecation", "-Xlint")

// Platform classifier for native library dependencies
val platform = org.bytedeco.javacpp.Loader.getPlatform
// Libraries with native dependencies
val bytedecoPresetLibs = Seq(
"opencv" -> "3.4.0-1.4",
"ffmpeg" -> "3.4.1-1.4").flatMap {
"opencv" -> s"3.4.3-$javacppVersion",
"ffmpeg" -> s"4.0.2-$javacppVersion").flatMap {
case (lib, ver) => Seq(
// Add both: dependency and its native binaries for the current `platform`
"org.bytedeco.javacpp-presets" % lib % ver withSources() withJavadoc(),
Expand All @@ -24,7 +24,7 @@ val bytedecoPresetLibs = Seq(
libraryDependencies ++= Seq(
"org.bytedeco" % "javacpp" % javacppVersion withSources() withJavadoc(),
"org.bytedeco" % "javacv" % javacppVersion withSources() withJavadoc(),
"org.scala-lang.modules" %% "scala-swing" % "2.0.2",
"org.scala-lang.modules" %% "scala-swing" % "2.0.3",
"junit" % "junit" % "4.12" % "test",
"com.novocode" % "junit-interface" % "0.11" % "test"
) ++ bytedecoPresetLibs
Expand Down
2 changes: 1 addition & 1 deletion OpenCV_Cookbook/project/build.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sbt.version=1.1.1
sbt.version=1.2.6

2 changes: 1 addition & 1 deletion OpenCV_Cookbook/project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ classpathTypes += "maven-plugin"

// javacpp `Loader` is used to determine `platform` classifier in the project`s `build.sbt`
// We define dependency here (in folder `project`) since it is used by the build itself.
libraryDependencies += "org.bytedeco" % "javacpp" % "1.4"
libraryDependencies += "org.bytedeco" % "javacpp" % "1.4.3"
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import java.awt.image.BufferedImage
import java.io.File
import java.nio.IntBuffer

import javax.swing.JFrame
import javax.swing.WindowConstants
import org.bytedeco.javacpp.indexer.FloatIndexer
import org.bytedeco.javacpp.opencv_core.{Point, _}
import org.bytedeco.javacpp.opencv_imgcodecs._
Expand Down Expand Up @@ -74,14 +74,14 @@ object OpenCVUtils {
def show(mat: Mat, title: String) {
val converter = new ToMat()
val canvas = new CanvasFrame(title, 1)
canvas.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
canvas.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE)
canvas.showImage(converter.convert(mat))
}

/** Show image in a window. Closing the window will exit the application. */
def show(image: Image, title: String) {
val canvas = new CanvasFrame(title, 1)
canvas.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
canvas.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE)
canvas.showImage(image)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

package opencv_cookbook.chapter01

import javax.swing.JFrame

import javax.swing.WindowConstants
import org.bytedeco.javacpp.opencv_imgcodecs._
import org.bytedeco.javacv.{CanvasFrame, OpenCVFrameConverter}

Expand Down Expand Up @@ -37,7 +36,7 @@ object Ex1MyFirstOpenCVApp extends App {
val canvas = new CanvasFrame("My Image", 1)

// Request closing of the application when the image window is closed
canvas.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
canvas.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE)

// Convert from OpenCV Mat to Java Buffered image for display
val converter = new OpenCVFrameConverter.ToMat()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

package opencv_cookbook.chapter01

import javax.swing.JFrame._

import javax.swing.WindowConstants
import org.bytedeco.javacpp.opencv_core._
import org.bytedeco.javacpp.opencv_imgcodecs._
import org.bytedeco.javacpp.opencv_imgproc._
Expand Down Expand Up @@ -36,7 +35,7 @@ object Ex3LoadAndSave extends App {
val canvas = new CanvasFrame("My Image", 1)

// Request closing of the application when the image window is closed
canvas.setDefaultCloseOperation(EXIT_ON_CLOSE)
canvas.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE)

// Show image on window
val converter = new OpenCVFrameConverter.ToMat()
Expand All @@ -54,7 +53,7 @@ object Ex3LoadAndSave extends App {
val canvas2 = new CanvasFrame("Output Image", 1)

// Request closing of the application when the image window is closed
canvas.setDefaultCloseOperation(EXIT_ON_CLOSE)
canvas.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE)

// Show image on window
canvas2.showImage(converter.convert(result))
Expand Down Expand Up @@ -85,6 +84,6 @@ object Ex3LoadAndSave extends App {
8, // Line type.
false) //When true, the image data origin is at the bottom-left corner. Otherwise, it is at the top-left corner.

canvas3.setDefaultCloseOperation(EXIT_ON_CLOSE)
canvas3.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE)
canvas3.showImage(converter.convert(image3))
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ object Ex4MatchingUsingSampleConsensus extends App {
image2, matches.keyPoints2, // 2nd image and its keypoints
toDMatchVector(matches.matches), // the matches
imageMatches, // the image produced
new Scalar(255, 255, 255, 0), // color of the lines
new Scalar(255, 255, 255, 0), // color of the keypoints
new Scalar(0, 0, 255, 0), // color of the lines
new Scalar(255, 0, 0, 0), // color of the keypoints
new BytePointer(0),
2)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
package opencv_cookbook.chapter11


import javax.swing.JFrame

import javax.swing.WindowConstants
import opencv_cookbook.OpenCVUtils._
import org.bytedeco.javacpp.opencv_core._
import org.bytedeco.javacpp.opencv_imgproc._
Expand Down Expand Up @@ -36,7 +35,7 @@ object Ex6MOGMotionDetector extends App {
val canvasFrame = new CanvasFrame("Extracted Foreground")
canvasFrame.setCanvasSize(grabber.getImageWidth, grabber.getImageHeight)
// Exit the example when the canvas frame is closed
canvasFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
canvasFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE)

// Time between frames in the video
val delay = math.round(1000d / grabber.getFrameRate)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

package opencv_cookbook.chapter11

import javax.swing.JFrame
import javax.swing.WindowConstants
import opencv_cookbook.OpenCVUtils._
import org.bytedeco.javacpp.opencv_core._
import org.bytedeco.javacv._
Expand All @@ -19,7 +19,7 @@ import org.bytedeco.javacv._
* @param displayOutput name for the window displaying output image,
* If empty, output image will not be displayed.
*/
class VideoProcessor(var frameProcessor: ((Mat, Mat) => Unit) = { (src, dest) => src.copyTo(dest) },
class VideoProcessor(var frameProcessor: (Mat, Mat) => Unit = { (src, dest) => src.copyTo(dest) },
var displayInput: String = "Input",
var displayOutput: String = "Output") {

Expand Down Expand Up @@ -137,7 +137,7 @@ class VideoProcessor(var frameProcessor: ((Mat, Mat) => Unit) = { (src, dest) =>
private def createCanvas(title: String): Option[CanvasFrame] =
if (title != null && !title.isEmpty) {
val canvas = new CanvasFrame(title, 1)
canvas.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
canvas.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE)
Some(canvas)
} else None

Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ The original examples in the Cookbook are in C++, here they are translated to us
* [flandmark-demo](flandmark-demo) - example of using [flandmark](https://github.com/uricamic/flandmark) library.
* [FlyCapture2-demo](FlyCapture2-demo) - examples of using
[JVM wrapper](https://github.com/bytedeco/javacpp-presets/tree/master/flycapture) for
Point Grey [FlyCapture SDK](http://ww2.ptgrey.com/sdk/flycap).
Flir/Point Grey [FlyCapture SDK](https://www.ptgrey.com/flycapture-sdk).
* [Spinnaker-demo](Spinnaker-demo) - examples of using
[JVM wrapper](https://github.com/bytedeco/javacpp-presets/tree/master/spinnaker) for
Flir/Point Grey [Spinnaker SDK](https://www.ptgrey.com/spinnaker-sdk).



1 change: 1 addition & 0 deletions Spinnaker-demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/*.jpg
39 changes: 39 additions & 0 deletions Spinnaker-demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Spinnaker-demo
================

Example of using [JVM wrapper](https://github.com/bytedeco/javacpp-presets/tree/master/flycapture) for
Point Grey [Spinnaker SDK](https://www.ptgrey.com/spinnaker-sdk).

Please address queries and questions to [JavaCPP discussion group](http://groups.google.com/group/javacpp-project).


Examples
-------

* C API examples in [`src/main/java/spinnaker_c`](src/main/java/spinnaker_c) :
* `Acquisition_C` is an example how to enumerate cameras, start acquisition, and grab images.
* `Sequencer_C` shows how to use the sequencer to grab images with various settings.


Build script
------------

* `build.sbt` - the main SBT configuration file.
* `project/build.properties` - version of SBT to use.
* `project/plugins.sbt` - plugins used for creation of Eclipse projects.


How to build and run using SBT
------------------------------

1. Install [Java JDK](http://www.oracle.com/technetwork/java/javase/downloads/index.html)

2. Install [SBT](http://www.scala-sbt.org/)

3. To run examples, change to directory containing `Spinnaker-demo`. You can run examples by typing on the command line:

```
%> sbt run
```

SBT will download all needed dependencies, including OpenCV and spinnaker, and run the selected example code.
42 changes: 42 additions & 0 deletions Spinnaker-demo/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// @formatter:off

name := "Spinnaker-demo"
organization := "javacv.examples"

val javacppVersion = "1.4.3"
version := javacppVersion
scalaVersion := "2.12.7"
scalacOptions ++= Seq("-unchecked", "-deprecation", "-Xlint")

// Platform classifier for native library dependencies
val platform = org.bytedeco.javacpp.Loader.getPlatform
// Libraries with native dependencies
val bytedecoPresetLibs = Seq(
"spinnaker" -> s"1.15.0.63-1.4.3").flatMap {
case (lib, ver) => Seq(
// Add both: dependency and its native binaries for the current `platform`
"org.bytedeco.javacpp-presets" % lib % ver withSources() withJavadoc(),
"org.bytedeco.javacpp-presets" % lib % ver classifier platform
)
}

libraryDependencies ++= Seq(
"org.bytedeco" % "javacpp" % javacppVersion withSources() withJavadoc(),
"org.bytedeco" % "javacv" % javacppVersion withSources() withJavadoc()
) ++ bytedecoPresetLibs

resolvers ++= Seq(
Resolver.sonatypeRepo("snapshots"),
// Use local maven repo for local javacv builds
Resolver.mavenLocal
)

autoCompilerPlugins := true

// fork a new JVM for 'run' and 'test:run'
fork := true
// add a JVM option to use when forking a JVM for 'run'
javaOptions += "-Xmx1G"

// Set the prompt (for this build) to include the project id.
shellPrompt in ThisBuild := { state => "sbt:" + Project.extract(state).currentRef.project + "> " }
2 changes: 2 additions & 0 deletions Spinnaker-demo/project/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sbt.version=1.2.6

7 changes: 7 additions & 0 deletions Spinnaker-demo/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

// `javacpp` are packaged with maven-plugin packaging, we need to make SBT aware that it should be added to class path.
classpathTypes += "maven-plugin"

// javacpp `Loader` is used to determine `platform` classifier in the project`s `build.sbt`
// We define dependency here (in folder `project`) since it is used by the build itself.
libraryDependencies += "org.bytedeco" % "javacpp" % "1.4.3"
Loading

0 comments on commit a5c2700

Please sign in to comment.