实现拍照放大功能

serial
Matthew 1 year ago
parent dc4c3a93c9
commit 848defbcaa

@ -896,6 +896,8 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector<
mOsds = osds;
NdkCamera::CAMERA_PARAMS params;
memset(&params, 0, sizeof(params));
params.sceneMode = mPhotoInfo.sceneMode;
params.autoFocus = mPhotoInfo.autoFocus;
params.autoExposure = mPhotoInfo.autoExposure;
@ -903,6 +905,8 @@ bool CPhoneDevice::TakePhoto(const IDevice::PHOTO_INFO& photoInfo, const vector<
params.exposureTime = mPhotoInfo.exposureTime;
params.sensibility = mPhotoInfo.sensibility;
params.orientation = mPhotoInfo.orientation;
params.zoom = mPhotoInfo.zoom;
params.zoomRatio = mPhotoInfo.zoomRatio;
// GpioControl::EnableGpio(CMD_SET_CAM_3V3_EN_STATE, true);
bool res = false;

@ -408,6 +408,15 @@ int NdkCamera::open(const std::string& cameraId) {
}
m_imagesCaptured = 0;
if (m_params.zoom)
{
float zoomRatio = m_params.zoomRatio;
// uint8_t afMode = ACAMERA_CONTROL_AF_MODE_AUTO;
status = ACaptureRequest_setEntry_float(capture_request, ACAMERA_CONTROL_ZOOM_RATIO, 1, &zoomRatio);
}
if (afSupported && m_params.autoFocus) {
// uint8_t afMode = ACAMERA_CONTROL_AF_MODE_CONTINUOUS_VIDEO;
uint8_t afMode = ACAMERA_CONTROL_AF_MODE_CONTINUOUS_PICTURE;

@ -74,9 +74,11 @@ public:
unsigned int autoExposure : 1;
unsigned int orientation:3;
unsigned int focusTimeout : 14; // milli-seconds 65535 / 4
unsigned int reserved : 8;
unsigned int zoom;
unsigned int reserved : 7;
unsigned int exposureTime; // ms
unsigned int sensibility;
float zoomRatio;
};
struct CAPTURE_RESULT

@ -258,6 +258,7 @@ public class ChannelActivity extends AppCompatActivity {
jsonObject.put("sceneMode", sceneMode);
jsonObject.put("exposureTime", Integer.parseInt(binding.exposuretime.getText().toString()));
jsonObject.put("sensibility", Integer.parseInt(binding.sensitivity.getText().toString()));
jsonObject.put("zoom", binding.btnZoom.isChecked() ? 1 : 0);
jsonObject.put("orientation", binding.orientations.getSelectedItemPosition());
jsonObject.put("recognization", binding.recognization.getSelectedItemPosition());
// binding.cameraId.setText(jsonObject.optString("cameraId", ""));
@ -266,6 +267,11 @@ public class ChannelActivity extends AppCompatActivity {
} else {
jsonObject.remove("cameraId");
}
if (binding.zoomRatio.getSelectedItemPosition() >= 0) {
jsonObject.put("zoomRatio", Float.valueOf(binding.zoomRatio.getSelectedItem().toString()));
} else {
jsonObject.put("zoomRatio", 0f);
}
if (!TextUtils.isEmpty(binding.resolutionCX.getText().toString())) {
jsonObject.put("resolutionCX", Integer.parseInt(binding.resolutionCX.getText().toString()));
} else {

Loading…
Cancel
Save