Solved: The type list is not generic; it cannot be parameterized with arguments <MatOfPoint> [closed]
I am following samples that use the line …
List<MatOfPoint> contours = new ArrayList<MatOfPoint>();
Example …
List<MatOfPoint> contours = new ArrayList<MatOfPoint>();
Mat notused;
Imgproc.findContours(dilateImg,contours,notused,Imgproc.RETR_LIST,Imgproc.CHAIN_APPROX_SIMPLE);
for(MatOfPoint cont : contours)
The samples claim to be correct but, they in fact do not compile. What am I missing?
Actral code not running ....
vid.read(mat);
if (!mat.empty()){
Mat mono = new Mat();
Imgproc.cvtColor(mat, mat, Imgproc.COLOR_BGR2GRAY);
Mat blur = new Mat();
Imgproc.GaussianBlur(mono, blur, new Size(9, 9), 2, 2);
Mat thresh = new Mat();
Imgproc.threshold(blur, thresh, 0, 255, Imgproc.THRESH_BINARY_INV|Imgproc.THRESH_OTSU);
Mat erodeImg = new Mat();
Mat erode = new Mat();
Imgproc.erode(thresh, erodeImg, erode);
Mat dilateImg = new Mat();
Mat dilate = new Mat();
Imgproc.dilate(erodeImg, dilateImg, dilate);
List<MatOfPoint> contours = new ArrayList<MatOfPoint>(); // This line creates an error!
opencv version ?
Mat notused = new Mat();
apart from that it compiles successful, here.
Mat notused = new Mat(); // Is in the sample script for Lego line follower
Eclipse IDE for Java Developers Version: Oxygen.3 Release (4.7.3)
OpenCV 3.4.1
Actual code not running is ...
^^^ tip for the future: rather edit you question, than putting code into comments (not enough space there, usually)
Solved:
https://stackoverflow.com/questions/1...
ok, so
java.util.List
instead of the (implicit)java.awt.List
.This thread was closed prematurely. The answer is farther down the chain of events.