java - The followinf error of unrecognized or unsupported array type in CvMat *cvGetMat(const CvArr *, CvMat *, int *, int), -
public class mainactivity extends appcompatactivity { static { system.loadlibrary("opencv_java"); system.loadlibrary("nonfree"); } private imageview imageview; private bitmap inputimage; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); inputimage = bitmapfactory.decoderesource(getresources(), r.drawable.test); setcontentview(r.layout.activity_main); imageview = (imageview) this.findviewbyid(r.id.imageview); sift(); } @override public void onresume() { super.onresume(); } public void sift() { mat rgba = new mat(); utils.bitmaptomat(inputimage, rgba); mat outputimg = new mat(); imgproc.cvtcolor(rgba, rgba, imgproc.color_rgba2rgb); imgproc.cvtcolor(rgba, outputimg, imgproc.color_rgb2hsv); mat news =new mat(); mat rgb = new mat(rgba.size(),cvtype.cv_8sc3); scalar lower_green =new scalar(45, 50,20); scalar upper_green =new scalar(95,255,255); core.inrange(outputimg, lower_green, upper_green,news); imgproc.cvtcolor(news, news, imgproc.color_gray2rgb); //morphological operations mat bground = new mat(); mat fground = new mat(); imgproc.erode(news, fground, imgproc.getstructuringelement(imgproc.morph_rect, new size(55,55*3))); imgproc.dilate(news, bground, imgproc.getstructuringelement(imgproc.morph_rect, new size(55, 55*3))); mat mark =new mat(); //marker watershed algorithm mat markerimage =new mat(mark.size(),cvtype.cv_32s); core.add(fground,bground,mark); markerimage.convertto(mark, cv_32s); rgb.convertto(rgba, cv_8s); int markdepth =rgb.depth(); int rgbdepth =rgb.depth(); int markchannel =markerimage.channels(); int rgbchannel =rgba.channels(); if (markerimage.depth() == cv_32s ){ system.out.println("depth32 = " + markdepth); } if (rgb.depth() == cv_8s ){ system.out.println("depth8 = " + rgbdepth); } system.out.println("markchannel = " + markchannel); system.out.println("rgbachannel = " + rgbchannel); imgproc.watershed(rgb,markerimage); utils.mattobitmap(mark, inputimage); imageview.setimagebitmap(inputimage); } // code working leaf image identification , comparison }
the code supposed compare , identify leaf image using watershed algorithm. error generated is:
opencv error: bad flag (parameter or structure field) (unrecognized or unsupported array type) in cvmat *cvgetmat(const cvarr *, cvmat *, int *, int), file /hdd2/buildbot/slaves/slave_ardbeg1/50-sdk/opencv/modules/core/src/array.cpp
Comments
Post a Comment