1
0
Fork 0

LRD_Revise

仅测试编译通过,尚未运行
LRD_Develop
LuoRuidi 2024-01-15 20:00:34 +08:00
parent 326173660f
commit 8adc159564
13 changed files with 606 additions and 146 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
Code/RK3588/stereo_yolo/rknpu2/examples/rknn_yolov5_demo/.idea
Code/RK3588/stereo_yolo/rknpu2/examples/rknn_yolov5_demo/build
Code/RK3588/stereo_yolo/rknpu2/examples/rknn_yolov5_demo/cmake-build-debug
Code/.DS_Store
.DS_Store

View File

@ -0,0 +1,397 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="CMakePresetLoader">{
&quot;useNewFormat&quot;: true
}</component>
<component name="CMakeReloadState">
<option name="reloaded" value="true" />
</component>
<component name="CMakeRunConfigurationManager">
<generated>
<config projectName="ros_merge_test" targetName="clean_test_results" />
<config projectName="ros_merge_test" targetName="roscpp_generate_messages_lisp" />
<config projectName="ros_merge_test" targetName="ros_merge_test_genlisp" />
<config projectName="ros_merge_test" targetName="std_msgs_generate_messages_cpp" />
<config projectName="ros_merge_test" targetName="doxygen" />
<config projectName="ros_merge_test" targetName="ros_merge_test_generate_messages_nodejs" />
<config projectName="ros_merge_test" targetName="ros_merge_test_generate_messages_py" />
<config projectName="ros_merge_test" targetName="roscpp_generate_messages_eus" />
<config projectName="ros_merge_test" targetName="gtest" />
<config projectName="ros_merge_test" targetName="ros_merge_test" />
<config projectName="ros_merge_test" targetName="geometry_msgs_generate_messages_lisp" />
<config projectName="ros_merge_test" targetName="roscpp_generate_messages_nodejs" />
<config projectName="ros_merge_test" targetName="_ros_merge_test_generate_messages_check_deps_RawImu" />
<config projectName="ros_merge_test" targetName="ros_merge_test_node" />
<config projectName="ros_merge_test" targetName="std_msgs_generate_messages_py" />
<config projectName="ros_merge_test" targetName="geometry_msgs_generate_messages_eus" />
<config projectName="ros_merge_test" targetName="gmock" />
<config projectName="ros_merge_test" targetName="ros_merge_test_generate_messages_cpp" />
<config projectName="ros_merge_test" targetName="rosgraph_msgs_generate_messages_eus" />
<config projectName="ros_merge_test" targetName="ros_merge_test_geneus" />
<config projectName="ros_merge_test" targetName="ros_merge_test_generate_messages_lisp" />
<config projectName="ros_merge_test" targetName="ros_merge_test_generate_messages" />
<config projectName="ros_merge_test" targetName="std_msgs_generate_messages_lisp" />
<config projectName="ros_merge_test" targetName="std_msgs_generate_messages_eus" />
<config projectName="ros_merge_test" targetName="geometry_msgs_generate_messages_nodejs" />
<config projectName="ros_merge_test" targetName="geometry_msgs_generate_messages_py" />
<config projectName="ros_merge_test" targetName="rosgraph_msgs_generate_messages_nodejs" />
<config projectName="ros_merge_test" targetName="ros_merge_test_genpy" />
<config projectName="ros_merge_test" targetName="ros_merge_test_gennodejs" />
<config projectName="ros_merge_test" targetName="roscpp_generate_messages_cpp" />
<config projectName="ros_merge_test" targetName="roscpp_generate_messages_py" />
<config projectName="ros_merge_test" targetName="gmock_main" />
<config projectName="ros_merge_test" targetName="download_extra_data" />
<config projectName="ros_merge_test" targetName="rosgraph_msgs_generate_messages_lisp" />
<config projectName="ros_merge_test" targetName="tests" />
<config projectName="ros_merge_test" targetName="rosgraph_msgs_generate_messages_py" />
<config projectName="ros_merge_test" targetName="gtest_main" />
<config projectName="ros_merge_test" targetName="geometry_msgs_generate_messages_cpp" />
<config projectName="ros_merge_test" targetName="ros_merge_test_generate_messages_eus" />
<config projectName="ros_merge_test" targetName="rosgraph_msgs_generate_messages_cpp" />
<config projectName="ros_merge_test" targetName="ros_merge_test_gencpp" />
<config projectName="ros_merge_test" targetName="std_msgs_generate_messages_nodejs" />
<config projectName="ros_merge_test" targetName="run_tests" />
</generated>
</component>
<component name="CMakeSettings">
<configurations>
<configuration PROFILE_NAME="Debug" ENABLED="true" CONFIG_NAME="Debug" />
</configurations>
</component>
<component name="ChangeListManager">
<list default="true" id="0bf55879-653f-4947-918d-118a5a4692cd" name="Changes" comment="" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ClangdSettings">
<option name="formatViaClangd" value="false" />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="CMakeBuildProfile:Debug" />
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../../../../.." />
</component>
<component name="ProjectApplicationVersion">
<option name="ide" value="CLion" />
<option name="majorVersion" value="2023" />
<option name="minorVersion" value="3.1" />
</component>
<component name="ProjectColorInfo">{
&quot;associatedIndex&quot;: 6
}</component>
<component name="ProjectId" id="2ZjzU9Fhdt9CDaS1bKhlnNSByng" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"RunOnceActivity.cidr.known.project.marker": "true",
"RunOnceActivity.readMode.enableVisualFormatting": "true",
"cf.first.check.clang-format": "false",
"cidr.known.project.marker": "true",
"git-widget-placeholder": "ArchRevise",
"last_opened_file_path": "/mnt/hgfs/GroupProject/Project_Ros1/src/ros_merge_test/CMakeLists.txt",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"vue.rearranger.settings.migration": "true"
}
}]]></component>
<component name="RunManager" selected="CMake Application.ros_merge_test_node">
<configuration name="_ros_merge_test_generate_messages_check_deps_RawImu" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="_ros_merge_test_generate_messages_check_deps_RawImu" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration default="true" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="clean_test_results" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="clean_test_results" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="download_extra_data" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="download_extra_data" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="doxygen" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="doxygen" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="geometry_msgs_generate_messages_cpp" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="geometry_msgs_generate_messages_cpp" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="geometry_msgs_generate_messages_eus" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="geometry_msgs_generate_messages_eus" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="geometry_msgs_generate_messages_lisp" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="geometry_msgs_generate_messages_lisp" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="geometry_msgs_generate_messages_nodejs" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="geometry_msgs_generate_messages_nodejs" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="geometry_msgs_generate_messages_py" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="geometry_msgs_generate_messages_py" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="gmock" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="gmock" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="gmock_main" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="gmock_main" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="gtest" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="gtest" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="gtest_main" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="gtest_main" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="ros_merge_test" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="ros_merge_test" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="ros_merge_test_gencpp" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="ros_merge_test_gencpp" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="ros_merge_test_generate_messages" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="ros_merge_test_generate_messages" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="ros_merge_test_generate_messages_cpp" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="ros_merge_test_generate_messages_cpp" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="ros_merge_test_generate_messages_eus" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="ros_merge_test_generate_messages_eus" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="ros_merge_test_generate_messages_lisp" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="ros_merge_test_generate_messages_lisp" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="ros_merge_test_generate_messages_nodejs" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="ros_merge_test_generate_messages_nodejs" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="ros_merge_test_generate_messages_py" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="ros_merge_test_generate_messages_py" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="ros_merge_test_geneus" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="ros_merge_test_geneus" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="ros_merge_test_genlisp" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="ros_merge_test_genlisp" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="ros_merge_test_gennodejs" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="ros_merge_test_gennodejs" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="ros_merge_test_genpy" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="ros_merge_test_genpy" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="ros_merge_test_node" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="ros_merge_test_node" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="ros_merge_test" RUN_TARGET_NAME="ros_merge_test_node">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="roscpp_generate_messages_cpp" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="roscpp_generate_messages_cpp" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="roscpp_generate_messages_eus" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="roscpp_generate_messages_eus" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="roscpp_generate_messages_lisp" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="roscpp_generate_messages_lisp" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="roscpp_generate_messages_nodejs" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="roscpp_generate_messages_nodejs" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="roscpp_generate_messages_py" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="roscpp_generate_messages_py" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="rosgraph_msgs_generate_messages_cpp" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="rosgraph_msgs_generate_messages_cpp" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="rosgraph_msgs_generate_messages_eus" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="rosgraph_msgs_generate_messages_eus" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="rosgraph_msgs_generate_messages_lisp" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="rosgraph_msgs_generate_messages_lisp" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="rosgraph_msgs_generate_messages_nodejs" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="rosgraph_msgs_generate_messages_nodejs" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="rosgraph_msgs_generate_messages_py" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="rosgraph_msgs_generate_messages_py" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="run_tests" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="run_tests" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="std_msgs_generate_messages_cpp" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="std_msgs_generate_messages_cpp" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="std_msgs_generate_messages_eus" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="std_msgs_generate_messages_eus" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="std_msgs_generate_messages_lisp" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="std_msgs_generate_messages_lisp" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="std_msgs_generate_messages_nodejs" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="std_msgs_generate_messages_nodejs" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="std_msgs_generate_messages_py" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="std_msgs_generate_messages_py" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration name="tests" type="CMakeRunConfiguration" factoryName="Application" REDIRECT_INPUT="false" ELEVATE="false" USE_EXTERNAL_CONSOLE="false" EMULATE_TERMINAL="false" PASS_PARENT_ENVS_2="true" PROJECT_NAME="ros_merge_test" TARGET_NAME="tests" CONFIG_NAME="Debug">
<method v="2">
<option name="com.jetbrains.cidr.execution.CidrBuildBeforeRunTaskProvider$BuildBeforeRunTask" enabled="true" />
</method>
</configuration>
<list>
<item itemvalue="CMake Application._ros_merge_test_generate_messages_check_deps_RawImu" />
<item itemvalue="CMake Application.clean_test_results" />
<item itemvalue="CMake Application.download_extra_data" />
<item itemvalue="CMake Application.doxygen" />
<item itemvalue="CMake Application.geometry_msgs_generate_messages_cpp" />
<item itemvalue="CMake Application.geometry_msgs_generate_messages_eus" />
<item itemvalue="CMake Application.geometry_msgs_generate_messages_lisp" />
<item itemvalue="CMake Application.geometry_msgs_generate_messages_nodejs" />
<item itemvalue="CMake Application.geometry_msgs_generate_messages_py" />
<item itemvalue="CMake Application.ros_merge_test" />
<item itemvalue="CMake Application.ros_merge_test_gencpp" />
<item itemvalue="CMake Application.ros_merge_test_generate_messages" />
<item itemvalue="CMake Application.ros_merge_test_generate_messages_cpp" />
<item itemvalue="CMake Application.ros_merge_test_generate_messages_eus" />
<item itemvalue="CMake Application.ros_merge_test_generate_messages_lisp" />
<item itemvalue="CMake Application.ros_merge_test_generate_messages_nodejs" />
<item itemvalue="CMake Application.ros_merge_test_generate_messages_py" />
<item itemvalue="CMake Application.ros_merge_test_geneus" />
<item itemvalue="CMake Application.ros_merge_test_genlisp" />
<item itemvalue="CMake Application.ros_merge_test_gennodejs" />
<item itemvalue="CMake Application.ros_merge_test_genpy" />
<item itemvalue="CMake Application.ros_merge_test_node" />
<item itemvalue="CMake Application.roscpp_generate_messages_cpp" />
<item itemvalue="CMake Application.roscpp_generate_messages_eus" />
<item itemvalue="CMake Application.roscpp_generate_messages_lisp" />
<item itemvalue="CMake Application.roscpp_generate_messages_nodejs" />
<item itemvalue="CMake Application.roscpp_generate_messages_py" />
<item itemvalue="CMake Application.rosgraph_msgs_generate_messages_cpp" />
<item itemvalue="CMake Application.rosgraph_msgs_generate_messages_eus" />
<item itemvalue="CMake Application.rosgraph_msgs_generate_messages_lisp" />
<item itemvalue="CMake Application.rosgraph_msgs_generate_messages_nodejs" />
<item itemvalue="CMake Application.rosgraph_msgs_generate_messages_py" />
<item itemvalue="CMake Application.run_tests" />
<item itemvalue="CMake Application.std_msgs_generate_messages_cpp" />
<item itemvalue="CMake Application.std_msgs_generate_messages_eus" />
<item itemvalue="CMake Application.std_msgs_generate_messages_lisp" />
<item itemvalue="CMake Application.std_msgs_generate_messages_nodejs" />
<item itemvalue="CMake Application.std_msgs_generate_messages_py" />
<item itemvalue="CMake Application.tests" />
<item itemvalue="CMake Application.gmock" />
<item itemvalue="CMake Application.gmock_main" />
<item itemvalue="CMake Application.gtest" />
<item itemvalue="CMake Application.gtest_main" />
</list>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="0bf55879-653f-4947-918d-118a5a4692cd" name="Changes" comment="" />
<created>1702950289245</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1702950289245</updated>
<workItem from="1702950290846" duration="445000" />
<workItem from="1702951008240" duration="308000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="VCPKGProject">
<isAutomaticCheckingOnLaunch value="false" />
<isAutomaticFoundErrors value="true" />
<isAutomaticReloadCMake value="true" />
</component>
</project>

View File

@ -32,7 +32,9 @@ include_directories(${CMAKE_SOURCE_DIR}/../3rdparty)
# opencv # opencv
# set(OpenCV_DIR ${CMAKE_SOURCE_DIR}/../3rdparty/opencv/opencv-linux-aarch64/share/OpenCV) # set(OpenCV_DIR ${CMAKE_SOURCE_DIR}/../3rdparty/opencv/opencv-linux-aarch64/share/OpenCV)
set(CMAKE_PREFIX_PATH "/home/luoruidi/Desktop/Package/opencv-4.8.1/build_arrch64")
find_package(OpenCV REQUIRED) find_package(OpenCV REQUIRED)
message("!!!!!Found OpenCV ${OpenCV_VERSION}")
#Threads #Threads
find_package(Threads REQUIRED) find_package(Threads REQUIRED)

View File

@ -24,7 +24,7 @@ private:
int img_channel = 0; int img_channel = 0;
const float nms_threshold = NMS_THRESH; // 默认的NMS阈值 const float nms_threshold = NMS_THRESH; // 默认的NMS阈值
const float box_conf_threshold = BOX_THRESH; // 默认的置信度阈值 const float box_conf_threshold = BOX_THRESH; // 默认的置信度阈值
char* model_name = "/home/firefly/rknpu2/examples/rknn_yolov5_demo/model/RK3588/yolov5s-640-640.rknn"; const char* model_name = "/home/firefly/rknpu2/examples/rknn_yolov5_demo/model/RK3588/yolov5s-640-640.rknn";
cv::Mat orig_img; cv::Mat orig_img;
rknn_input_output_num io_num; rknn_input_output_num io_num;
@ -42,7 +42,7 @@ public:
Detection(); Detection();
static unsigned char *load_data(FILE *fp, size_t ofst, size_t sz); static unsigned char *load_data(FILE *fp, size_t ofst, size_t sz);
static unsigned char *load_model(const char *filename, int *model_size); static unsigned char *load_model(const char *filename, int *model_size);
detect_result_group_t outputParse(cv::Mat netInputImg); detect_result_group_t outputParse(cv::Mat& netInputImg);
}; };

View File

@ -7,6 +7,12 @@
#include <vector> #include <vector>
#include "detection.h" #include "detection.h"
#include <unistd.h> #include <unistd.h>
#include <math.h>
#include <stdlib.h>
#include <iostream>
#include <stdio.h>
#include <mutex>
using namespace cv; using namespace cv;
@ -18,7 +24,7 @@ private:
cv::VideoCapture vcapture; cv::VideoCapture vcapture;
Detection yolov5s; Detection yolov5s;
//new // projection matrix
Mat cam_matrix_left = (Mat_<double>(3, 3) << Mat cam_matrix_left = (Mat_<double>(3, 3) <<
4.809895643547006e+02, 0, 0, 4.809895643547006e+02, 0, 0,
0,4.807599168204821e+02, 0, 0,4.807599168204821e+02, 0,
@ -27,6 +33,8 @@ private:
4.903260126250775e+02, 0, 0, 4.903260126250775e+02, 0, 0,
0,4.900310486342847e+02, 0, 0,4.900310486342847e+02, 0,
3.230124997386542e+02, 2.346297967642670e+02, 1); 3.230124997386542e+02, 2.346297967642670e+02, 1);
// distortion
Mat distortion_l = (Mat_<double>(1, 5) <<0.113688825569154,-0.106166584327678, 0, Mat distortion_l = (Mat_<double>(1, 5) <<0.113688825569154,-0.106166584327678, 0,
0, 0); 0, 0);
@ -52,5 +60,11 @@ public:
std::vector<float> pic2cam(int u, int v); std::vector<float> pic2cam(int u, int v);
std::vector<int> muban(cv::Mat &left_image, cv::Mat &right_image, const int *coordinates); std::vector<int> muban(cv::Mat &left_image, cv::Mat &right_image, const int *coordinates);
std::vector<cv::Mat> detObjectRanging(); std::vector<cv::Mat> detObjectRanging();
void horizon_estimate(cv::Mat& img, cv::Mat& bboxs,int k); //void horizon_estimate(cv::Mat& img, cv::Mat& bboxs,int k);
std::mutex g_mutex;
private:
void drawDetectBox(cv::Mat &target_frame , const detect_result_group_t& detect_res, cv::Mat& detBoxs_data);
void frameRateShow(cv::Mat &current_frame , int64 time);
}; };

View File

@ -0,0 +1,80 @@
person
bicycle
car
motorcycle
airplane
bus
train
truck
boat
traffic light
fire hydrant
stop sign
parking meter
bench
bird
cat
dog
horse
sheep
cow
elephant
bear
zebra
giraffe
backpack
umbrella
handbag
tie
suitcase
frisbee
skis
snowboard
sports ball
kite
baseball bat
baseball glove
skateboard
surfboard
tennis racket
bottle
wine glass
cup
fork
knife
spoon
bowl
banana
apple
sandwich
orange
broccoli
carrot
hot dog
pizza
donut
cake
chair
couch
potted plant
bed
dining table
toilet
tv
laptop
mouse
remote
keyboard
cell phone
microwave
oven
toaster
sink
refrigerator
book
clock
vase
scissors
teddy bear
hair drier
toothbrush

View File

@ -142,7 +142,7 @@ Detection::Detection()
} }
// 这个地方采用直接传值,会影响性能 // 这个地方采用直接传值,会影响性能
detect_result_group_t Detection::outputParse(cv::Mat netInputImg) detect_result_group_t Detection::outputParse(cv::Mat& netInputImg)
{ {
orig_img = netInputImg.clone(); orig_img = netInputImg.clone();

View File

@ -4,58 +4,55 @@
* Date of Issued : 2024.01.96 zhanli@review * Date of Issued : 2024.01.96 zhanli@review
* Comments : UPbot * Comments : UPbot
********************************************************************************/ ********************************************************************************/
#include <iostream>
#include <stdio.h> #include <stdio.h>
// #include "lidar.h"
// #include <ros/ros.h>
// #include <sensor_msgs/LaserScan.h>
#include <opencv2/opencv.hpp>
#include "ranging.h" #include "ranging.h"
// #include "fusion.h"
#include <string>
#include <pthread.h> #include <pthread.h>
#include <mutex> #include <mutex>
#include <sys/time.h>
// #include "detection.h"
/*#include <cv_bridge/cv_bridge.h>
#include <image_transport/image_transport.h>*/
#include "opencv2/imgcodecs/imgcodecs.hpp" #include "opencv2/imgcodecs/imgcodecs.hpp"
#include <ctime>
#include <queue> #include <queue>
#define ANGLE_TO_RADIAN(angle) ((angle)*3141.59 / 180000) #define ANGLE_TO_RADIAN(angle) ((angle)*3141.59 / 180000)
Ranging r(12, 640, 480); //Ranging r(12, 640, 480);
std::queue<std::vector<cv::Mat>> frameInfo; std::queue<std::vector<cv::Mat>> frameInfo;
std::mutex g_mutex; //std::mutex g_mutex; /// 这个mutxt 应该属于ranging
/**--------------------------------------------------------------------- /**---------------------------------------------------------------------
* Function : RangingNodeTask * Function : RangingNodeTask
* Description : * Description : [TODO: ranging]
* Author : hongchuyuan * Author : hongchuyuan
* Date : 2023/12/13 zhanli@review 719901725@qq.com * Date : 2023/12/13 zhanli@review 719901725@qq.com
*---------------------------------------------------------------------**/ *---------------------------------------------------------------------**/
void *RangingNodeTask(void *args) void* RangingNodeTask(void* arg)
{ {
Ranging& r = *static_cast<Ranging*>(arg);
while (true) while (true)
{ {
// std::cout<<" ************ enter ranging *********** "<<std::endl;
std::vector<cv::Mat> result = r.detObjectRanging(); std::vector<cv::Mat> result = r.detObjectRanging();
g_mutex.lock(); r.g_mutex.lock();
for (uchar i = 0; i < frameInfo.size(); i++) // 只保存当前最新的图片帧信息 for (uchar i = 0; i < frameInfo.size(); i++) // 只保存当前最新的图片帧信息{如果只保存一当前frame完全不需要队列}
frameInfo.pop(); frameInfo.pop();
frameInfo.push(result); frameInfo.push(result);
g_mutex.unlock(); r.g_mutex.unlock();
} }
} }
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
pthread_t tids[1]; // 执行ranging线程 Ranging r(12, 640, 480);
int ret = pthread_create(&tids[0], NULL, RangingNodeTask, NULL); pthread_t trd_ranging; // 执行ranging线程
while(1){ if( pthread_create(&trd_ranging,NULL, RangingNodeTask , &r) != 0)
usleep(150000); {
std::cout << "can not init rangging thread" << std::endl;
} }
if( pthread_join(trd_ranging,NULL)!=0 )
{
std::cout << "Error join thread 1" << std::endl;
}
return 0; return 0;
} }

View File

@ -5,33 +5,13 @@
* Date of Issued : 2024.01.07 zhanli@review * Date of Issued : 2024.01.07 zhanli@review
* Comments : OpenCV * Comments : OpenCV
********************************************************************************/ ********************************************************************************/
#include <iostream>
#include <stdio.h>
#include "ranging.h" #include "ranging.h"
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <dlfcn.h>
// OpenCV相关 // OpenCV相关
#include "opencv2/core.hpp" #include "opencv2/core.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/imgproc.hpp" #include "opencv2/imgproc.hpp"
#include <opencv2/opencv.hpp>
#include <opencv2/highgui.hpp> #include <opencv2/highgui.hpp>
#include <sys/stat.h>
#include <sys/types.h>
#include <dirent.h>
#include <vector>
#include <tuple>
#include <string>
#include <algorithm>
// 上面重复无用的头文件应该删除
// #include <ros/ros.h>
using namespace cv; using namespace cv;
// 重映射函数 // 重映射函数
@ -52,6 +32,7 @@ std::vector<float> Ranging::pic2cam(int u, int v)
} }
// 模板匹配 // 模板匹配
// 在右图像 right_image 中定位左图像中已检测到的目标框的位置。
std::vector<int> Ranging::muban(Mat &left_image, Mat &right_image, const int *coordinates) std::vector<int> Ranging::muban(Mat &left_image, Mat &right_image, const int *coordinates)
{ {
int x1 = coordinates[0], y1 = coordinates[1], x2 = coordinates[2], y2 = coordinates[3]; int x1 = coordinates[0], y1 = coordinates[1], x2 = coordinates[2], y2 = coordinates[3];
@ -90,7 +71,7 @@ std::vector<int> Ranging::muban(Mat &left_image, Mat &right_image, const int *co
return maxloc; return maxloc;
} }
// 这个函数暂时不知道作用 /*
void Ranging::horizon_estimate(Mat& img, Mat& bboxs,int k) void Ranging::horizon_estimate(Mat& img, Mat& bboxs,int k)
{ {
//保证摄像头与地面平行 //保证摄像头与地面平行
@ -154,15 +135,14 @@ void Ranging::horizon_estimate(Mat& img, Mat& bboxs,int k)
this->Z = Z.clone(); this->Z = Z.clone();
} }
*/
void Ranging::getInfo(Mat &imgL, Mat &imgR, Mat &detBoxes, Mat &info) void Ranging::getInfo(Mat &imgL, Mat &imgR, Mat &detBoxes, Mat &info)
{ {
Mat imgGrayL, imgGrayR; Mat imgGrayL, imgGrayR;
cvtColor(imgL, imgGrayL, COLOR_BGR2GRAY); cvtColor(imgL, imgGrayL, COLOR_BGR2GRAY);
cvtColor(imgR, imgGrayR, COLOR_BGR2GRAY); cvtColor(imgR, imgGrayR, COLOR_BGR2GRAY);
// 优化这个地方的imgR_weight没有起到任何作用
// 纯粹浪费CPU计算了
Mat imgR_weight = imgR.clone();
Mat infoRow; Mat infoRow;
for (uchar i = 0; i < detBoxes.rows; i++) for (uchar i = 0; i < detBoxes.rows; i++)
@ -290,7 +270,8 @@ Ranging::Ranging(int index, int imgw, int imgh) : //初始化
mapY2(imgh, imgw, CV_64F), mapY2(imgh, imgw, CV_64F),
q(4, 4, CV_64F), q(4, 4, CV_64F),
imgw(imgw), imgw(imgw),
imgh(imgh) imgh(imgh),
g_mutex(),detect_result_group()
{ {
// Z = Mat::zeros(2, 1, CV_32FC1); // Z = Mat::zeros(2, 1, CV_32FC1);
vcapture = cv::VideoCapture(index); vcapture = cv::VideoCapture(index);
@ -352,13 +333,36 @@ std::vector<Mat> Ranging::detObjectRanging()
if (detect_result_group.count<=0) if (detect_result_group.count<=0)
{ {
std::cout<<"detect nothing"<<std::endl; std::cout<<"detect nothing"<<std::endl;
return std::vector<Mat>{};
} }
// 定义矩阵,存储目标检测内容,存储格式(x,y,x,y,conf,cls) // 定义矩阵,存储目标检测内容,存储格式(x,y,x,y,conf,cls)
Mat detBoxes(detect_result_group.count, 5, CV_32F); Mat detBoxes(detect_result_group.count, 5, CV_32F);
char text[256]; drawDetectBox(Rframe,detect_result_group,detBoxes);
// 存储目标检测内容 (x,y,x,y,conf,cls)
// 存储测距信息存储格式距离d宽w高h角度alpha
Mat info(detect_result_group.count, 4, CV_32F);
// 如果有检测目标
if (detect_result_group.count)
{
// getInffpso()修改为calObjectRanging()
// 在这里测量目标的距离并存储到info中
// 优化:这个地方重复的将左右视图转换为灰度图浪费CPU的算力
getInfo(lframe, rframe, detBoxes, info);
}
t = getTickCount() - t;
frameRateShow(Rframe , t);
return std::vector<Mat>{rframe, detBoxes, info};
}
return std::vector<Mat>{rframe};
}
void Ranging::drawDetectBox(Mat &target_frame, const detect_result_group_t &detect_res ,cv::Mat& detBoxs_data) {
char text[256];
// 这里应该写一个函数drawDetectBobox() // 这里应该写一个函数drawDetectBobox()
for (int i = 0; i < detect_result_group.count; i++) for (int i = 0; i < detect_result_group.count; i++)
{ {
@ -373,15 +377,15 @@ std::vector<Mat> Ranging::detObjectRanging()
int xmax = det_result->box.right; int xmax = det_result->box.right;
int ymax = det_result->box.bottom; int ymax = det_result->box.bottom;
rectangle(Rframe, cv::Point(xmin, ymin), cv::Point(xmax, ymax), cv::Scalar(256, 0, 0, 256), 3); rectangle(target_frame, cv::Point(xmin, ymin), cv::Point(xmax, ymax), cv::Scalar(256, 0, 0, 256), 3);
putText(Rframe, text, cv::Point(xmin, ymin + 12), cv::FONT_HERSHEY_SIMPLEX, 0.4, cv::Scalar(255, 255, 255)); putText(target_frame, text, cv::Point(xmin, ymin + 12), cv::FONT_HERSHEY_SIMPLEX, 0.4, cv::Scalar(255, 255, 255));
// (x,y) (x,y) conf // (x,y) (x,y) conf
detBoxes.at<float>(i, 0) = xmin; detBoxs_data.at<float>(i, 0) = xmin;
detBoxes.at<float>(i, 1) = ymin; detBoxs_data.at<float>(i, 1) = ymin;
detBoxes.at<float>(i, 2) = xmax; detBoxs_data.at<float>(i, 2) = xmax;
detBoxes.at<float>(i, 3) = ymax; detBoxs_data.at<float>(i, 3) = ymax;
detBoxes.at<float>(i, 4) = det_result->prop; detBoxs_data.at<float>(i, 4) = det_result->prop;
// 实验测试,过滤过大的误检框 // 实验测试,过滤过大的误检框
// float ratio = (xmax - xmin) * (ymax - ymin) / 308480.; // float ratio = (xmax - xmin) * (ymax - ymin) / 308480.;
// if (ratio > 0.7) // if (ratio > 0.7)
@ -390,52 +394,13 @@ std::vector<Mat> Ranging::detObjectRanging()
// continue; // continue;
// } // }
} }
}
// 存储测距信息存储格式距离d宽w高h角度alpha
Mat info(detect_result_group.count, 4, CV_32F); void Ranging::frameRateShow(Mat &frame, int64 time) {
char fps[50];
// 如果有检测目标 sprintf(fps, "fps: %d", int(1 / (time / getTickFrequency())));
if (detect_result_group.count) putText( frame, fps, Point(20, 20), FONT_HERSHEY_PLAIN, 1, Scalar(0, 0, 255), 1.5);
{
// getInfo()修改为calObjectRanging() cv::imshow("k", frame);
// 在这里测量目标的距离并存储到info中 cv::waitKey(1);
// 优化:这个地方重复的将左右视图转换为灰度图浪费CPU的算力
getInfo(lframe, rframe, detBoxes, info);
//show stereo distance
//zai zhe li kai ke neng cheng xu hui beng le
// for(int i=0; i<info.rows;i++)
// {
// detect_result_t *det_result = &(detect_result_group.results[i]);
// float median = info.at<float>(i, 0);
// float w1 = info.at<float>(i, 1);
// float h1 = info.at<float>(i, 2);
// float alfa = info.at<float>(i, 3);
// int x1 = det_result->box.left;
// int y1 = det_result->box.top;
// int x2 = det_result->box.right;
// int y2 = det_result->box.bottom;
// char dc[50], wh[50];
// sprintf(dc, "dis:%.2fcm ", median);
// sprintf(wh, "W: %.2fcm H: %.2fcm ", w1, h1);
// putText(Rframe, dc, Point(x1, y2), FONT_HERSHEY_PLAIN, 1.5, Scalar(0, 0, 255), 2);
// putText(Rframe, wh, Point(x1, y1), FONT_HERSHEY_PLAIN, 1.5, Scalar(0, 0, 255), 1.5);
// }
}
// 这个地方应该整为一个函数,负责显示帧率图像
t = getTickCount() - t;
char fps[50];
sprintf(fps, "fps: %d", int(1 / (t / getTickFrequency())));
putText(Rframe, fps, Point(20, 20), FONT_HERSHEY_PLAIN, 1, Scalar(0, 0, 255), 1.5);
cv::imshow("k",Rframe);
cv::waitKey(1);
return std::vector<Mat>{rframe, detBoxes, info};
}
return std::vector<Mat>{rframe};
} }