Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 353

I am not able to select objects from image after using fill contours in android

$
0
0
mIntermediateMat= new Mat(); Bitmap bmp = BitmapFactory.decodeResource(getResources(),R.drawable.al);; Mat rgba= new Mat(bmp.getHeight(), bmp.getWidth(), CvType.CV_8UC1); Utils.bitmapToMat(bmp, rgba); Size sizeRgba = rgba.size(); Mat rgbaInnerWindow; int rows = (int) sizeRgba.height; int cols = (int) sizeRgba.width; int left = cols / 19; int top = rows / 19; int width = cols * 15/16; int height = rows * 15/16 ; rgbaInnerWindow = rgba.submat(top, top + height, left, left + width); Imgproc.Canny(rgbaInnerWindow, mIntermediateMat, 5, 35); rgbaInnerWindow.setTo(new Scalar(0, 0, 0, 255), mIntermediateMat); List contours = mDetector.getContours(); Log.e(TAG, "Contours count: " + contours.size()); Imgproc.drawContours(rgbaInnerWindow, contours, -1, CONTOUR_COLOR); Bitmap resultBitmap = Bitmap.createBitmap(rgba.cols(),rgba.rows(),Bitmap.Config.ARGB_8888); Utils.matToBitmap(rgba, resultBitmap); imageView.setImageBitmap(resultBitmap);

Viewing all articles
Browse latest Browse all 353

Trending Articles