6

I installed OpenCV (opencv-3.0.0-alpha) and it works proberly but I can't use that import

import org.opencv.core.*;
import org.opencv.highgui.Highgui;

public class Main {

    public static void main(String[] args) {

//      System.loadLibrary("opencv_java244");
//      Mat m = Highgui.imread("C:/Users/raj/Desktop/sa1.png",
//              Highgui.CV_LOAD_IMAGE_COLOR);
//      new LoadImage("C:/Users/raj/Desktop/dst1.jpg", m);
    }
}

I get this error

The import org.opencv.highgui cannot be resolved

How can I solve this?

n1amr
  • 158
  • 1
  • 1
  • 6

2 Answers2

16

in opencv3.0, there is no more highgui module in java.

the functionality was split up into new videoio and imgcodecs (that's where you will find imread) modules.

since there is no gui available from java, - no need to have a highgui module anymore.

import org.opencv.core.*;
import org.opencv.imgcodecs; // imread, imwrite, etc
import org.opencv.videoio;   // VideoCapture
Community
  • 1
  • 1
berak
  • 39,159
  • 9
  • 91
  • 89
  • ++C ofc still has it. ;) – berak Sep 17 '14 at 12:25
  • I don't know how I feel about this... except: OpenCV != Consistency – karlphillip Sep 17 '14 at 12:27
  • true, - atm, they don't seem to fear breaking things.. there will be definitely more surprises, like the drawing calls all went into imgproc, constants changed their name overnight, it's a bit like they're playing pranks on you ;) – berak Sep 17 '14 at 12:31
  • 1
    what can i do if i want to use following in android org.opencv.highgui.Highgui; org.opencv.highgui.VideoCapture; – Sanjay Bhalani Jul 18 '15 at 13:26
  • cannot find symbol symbol: class imgcodecs location: package org.opencv –  May 24 '16 at 07:41
  • OLD CODE: Highgui.imencode(".bmp", frame, mem); NEW CODE: Imgcodecs.imencode(".bmp", frame, mem); – user755499 Oct 10 '16 at 10:07
0
import org.opencv.imgcodecs.Imgcodecs; // imread, imwrite

Not: org.opencv.imgcodecs;

Core.line, Core.Rectangle, Core.imread, Core.imwrite deprecated.

Use Imgcodecs.imread, Imgcodecs.imwrite, etc.

Sébastien
  • 11,860
  • 11
  • 58
  • 78
Eoghan Hynes
  • 41
  • 11