Tobias Sytsma
Tobias Sytsma

Reputation: 41

detect bright spots in nv21 image

I'd like to be able to detect small bright spots in a rectangular area (selected by dragging around a shape) in a NV21 preview byte array, sent to a PreviewCallback.

image

Main goal of this is to be able to detect whether someone's shining into the camera with a flashlight.

Any ideas? Thanks!

Upvotes: 1

Views: 92

Answers (1)

Alex Cohn
Alex Cohn

Reputation: 57203

The first width*height bytes of NV21 are plain grayscale image, so you can feed them to any image processing algorithm with minimal effort.

One caveat you should be aware of, even if you hold the device in portrait orientation, and apply camera.setOrientation() to have the preview rotated properly, the preview buffer will still most likely be landscape, keep this in mind when you apply the coordinates received from computer vision.

Upvotes: 1

Related Questions