Hallo,
ich weiß nicht ob ich hier mit openCV richtig bin, aber ich entschuldige mich schonmal vorab falls ich falsch sein sollte.
Aus einem Buch versuche ich momentan ein Tutorial von C++ in Java zu übersetzen. Klappte bis jetzt auch ganz gut aber momentan stecke ich an der floodfill Methode fest. Er wirft mich immer mit einer Exception raus.
Mein Code
Die Exception lautet :
OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in cvGetMat, file ..\..\..\..\opencv\modules\core\src\array.cpp, line 2482
Exception in thread "AWT-EventQueue-0" CvException [org.opencv.core.CvException: cv::Exception: ..\..\..\..\opencv\modules\core\src\array.cpp:2482: error: (-206) Unrecognized or unsupported array type in function cvGetMat
Ich verstehe leider nicht was ich falsch mache :/
Ich gehe davon aus das er probleme mit der MAT labelImag hat. Aber warum und was will er ?!
Vielleicht hat jemand einen tip für mich ?
Danke im vorraus für alle hilfen
ich weiß nicht ob ich hier mit openCV richtig bin, aber ich entschuldige mich schonmal vorab falls ich falsch sein sollte.
Aus einem Buch versuche ich momentan ein Tutorial von C++ in Java zu übersetzen. Klappte bis jetzt auch ganz gut aber momentan stecke ich an der floodfill Methode fest. Er wirft mich immer mit einer Exception raus.
Mein Code
Code:
mask.create((mimg.rows() + 2), mimg.cols() + 2, CvType.CV_8UC1);
mask.setTo(org.opencv.core.Scalar.all(0));
int loDiff = 30;
int upDiff = 30;
int connectivity = 4;
int newMaskVal = 255;
int NumSeeds = 10;
org.opencv.core.Rect ccomp = new org.opencv.core.Rect();
int flags = connectivity + (newMaskVal << 8) + Imgproc.FLOODFILL_FIXED_RANGE + Imgproc.FLOODFILL_MASK_ONLY;
for(int j=0;j<NumSeeds;j++){
seed.x=rects.get(i).center.x+GlobalVar.myRandom(0, (minSize-(minSize/2)));
seed.y=rects.get(i).center.y+GlobalVar.myRandom(0, (minSize-(minSize/2)));
org.opencv.core.Core.circle(mflood, seed, 1, new Scalar(0,255,255), -1);
int area = Imgproc.floodFill(labelImag, mask, seed, new Scalar(255,0,0), ccomp,
new Scalar(loDiff, loDiff, loDiff),
new Scalar(upDiff, upDiff, upDiff), flags);
Die Exception lautet :
OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in cvGetMat, file ..\..\..\..\opencv\modules\core\src\array.cpp, line 2482
Exception in thread "AWT-EventQueue-0" CvException [org.opencv.core.CvException: cv::Exception: ..\..\..\..\opencv\modules\core\src\array.cpp:2482: error: (-206) Unrecognized or unsupported array type in function cvGetMat
Ich verstehe leider nicht was ich falsch mache :/
Ich gehe davon aus das er probleme mit der MAT labelImag hat. Aber warum und was will er ?!
Vielleicht hat jemand einen tip für mich ?
Danke im vorraus für alle hilfen
Zuletzt bearbeitet: