add camera control.
This commit is contained in:
parent
65ed23b900
commit
737f6a8fab
5
.vscode/c_cpp_properties.json
vendored
5
.vscode/c_cpp_properties.json
vendored
@ -4,9 +4,8 @@
|
|||||||
"name": "Linux",
|
"name": "Linux",
|
||||||
"includePath": [
|
"includePath": [
|
||||||
"${workspaceFolder}/**",
|
"${workspaceFolder}/**",
|
||||||
"/opt/aarch64-v01c01-linux-gnu-gcc/lib/libdatachannel-0.22.5/include",
|
"/opt/aarch64-v01c01-linux-gnu-gcc/lib/libdatachannel-0.22.6/include",
|
||||||
"/opt/aarch64-v01c01-linux-gnu-gcc/lib/boost_1_87_0/include",
|
"/opt/aarch64-v01c01-linux-gnu-gcc/lib/boost_1_88_0/include",
|
||||||
"/opt/aarch64-v01c01-linux-gnu-gcc/lib/libdatachannel-0.22.5",
|
|
||||||
"/opt/aarch64-v01c01-linux-gnu-gcc/lib/ZLMediaKit/include",
|
"/opt/aarch64-v01c01-linux-gnu-gcc/lib/ZLMediaKit/include",
|
||||||
"/opt/aarch64-v01c01-linux-gnu-gcc/lib/LeakTracer/include",
|
"/opt/aarch64-v01c01-linux-gnu-gcc/lib/LeakTracer/include",
|
||||||
"/opt/aarch64-v01c01-linux-gnu-gcc/lib/opencv-4.11.0/include/opencv4",
|
"/opt/aarch64-v01c01-linux-gnu-gcc/lib/opencv-4.11.0/include/opencv4",
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
#include "Core/IoContext.h"
|
#include "Core/IoContext.h"
|
||||||
#include "Core/Logger.h"
|
#include "Core/Logger.h"
|
||||||
#include "Core/Singleton.h"
|
#include "Core/Singleton.h"
|
||||||
#include "HttpSession.h"
|
#include "HttpServer/HttpSession.h"
|
||||||
|
#include "HttpServer/ServiceLogic.h"
|
||||||
#include "Router/router.hpp"
|
#include "Router/router.hpp"
|
||||||
#include "ServiceLogic.h"
|
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
#include "WebRTC/SignalServer.h"
|
#include "WebRTC/SignalServer.h"
|
||||||
#include <boost/asio/strand.hpp>
|
#include <boost/asio/strand.hpp>
|
||||||
|
@ -6,14 +6,15 @@ find_package(Boost COMPONENTS json REQUIRED)
|
|||||||
add_executable(PassengerStatistics main.cpp
|
add_executable(PassengerStatistics main.cpp
|
||||||
Application.h Application.cpp
|
Application.h Application.cpp
|
||||||
Camera.h Camera.cpp
|
Camera.h Camera.cpp
|
||||||
HttpSession.h HttpSession.cpp
|
|
||||||
ImageUtilities.h ImageUtilities.cpp
|
ImageUtilities.h ImageUtilities.cpp
|
||||||
RtspServer.h RtspServer.cpp
|
RtspServer.h RtspServer.cpp
|
||||||
ResponseUtility.h ResponseUtility.cpp
|
|
||||||
ServiceLogic.h ServiceLogic.cpp
|
|
||||||
Settings.h Settings.cpp
|
Settings.h Settings.cpp
|
||||||
VideoInput.h VideoInput.cpp
|
VideoInput.h VideoInput.cpp
|
||||||
|
|
||||||
|
HttpServer/HttpSession.h HttpServer/HttpSession.cpp
|
||||||
|
HttpServer/ResponseUtility.h HttpServer/ResponseUtility.cpp
|
||||||
|
HttpServer/ServiceLogic.h HttpServer/ServiceLogic.cpp
|
||||||
|
|
||||||
WebRTC/Streamer.h WebRTC/Streamer.cpp
|
WebRTC/Streamer.h WebRTC/Streamer.cpp
|
||||||
WebRTC/Helpers.h WebRTC/Helpers.cpp
|
WebRTC/Helpers.h WebRTC/Helpers.cpp
|
||||||
WebRTC/SignalServer.h WebRTC/SignalServer.cpp
|
WebRTC/SignalServer.h WebRTC/SignalServer.cpp
|
||||||
@ -24,6 +25,7 @@ target_include_directories(PassengerStatistics
|
|||||||
PRIVATE ${CMAKE_SOURCE_DIR}/3rdparty/rw_mpp/include
|
PRIVATE ${CMAKE_SOURCE_DIR}/3rdparty/rw_mpp/include
|
||||||
PRIVATE ${CMAKE_SOURCE_DIR}/3rdparty/fsan_sensorsdk/include
|
PRIVATE ${CMAKE_SOURCE_DIR}/3rdparty/fsan_sensorsdk/include
|
||||||
PRIVATE ${ZLMediaKit_INCLUDE_DIR}
|
PRIVATE ${ZLMediaKit_INCLUDE_DIR}
|
||||||
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_directories(PassengerStatistics
|
target_link_directories(PassengerStatistics
|
||||||
|
@ -48,3 +48,45 @@ void Camera::initIrCutGpio() {
|
|||||||
)";
|
)";
|
||||||
system(dayCommand);
|
system(dayCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Camera::zeroCheck() {
|
||||||
|
SENSOR_SDK_AUTOLENS_PARAM_T param = {0};
|
||||||
|
int status = SensorSdk_AutoLens_SetParam(0, SensorSDK_AutoLens_Type_ZeroCheck, ¶m);
|
||||||
|
LOG(info) << "zero check " << (status == SENSOR_SDK_SUCC ? "success" : "failed");
|
||||||
|
return status == SENSOR_SDK_SUCC;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Camera::focus(Focus type) {
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
int focusType = (type == Focus::Far) ? SensorSDK_AutoLens_Type_FocusFar : SensorSDK_AutoLens_Type_FocusNear;
|
||||||
|
|
||||||
|
SENSOR_SDK_AUTOLENS_PARAM_T autolens_param = {0};
|
||||||
|
autolens_param.Params.Param_Base.nStop = 0;
|
||||||
|
autolens_param.Params.Param_Base.nSpeed = 10;
|
||||||
|
int status = SensorSdk_AutoLens_SetParam(0, focusType, &autolens_param);
|
||||||
|
|
||||||
|
std::this_thread::sleep_for(10ms);
|
||||||
|
|
||||||
|
autolens_param.Params.Param_Base.nStop = 1;
|
||||||
|
autolens_param.Params.Param_Base.nSpeed = 0;
|
||||||
|
status = SensorSdk_AutoLens_SetParam(0, focusType, &autolens_param);
|
||||||
|
return status == SENSOR_SDK_SUCC;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Camera::zoom(Zoom type) {
|
||||||
|
using namespace std::chrono_literals;
|
||||||
|
int zoomType = (type == Zoom::In) ? SensorSDK_AutoLens_Type_ZoomIn : SensorSDK_AutoLens_Type_ZoomOut;
|
||||||
|
|
||||||
|
SENSOR_SDK_AUTOLENS_PARAM_T autolens_param = {0};
|
||||||
|
autolens_param.Params.Param_Base.nStop = 0;
|
||||||
|
autolens_param.Params.Param_Base.nSpeed = 10;
|
||||||
|
int status = SensorSdk_AutoLens_SetParam(0, zoomType, &autolens_param);
|
||||||
|
|
||||||
|
std::this_thread::sleep_for(10ms);
|
||||||
|
|
||||||
|
autolens_param.Params.Param_Base.nStop = 1;
|
||||||
|
autolens_param.Params.Param_Base.nSpeed = 0;
|
||||||
|
status = SensorSdk_AutoLens_SetParam(0, zoomType, &autolens_param);
|
||||||
|
|
||||||
|
return status == SENSOR_SDK_SUCC;
|
||||||
|
}
|
||||||
|
@ -1,11 +1,26 @@
|
|||||||
#ifndef __CAMERA_H__
|
#ifndef __CAMERA_H__
|
||||||
#define __CAMERA_H__
|
#define __CAMERA_H__
|
||||||
|
|
||||||
|
#include "Core/Singleton.h"
|
||||||
|
|
||||||
class Camera {
|
class Camera {
|
||||||
|
friend class Core::Singleton<Camera>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Camera();
|
enum Focus {
|
||||||
|
Near,
|
||||||
|
Far,
|
||||||
|
};
|
||||||
|
enum Zoom {
|
||||||
|
Out,
|
||||||
|
In,
|
||||||
|
};
|
||||||
|
bool zeroCheck();
|
||||||
|
bool focus(Focus type);
|
||||||
|
bool zoom(Zoom type);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Camera();
|
||||||
void initIrCutGpio();
|
void initIrCutGpio();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include "ServiceLogic.h"
|
#include "ServiceLogic.h"
|
||||||
|
#include "../Settings.h"
|
||||||
#include "Core/Logger.h"
|
#include "Core/Logger.h"
|
||||||
#include "Core/Singleton.h"
|
#include "Core/Singleton.h"
|
||||||
#include "HttpSession.h"
|
#include "HttpSession.h"
|
||||||
#include "Settings.h"
|
|
||||||
#include <boost/beast/http/file_body.hpp>
|
#include <boost/beast/http/file_body.hpp>
|
||||||
#include <boost/url/url_view.hpp>
|
#include <boost/url/url_view.hpp>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef SERVICELOGIC_H
|
#ifndef SERVICELOGIC_H
|
||||||
#define SERVICELOGIC_H
|
#define SERVICELOGIC_H
|
||||||
|
|
||||||
#include "Application.h"
|
#include "../Application.h"
|
||||||
#include "ResponseUtility.h"
|
#include "ResponseUtility.h"
|
||||||
#include <boost/beast/http/message.hpp>
|
#include <boost/beast/http/message.hpp>
|
||||||
#include <boost/beast/http/string_body.hpp>
|
#include <boost/beast/http/string_body.hpp>
|
@ -1,7 +1,7 @@
|
|||||||
#include "SignalServer.h"
|
#include "SignalServer.h"
|
||||||
#include "../Application.h"
|
#include "../Application.h"
|
||||||
#include "../HttpSession.h"
|
|
||||||
#include "Core/Logger.h"
|
#include "Core/Logger.h"
|
||||||
|
#include "HttpServer/HttpSession.h"
|
||||||
#include "WebSocketSignalSession.h"
|
#include "WebSocketSignalSession.h"
|
||||||
#include <boost/beast/websocket/rfc6455.hpp>
|
#include <boost/beast/websocket/rfc6455.hpp>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user