Skip to content

Commit

Permalink
change opencv 3.0 to opencv 2.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Ldpe2G committed Sep 23, 2016
1 parent f0e95e3 commit c19d6f6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 17 deletions.
13 changes: 6 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
lazy val commonSettings = Seq(
version := "0.1.0",
scalaVersion := "2.11.7"
scalaVersion := "2.11.8"
)

lazy val root = (project in file(".")).
Expand All @@ -11,12 +11,11 @@ lazy val root = (project in file(".")).


libraryDependencies ++= Seq(
"org.scalanlp" %% "breeze" % "0.12",
"org.scalanlp" %% "breeze" % "latest.integration",
"org.scalanlp" %% "breeze-natives" % "0.12",
"org.scalanlp" %% "breeze-viz" % "0.12"
"org.scalanlp" %% "breeze-viz" % "0.12",
"nu.pattern" % "opencv" % "2.4.9-7"
)

resolvers ++= Seq(
"Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/",
"Sonatype Releases" at "https://oss.sonatype.org/content/repositories/releases/"
)

resolvers += "Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"
10 changes: 3 additions & 7 deletions run_script.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
ROOT=$(cd "$(dirname $0)"; pwd)

# better to copy your opencv-300.jar to replace this one
OPENCV_JAR_FILE=$ROOT/lib/opencv-300.jar

# needs to set to your opencv-3.0 build lib path
LIBRARY_PATH=$HOME/opencv3.0/opencv-3.0.0/build/lib/

CLASS_PATH=$OPENCV_JAR_FILE:$ROOT/target/scala-2.11/classes/:$HOME/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.11.7.jar:\
CLASS_PATH=$ROOT/target/scala-2.11/classes/:\
$HOME/.ivy2/cache/nu.pattern/opencv/jars/opencv-2.4.9-7.jar:\
$HOME/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.11.8.jar:\
$HOME/.ivy2/cache/org.scalanlp/breeze_2.11/jars/breeze_2.11-0.12.jar:\
$HOME/.ivy2/cache/org.scalanlp/breeze-macros_2.11/jars/breeze-macros_2.11-0.12.jar:\
$HOME/.ivy2/cache/com.github.fommil.netlib/core/jars/core-1.1.2.jar:\
Expand Down
1 change: 1 addition & 0 deletions src/main/scala/PencilStyle.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import java.io.BufferedReader
* @author Depeng Liang
*/
object PencilStyle {
nu.pattern.OpenCV.loadShared()

def main(args: Array[String]): Unit = {
System.loadLibrary(Core.NATIVE_LIBRARY_NAME)
Expand Down
6 changes: 3 additions & 3 deletions src/main/scala/utils.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import org.opencv.core.Mat
import org.opencv.imgproc.Imgproc
import org.opencv.imgcodecs.Imgcodecs
import org.opencv.core.CvType
import org.opencv.core.Point
import org.opencv.core.Core
Expand All @@ -13,6 +12,7 @@ import breeze.linalg._
import breeze.math._
import breeze.numerics._
import scala.io.Source
import org.opencv.highgui.Highgui


/**
Expand All @@ -32,11 +32,11 @@ object Utils {
)

def imgRead(imgPath: String): Mat = {
Imgcodecs.imread(imgPath, Imgcodecs.IMREAD_COLOR)
Highgui.imread(imgPath, 1)
}

def imgWrite(img: Mat, path: String): Unit = {
Imgcodecs.imwrite(path, img)
Highgui.imwrite(path, img)
}

// compute the image gradient
Expand Down

0 comments on commit c19d6f6

Please sign in to comment.