diff --git a/app/src/main/cpp/PhoneDevice.cpp b/app/src/main/cpp/PhoneDevice.cpp index 759725b4..97dafe61 100644 --- a/app/src/main/cpp/PhoneDevice.cpp +++ b/app/src/main/cpp/PhoneDevice.cpp @@ -1568,8 +1568,9 @@ bool CPhoneDevice::OnImageReady(cv::Mat& mat) int fs = fontSize * 2 / 3; textSize = ft2->getTextSize(str, fs, -1, &baseline); - ft2->putText(mat, str, cv::Point(0, mat.rows - fs - 20 * ratio), - fs, scalarRed, -1, cv::LINE_AA, false); + ft2->putText(mat, str, cv::Point(0, mat.rows - fs - 20 * ratio), fs, scalarRed, -1, cv::LINE_AA, false); + // DrawOutlineText(ft2, mat, str, cv::Point(0, mat.rows - fs - 20 * ratio), fs, scalarRed, 1); + #endif // OUTPUT_CAMERA_DBG_INFO for (vector::const_iterator it = mOsds.cbegin(); it != mOsds.cend(); ++it) diff --git a/app/src/main/cpp/camera2/ndkcamera.cpp b/app/src/main/cpp/camera2/ndkcamera.cpp index 4c06a806..38f2ddc0 100644 --- a/app/src/main/cpp/camera2/ndkcamera.cpp +++ b/app/src/main/cpp/camera2/ndkcamera.cpp @@ -693,7 +693,18 @@ int NdkCamera::open(const std::string& cameraId) { m_imagesCaptured = ~0; } - uint8_t aeLockOff = ACAMERA_CONTROL_AE_LOCK_OFF; + if (aeLockAvailable) + { + uint8_t aeLock = ACAMERA_CONTROL_AE_LOCK_ON; + status = ACaptureRequest_setEntry_u8(capture_request, ACAMERA_CONTROL_AE_LOCK, 1,&aeLock); + + XYLOG(XYLOG_SEVERITY_DEBUG, "Try to Lock AE"); + mResult.aeLockSetted = 1; + } + else + { + XYLOG(XYLOG_SEVERITY_DEBUG, "AE_Lock Not Supported"); + } // ACaptureRequest_setEntry_u8(capture_request, ACAMERA_CONTROL_AE_LOCK, 1, &aeLockOff); } else @@ -716,10 +727,17 @@ int NdkCamera::open(const std::string& cameraId) { // TODO: // m_imagesCaptured = 0; - // if (awbSupported) { - // uint8_t awbMode = ACAMERA_CONTROL_AWB_MODE_AUTO; status = ACaptureRequest_setEntry_u8(capture_request, ACAMERA_CONTROL_AWB_MODE, 1, &awbMode); + + if ((awbMode == ACAMERA_CONTROL_AWB_MODE_AUTO) && awbLockAvailable) + { + uint8_t awbLock = ACAMERA_CONTROL_AWB_LOCK_ON; + status = ACaptureRequest_setEntry_u8(capture_request, ACAMERA_CONTROL_AWB_LOCK, 1, &awbLock); + mResult.awbLockSetted = 1; + + XYLOG(XYLOG_SEVERITY_DEBUG, "Try to Lock AWB AWBS=%u", (unsigned int)mResult.awbState); + } } #if 0 @@ -1219,14 +1237,7 @@ void NdkCamera::onCaptureCompleted(ACameraCaptureSession* session, ACaptureReque status = ACameraMetadata_getConstEntry(result, ACAMERA_CONTROL_AWB_MODE, &val); mResult.awbMode = (status == ACAMERA_OK) ? *(val.data.u8) : ACAMERA_CONTROL_AWB_MODE_OFF; - ALOGW("3ASTATE: AES=%u AWBS=%u AFS=%u", (uint32_t)mResult.aeState, (uint32_t)mResult.awbState, (uint32_t)mResult.afState); - - if ((mResult.awbMode == ACAMERA_CONTROL_AWB_MODE_AUTO) && awbLockAvailable && !mResult.awbLockSetted && mResult.awbState == ACAMERA_CONTROL_AWB_STATE_CONVERGED) - { - uint8_t awbLock = ACAMERA_CONTROL_AWB_LOCK_ON; - status = ACaptureRequest_setEntry_u8(capture_request, ACAMERA_CONTROL_AWB_LOCK, 1, &awbLock); - mResult.awbLockSetted = 1; - } + XYLOG(XYLOG_SEVERITY_DEBUG, "3ASTATE: AES=%u AWBS=%u AFS=%u", (uint32_t)mResult.aeState, (uint32_t)mResult.awbState, (uint32_t)mResult.afState); if (m_params.autoExposure != 0) { @@ -1234,13 +1245,7 @@ void NdkCamera::onCaptureCompleted(ACameraCaptureSession* session, ACaptureReque { uint8_t aePrecatureTrigger = ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER_START; status = ACaptureRequest_setEntry_u8(capture_request, ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER, 1, &aePrecatureTrigger); - } - - if (aeLockAvailable && !mResult.aeLockSetted && (mResult.aeState == ACAMERA_CONTROL_AE_STATE_CONVERGED || mResult.aeState == ACAMERA_CONTROL_AE_STATE_FLASH_REQUIRED)) - { - uint8_t aeLock = ACAMERA_CONTROL_AE_LOCK_ON; - status = ACaptureRequest_setEntry_u8(capture_request, ACAMERA_CONTROL_AE_LOCK, 1,&aeLock); - mResult.aeLockSetted = 1; + XYLOG(XYLOG_SEVERITY_DEBUG, "PreCapture AES=%u", (unsigned int)mResult.aeState); } } @@ -1276,12 +1281,16 @@ void NdkCamera::onCaptureCompleted(ACameraCaptureSession* session, ACaptureReque { if (awbMode == ACAMERA_CONTROL_AWB_MODE_AUTO) { - if (m_params.wait3ALocked) + if (awbLockAvailable && m_params.wait3ALocked) { if (mResult.awbState != ACAMERA_CONTROL_AWB_STATE_LOCKED) { return; } + else + { + XYLOG(XYLOG_SEVERITY_DEBUG, "AWB Locked"); + } } else { @@ -1289,17 +1298,25 @@ void NdkCamera::onCaptureCompleted(ACameraCaptureSession* session, ACaptureReque { return; } + else + { + XYLOG(XYLOG_SEVERITY_DEBUG, "AWB CONVERGED Or Locked"); + } } } if (m_params.autoExposure != 0) { - if (m_params.wait3ALocked) + if (aeLockAvailable && m_params.wait3ALocked) { if (mResult.aeState != ACAMERA_CONTROL_AE_STATE_LOCKED) { return; } + else + { + XYLOG(XYLOG_SEVERITY_DEBUG, "AE Locked"); + } } else { @@ -1307,6 +1324,10 @@ void NdkCamera::onCaptureCompleted(ACameraCaptureSession* session, ACaptureReque { return; } + else + { + XYLOG(XYLOG_SEVERITY_DEBUG, "AE CONVERGED Or Locked"); + } } } @@ -1328,11 +1349,13 @@ void NdkCamera::onCaptureCompleted(ACameraCaptureSession* session, ACaptureReque if (mResult.afState == ACAMERA_CONTROL_AF_STATE_PASSIVE_FOCUSED || mResult.afState == ACAMERA_CONTROL_AF_STATE_FOCUSED_LOCKED) // if (afState != ACAMERA_CONTROL_AF_STATE_INACTIVE) { + XYLOG(XYLOG_SEVERITY_DEBUG, "AF Enabled And Focused"); m_imagesCaptured = 0; } } else { + XYLOG(XYLOG_SEVERITY_DEBUG, "AF Not Supported Or AF Not Enabled"); m_imagesCaptured = 0; } }