4

I would like to use the front camera for face detection in tensorflow android demo. I managed to switch the camera to front but the detected bounding boxes are drawn incorrectly. Specifically i think they are inverted with respect to the screen. Can someone let me know where to change the orientation of the camera/ change other configurations to correctly draw the detections?

Thanks!

1 Answers1

2

I'm just guessing, but did you flip the box drawing coordinates around backwards left-to-right? The front facing camera flips the image to be a mirror image. This prevents people from becoming confused because they are used to looking at themselves in the mirror, not straight on. To display a bounding box on someone's face, the drawing coordinates also have to be flipped backwards.

DrChandra
  • 181
  • 1
  • 6
  • I tried flipping the box coordinates. But it does not work. It only works around the centre of the screen. Sometimes the boxes go out of the screen. – Deepak Sridhar Jul 13 '18 at 00:13
  • 1
    I was doing the flip incorrectly. I flipped the boxes correctly this time and it's working! – Deepak Sridhar Jul 18 '18 at 21:02
  • 2
    @prakash-m You have to flip the boxes before it is being drawn. If your model input size is 300, then subtract the output from 300 in the RectF location (left and right) variable in processImage() in DetectorActivity.java file. – Deepak Sridhar Nov 17 '18 at 23:47
  • @DeepakSridhar, Thanks.. it worked! accidentally had deleted my previous comment. can you mark the answer as accepted? – Prakash M Nov 18 '18 at 07:15