1
0
Fork 2

Compare commits

...

1 Commits

Author SHA1 Message Date
LuoRuidi 8adc159564 LRD_Revise
仅测试编译通过,尚未运行
2024-01-15 20:00:34 +08:00
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线程
if( pthread_create(&trd_ranging,NULL, RangingNodeTask , &r) != 0)
{
std::cout << "can not init rangging thread" << std::endl;
}
if( pthread_join(trd_ranging,NULL)!=0 )
{
std::cout << "Error join thread 1" << std::endl;
}
while(1){
usleep(150000);
}
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++)
@ -176,54 +156,54 @@ void Ranging::getInfo(Mat &imgL, Mat &imgR, Mat &detBoxes, Mat &info)
float Conf = detBoxes.at<float>(i, 4); float Conf = detBoxes.at<float>(i, 4);
int cls = detBoxes.at<float>(i, 5); int cls = detBoxes.at<float>(i, 5);
// 当目标框偏左、偏右或者过大,略去该物体 // 当目标框偏左、偏右或者过大,略去该物体
if (x1 > 600 || x2 < 50 || y1 < 5 || y2 > 475 || x1 < 2 || x2 > 590 || abs(x2 - x1) > 550) { if (x1 > 600 || x2 < 50 || y1 < 5 || y2 > 475 || x1 < 2 || x2 > 590 || abs(x2 - x1) > 550) {
continue; continue;
} }
// 绘制目标框 // 绘制目标框
rectangle(imgR, Point(int(x1), int(y1)),Point(int(x2), int(y2)), Scalar(0, 0, 255)); rectangle(imgR, Point(int(x1), int(y1)),Point(int(x2), int(y2)), Scalar(0, 0, 255));
// 检测的是右图,利用模板匹配去找左图的位置 // 检测的是右图,利用模板匹配去找左图的位置
int coordinates[4] = {x1, y1, x2, y2}; int coordinates[4] = {x1, y1, x2, y2};
// 模板匹配 // 模板匹配
std::vector<int> disp_pixel = muban(imgGrayL, imgGrayR, coordinates); std::vector<int> disp_pixel = muban(imgGrayL, imgGrayR, coordinates);
// 这里用disp_x 有点奇怪用dispDiffX // 这里用disp_x 有点奇怪用dispDiffX
// 计算水平视差 左图匹配的x坐标和右图的x坐标之差 // 计算水平视差 左图匹配的x坐标和右图的x坐标之差
float disp_pixel_x = disp_pixel[0] - x1; float disp_pixel_x = disp_pixel[0] - x1;
// 垂直的误差没有起到作用 // 垂直的误差没有起到作用
float disp_pixel_y = disp_pixel[1] - y1; float disp_pixel_y = disp_pixel[1] - y1;
// 0.12为模板匹配产生的误差,为经验值,通过拟合得到 // 0.12为模板匹配产生的误差,为经验值,通过拟合得到
disp_pixel_x = (int)(disp_pixel_x + disp_pixel_x * 0.12); disp_pixel_x = (int)(disp_pixel_x + disp_pixel_x * 0.12);
//Mat disp_matrix = Mat(1, 1, CV_32F, Scalar(disp_pixel_x)), disp_pixel_xyz; //Mat disp_matrix = Mat(1, 1, CV_32F, Scalar(disp_pixel_x)), disp_pixel_xyz;
// 定义视差矩阵,所有值均为水平视差,方便转换为三维坐标,并具有水平距离信息 // 定义视差矩阵,所有值均为水平视差,方便转换为三维坐标,并具有水平距离信息
Mat disp_matrix = Mat(imgGrayL.rows, imgGrayL.cols, CV_32F, Scalar(disp_pixel_x)); Mat disp_matrix = Mat(imgGrayL.rows, imgGrayL.cols, CV_32F, Scalar(disp_pixel_x));
Mat threed_pixel_xyz, threedImage; Mat threed_pixel_xyz, threedImage;
// 通过quat将显示图像从2d映射到3d // 通过quat将显示图像从2d映射到3d
reprojectImageTo3D(disp_matrix, threedImage, q, false); reprojectImageTo3D(disp_matrix, threedImage, q, false);
// 图像的3个通道每一像素点求平方 // 图像的3个通道每一像素点求平方
threed_pixel_xyz = threedImage.mul(threedImage); threed_pixel_xyz = threedImage.mul(threedImage);
std::vector<Mat> channels; std::vector<Mat> channels;
// 求平方后的结果分离为3个通道然后求和即是欧式距离 // 求平方后的结果分离为3个通道然后求和即是欧式距离
split(threed_pixel_xyz.clone(), channels); split(threed_pixel_xyz.clone(), channels);
// 计算欧式距离 = r^2 + g^2 + b^2 // 计算欧式距离 = r^2 + g^2 + b^2
threed_pixel_xyz = channels[0] + channels[1] + channels[2]; threed_pixel_xyz = channels[0] + channels[1] + channels[2];
threed_pixel_xyz.forEach<float>([](float &value, const int *position) { value = sqrt(value); }); // 获得距离d threed_pixel_xyz.forEach<float>([](float &value, const int *position) { value = sqrt(value); }); // 获得距离d
int mid_pixel = int((x1 + x2) / 2); int mid_pixel = int((x1 + x2) / 2);
// 计算角度,从像素坐标转为相机坐标 // 计算角度,从像素坐标转为相机坐标
// 这里用结构体比用vector更加节省CPU运算 // 这里用结构体比用vector更加节省CPU运算
std::vector<float> mid = pic2cam(imgGrayR.cols / 2, imgGrayR.rows); std::vector<float> mid = pic2cam(imgGrayR.cols / 2, imgGrayR.rows);
std::vector<float> loc_tar = pic2cam(mid_pixel, imgGrayR.rows); std::vector<float> loc_tar = pic2cam(mid_pixel, imgGrayR.rows);
float alfa = atan((loc_tar[0] - mid[0]) / q.at<double>(2, 3)); float alfa = atan((loc_tar[0] - mid[0]) / q.at<double>(2, 3));
// 距离太近,视差过大 // 距离太近,视差过大
if (disp_pixel_x > 240) if (disp_pixel_x > 240)
{ {
char cm[15]; char cm[15];
//sprintf(cm, "cannot match !"); //sprintf(cm, "cannot match !");
@ -273,7 +253,7 @@ void Ranging::getInfo(Mat &imgL, Mat &imgR, Mat &detBoxes, Mat &info)
// sprintf(wh, "W: %.2fcm H: %.2fcm alfa: %2f", w1, h1, alfa); // sprintf(wh, "W: %.2fcm H: %.2fcm alfa: %2f", w1, h1, alfa);
// putText(imgR, dc, Point(x1, y2), FONT_HERSHEY_PLAIN, 1.5, Scalar(0, 0, 255), 2); // putText(imgR, dc, Point(x1, y2), FONT_HERSHEY_PLAIN, 1.5, Scalar(0, 0, 255), 2);
// putText(imgR, wh, Point(x1, y1), FONT_HERSHEY_PLAIN, 1.5, Scalar(0, 0, 255), 1.5); // putText(imgR, wh, Point(x1, y1), FONT_HERSHEY_PLAIN, 1.5, Scalar(0, 0, 255), 1.5);
//返回数据 //返回数据
infoRow = (Mat_<float>(1, 4) << median, w1, h1, alfa); infoRow = (Mat_<float>(1, 4) << median, w1, h1, alfa);
infoRow.copyTo(info.row(i)); infoRow.copyTo(info.row(i));
@ -284,13 +264,14 @@ void Ranging::getInfo(Mat &imgL, Mat &imgR, Mat &detBoxes, Mat &info)
} }
Ranging::Ranging(int index, int imgw, int imgh) : //初始化 Ranging::Ranging(int index, int imgw, int imgh) : //初始化
mapX1(imgh, imgw, CV_64F), //初始化矩阵 ,用于计算无畸变和修正转换映射。 mapX1(imgh, imgw, CV_64F), //初始化矩阵 ,用于计算无畸变和修正转换映射。
mapX2(imgh, imgw, CV_64F), mapX2(imgh, imgw, CV_64F),
mapY1(imgh, imgw, CV_64F), mapY1(imgh, imgw, CV_64F),
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);
@ -309,7 +290,7 @@ Ranging::Ranging(int index, int imgw, int imgh) : //初始化
imgSize, rotate.t(), trans, r1, r2, p1, p2, q); imgSize, rotate.t(), trans, r1, r2, p1, p2, q);
// 计算无畸变和修正转换映射 // 计算无畸变和修正转换映射
initUndistortRectifyMap(cam_matrix_left.t(), distortion_l, r1, p1, imgSize, CV_32F, mapX1, mapX2); initUndistortRectifyMap(cam_matrix_left.t(), distortion_l, r1, p1, imgSize, CV_32F, mapX1, mapX2);
// 计算无畸变和修正转换映射 // 计算无畸变和修正转换映射
initUndistortRectifyMap(cam_matrix_right.t(), distortion_r, r2, p2, imgSize, CV_32F, mapY1, mapY2); initUndistortRectifyMap(cam_matrix_right.t(), distortion_r, r2, p2, imgSize, CV_32F, mapY1, mapY2);
@ -323,7 +304,7 @@ Ranging::Ranging(int index, int imgw, int imgh) : //初始化
* Author : hongchuyuan * Author : hongchuyuan
* Date : 2023/12/13 zhanli@review 719901725@qq.com * Date : 2023/12/13 zhanli@review 719901725@qq.com
*---------------------------------------------------------------------**/ *---------------------------------------------------------------------**/
std::vector<Mat> Ranging::detObjectRanging() std::vector<Mat> Ranging::detObjectRanging()
{ {
double rang_old, rang_now; double rang_old, rang_now;
@ -338,11 +319,11 @@ std::vector<Mat> Ranging::detObjectRanging()
{ {
int64 t = getTickCount(); int64 t = getTickCount();
// 拷贝左图 // 拷贝左图
Mat lframe(frame.colRange(0, imgw).clone()); Mat lframe(frame.colRange(0, imgw).clone());
// 拷贝右图 // 拷贝右图
Mat rframe(frame.colRange(imgw, imgw * 2).clone()); Mat rframe(frame.colRange(imgw, imgw * 2).clone());
rectifyImage(lframe, rframe); rectifyImage(lframe, rframe);
// 这里拷贝一次然后再yolo里面再拷贝一次以及函数传参也拷贝了一次? // 这里拷贝一次然后再yolo里面再拷贝一次以及函数传参也拷贝了一次?
cv::Mat Rframe = rframe.clone(); cv::Mat Rframe = rframe.clone();
@ -352,90 +333,74 @@ 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)
// 这里应该写一个函数drawDetectBobox()
for (int i = 0; i < detect_result_group.count; i++)
{
detect_result_t *det_result = &(detect_result_group.results[i]);
sprintf(text, "%s %.1f%%", det_result->name, det_result->prop * 100);
// printf("%s @ (%d %d %d %d) %f\n", det_result->name, det_result->box.left, det_result->box.top,
// det_result->box.right, det_result->box.bottom, det_result->prop);
int xmin = det_result->box.left;
int ymin = det_result->box.top;
int xmax = det_result->box.right;
int ymax = det_result->box.bottom;
rectangle(Rframe, 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));
// (x,y) (x,y) conf
detBoxes.at<float>(i, 0) = xmin;
detBoxes.at<float>(i, 1) = ymin;
detBoxes.at<float>(i, 2) = xmax;
detBoxes.at<float>(i, 3) = ymax;
detBoxes.at<float>(i, 4) = det_result->prop;
// 实验测试,过滤过大的误检框
// float ratio = (xmax - xmin) * (ymax - ymin) / 308480.;
// if (ratio > 0.7)
// {
// detBoxes.at<float>(i, 5) = -1;
// continue;
// }
}
// 存储测距信息存储格式距离d宽w高h角度alpha // 存储测距信息存储格式距离d宽w高h角度alpha
Mat info(detect_result_group.count, 4, CV_32F); Mat info(detect_result_group.count, 4, CV_32F);
// 如果有检测目标 // 如果有检测目标
if (detect_result_group.count) if (detect_result_group.count)
{ {
// getInfo()修改为calObjectRanging() // getInffpso()修改为calObjectRanging()
// 在这里测量目标的距离并存储到info中 // 在这里测量目标的距离并存储到info中
// 优化:这个地方重复的将左右视图转换为灰度图浪费CPU的算力 // 优化:这个地方重复的将左右视图转换为灰度图浪费CPU的算力
getInfo(lframe, rframe, detBoxes, info); 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; t = getTickCount() - t;
char fps[50]; frameRateShow(Rframe , t);
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, detBoxes, info};
} }
return std::vector<Mat>{rframe}; 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()
for (int i = 0; i < detect_result_group.count; i++)
{
detect_result_t *det_result = &(detect_result_group.results[i]);
sprintf(text, "%s %.1f%%", det_result->name, det_result->prop * 100);
// printf("%s @ (%d %d %d %d) %f\n", det_result->name, det_result->box.left, det_result->box.top,
// det_result->box.right, det_result->box.bottom, det_result->prop);
int xmin = det_result->box.left;
int ymin = det_result->box.top;
int xmax = det_result->box.right;
int ymax = det_result->box.bottom;
rectangle(target_frame, cv::Point(xmin, ymin), cv::Point(xmax, ymax), cv::Scalar(256, 0, 0, 256), 3);
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
detBoxs_data.at<float>(i, 0) = xmin;
detBoxs_data.at<float>(i, 1) = ymin;
detBoxs_data.at<float>(i, 2) = xmax;
detBoxs_data.at<float>(i, 3) = ymax;
detBoxs_data.at<float>(i, 4) = det_result->prop;
// 实验测试,过滤过大的误检框
// float ratio = (xmax - xmin) * (ymax - ymin) / 308480.;
// if (ratio > 0.7)
// {
// detBoxes.at<float>(i, 5) = -1;
// continue;
// }
}
}
void Ranging::frameRateShow(Mat &frame, int64 time) {
char fps[50];
sprintf(fps, "fps: %d", int(1 / (time / getTickFrequency())));
putText( frame, fps, Point(20, 20), FONT_HERSHEY_PLAIN, 1, Scalar(0, 0, 255), 1.5);
cv::imshow("k", frame);
cv::waitKey(1);
}