1

The sample Camera2Base provides a good understanding on how capture a image from the camera but not the image streamed from the camera. You could try to capture every image but I think there's a better way to access the stream. My guess it's that the stream could be captured in the line within the 'case' statement in the code below, but I don't know how to do it.

private CameraCaptureSession.CaptureCallback mCaptureCallback
        = new CameraCaptureSession.CaptureCallback() {
    private void process(CaptureResult result) {
        switch (mState) {
            case STATE_PREVIEW: {
                // We have nothing to do when the camera preview is working normally.
                break;
            }

After capturing the image I need to be able to find the position of a laser red dot in it. I've never done image processing my guess it's to sweep the bitmap matrix looking to the color red-ish of the red dot and I wouldn't need help from any image processing library. What do you think on getting a image processing library to do this simple task? suppose that there's nothing else red on the image.

Rinaldi Segecin
  • 449
  • 8
  • 23
  • I've been studding the code on https://github.com/googlesamples/android-Camera2Basic, and I believe that mCaptureSession redirects the camera's pipeline to the preview texture and to the capture itself but not both at same time. The preview texture is 'refreshed' by mCaptureSession.setRepeatingRequest and the mOnImageAvailableListener is called when 'capture' is fired on captureStillPicture(), but if you disable the preview texture and you set Repeating Request with the same builder to try call mOnImageAvailableListener it just won't work. Has anyone else been working on it? Any enlightenment? – Rinaldi Segecin Sep 15 '15 at 04:59
  • I am working on the same problem, needing to check for a qr code in the real time but so far I came to the conclusion that I should use MediaCodec as a surface target and process it all like a video streaming. I will try and let you know – Gutyn Oct 26 '15 at 16:59
  • Mihail have you tried zxing? http://code.tutsplus.com/tutorials/android-sdk-create-a-barcode-reader--mobile-17162 – Rinaldi Segecin Jan 26 '16 at 01:36
  • I created this: https://github.com/Gutyn/camera2QRcodeReader , which works very good. – Gutyn Jan 26 '16 at 01:59
  • 1
    I think this would help [Camera Preview from Android2Basic](https://stackoverflow.com/questions/25462277/camera-preview-image-data-processing-with-android-l-and-camera2-api) – Hữu Nghĩa Nguyễn Hồ Aug 22 '19 at 13:09

0 Answers0