title: Error performing face detection using mobile vision API
body: <pre><code>            Intent takePicture = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
              takePicture.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);
              startActivityForResult(takePicture,0);
  
  
  
  protected void onActivityResult(int requestCode, int resultCode, Intent data)
  {
    //  Bitmap bitmap =(Bitmap)data.getExtras().get("Data");
     // imageView.setImageBitmap(bitmap);
  
      FaceDetector detector;
      ImageView myImageView = (ImageView) findViewById(R.id.ivImage);
      BitmapFactory.Options options = new BitmapFactory.Options();
      options.inMutable=true;
  
      fileUri  = getOutputMediaFileUri(FileColumns.MEDIA_TYPE_IMAGE);
  
      final  Bitmap myBitmap = BitmapFactory.decodeFile(fileUri.toString(),options);
  
  
   // Bitmap myBitmap = BitmapFactory.decodeResource(getApplicationContext().getResources(),R.drawable.me);
  
  
      Paint myRectPaint = new Paint();
      myRectPaint.setStrokeWidth(5);
     myRectPaint.setColor(Color.RED);
     myRectPaint.setStyle(Paint.Style.STROKE);
  
  
  
     Bitmap tempBitmap = Bitmap.createBitmap(myBitmap.getWidth(), myBitmap.getHeight(), Bitmap.Config.RGB_565);
      Canvas tempCanvas = new Canvas(tempBitmap);
      tempCanvas.drawBitmap(myBitmap, 0, 0, null);
  
  
     FaceDetector faceDetector = new  FaceDetector.Builder(getApplicationContext()).setTrackingEnabled(false).build();
  
  
     Frame frame = new Frame.Builder().setBitmap(myBitmap).build();
     SparseArray&lt;com.google.android.gms.vision.face.Face&gt; faces = faceDetector.detect(frame);
     if(!faceDetector.isOperational())
     {
          new AlertDialog.Builder(this).setMessage("Face Detector :(").show();
          return;
     }
      for(int i=0; i&lt;faces.size(); i++)
      {
         Face thisFace = faces.valueAt(i);
         float x1 = thisFace.getPosition().x;
         float y1 = thisFace.getPosition().y;
         float x2 = x1 + thisFace.getWidth();
         float y2 = y1 + thisFace.getHeight();
         tempCanvas.drawRoundRect(new RectF(x1, y1, x2, y2), 2, 2, myRectPaint);
      }
  
     myImageView.setImageDrawable(new BitmapDrawable(getResources(),tempBitmap));
  }
  </code></pre>
  
  <p>error</p>
  
  <p>at this point</p>
  
  <blockquote>
    <p>12-04 19:54:41.419 14215-14215/com.example.user.demo E/BitmapFactory:
    Unable to decode stream: java.io.FileNotFoundException:
    file:/storage/emulated/0/Pictures/IMAGE_DIRECTORY_NAME/IMG_20171204_195441.jpg:
    open failed: ENOENT (No such file or directory) 12-04 19:54:41.462
    14215-14215/com.example.user.demo E/AndroidRuntime: FATAL EXCEPTION:
    main
                                                                           Process: com.example.user.demo, PID: 14215</p>
    
    <p>java.lang.RuntimeException: Failure delivering result
    ResultInfo{who=null, request=0, result=-1, data=Intent {
    act=inline-data dat=content://media/external/images/media/139760
    typ=image/jpeg (has extras) }} to activity
    {com.example.user.demo/com.example.user.demo.MainActivity}:
    java.lang.NullPointerException: Attempt to invoke virtual method 'int
    android.graphics.Bitmap.getWidth()' on a null object reference
    at com.example.user.demo.MainActivity.onActivityResult ->>>. Bitmap
    tempBitmap = Bitmap.createBitmap(myBitmap.getWidth(),
    myBitmap.getHeight(), Bitmap.Config.RGB_565);</p>
  </blockquote>