Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to improve threshold image result OpenCV Java Android

Iam using OpenCVAndroid for thresholding images following is code and result

image description

Following methods from OpenCV used

  Bitmap bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), selectedImage);
  Mat imageMat = new Mat();
  Utils.bitmapToMat(bitmap, imageMat);
  Imgproc.cvtColor(imageMat, imageMat, Imgproc.COLOR_BGR2GRAY);
  Imgproc.threshold(imageMat, imageMat, 120, 255,Imgproc.THRESH_BINARY);
  Utils.matToBitmap(imageMat, bitmap);

got following result

result from threshold function

How can i improve my result, in order to read the barcode and get location of lines running across the pouch in the image??

How to improve threshold image result OpenCV Java Android

Iam using OpenCVAndroid for thresholding images following is code and result

image description

Following methods from OpenCV used

  Bitmap bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), selectedImage);
  Mat imageMat = new Mat();
  Utils.bitmapToMat(bitmap, imageMat);
  Imgproc.cvtColor(imageMat, imageMat, Imgproc.COLOR_BGR2GRAY);
  Imgproc.threshold(imageMat, imageMat, 120, 255,Imgproc.THRESH_BINARY);
  Utils.matToBitmap(imageMat, bitmap);

got following result

result from threshold function

How can i improve my result, in order to read the barcode and get location of lines running across the pouch in the image??