diff --git a/capture_save.py b/capture_save.py index 5824b51..bc0d65f 100644 --- a/capture_save.py +++ b/capture_save.py @@ -1,7 +1,7 @@ import cv2 key = cv2. waitKey(1) -webcam = cv2.VideoCapture('rtsp://admin:artpark123@192.168.0.219/4') #replace 0 with the IP URL of the streaming camera +webcam = cv2.VideoCapture('rtsp://admin:artpark123@192.168.0.219/1') #replace 0 with the IP URL of the streaming camera while True: try: check, frame = webcam.read() @@ -16,16 +16,7 @@ img_new = cv2.imshow("Captured Image", img_new) cv2.waitKey(1650) cv2.destroyAllWindows() - print("Processing image...") - img_ = cv2.imread('saved_img.jpg', cv2.IMREAD_ANYCOLOR) - print("Converting RGB image to grayscale...") - gray = cv2.cvtColor(img_, cv2.COLOR_BGR2GRAY) - print("Converted RGB image to grayscale...") - print("Resizing image to 28x28 scale...") - img_ = cv2.resize(gray,(28,28)) - print("Resized...") - img_resized = cv2.imwrite(filename='saved_img-final.jpg', img=img_) - print("Image saved!") + break elif key == ord('q'): diff --git a/catkin_ws/build/CMakeCache.txt b/catkin_ws/build/CMakeCache.txt index 19a0e19..0fa9bc9 100644 --- a/catkin_ws/build/CMakeCache.txt +++ b/catkin_ws/build/CMakeCache.txt @@ -14,12 +14,27 @@ # EXTERNAL cache entries ######################## +//Build debug target (ON) or release (OFF) +BUILD_DEBUG_TARGET:BOOL=ON + //Builds the googlemock subproject BUILD_GMOCK:BOOL=ON +//Build sick_scan library with function hiding except for SickScanApi-functions +// (ON) or without function hiding (OFF) +BUILD_LIB_HIDE_FUNCTIONS:BOOL=OFF + //Build dynamically-linked binaries BUILD_SHARED_LIBS:BOOL=ON +//Build sick_scan with LDMRS support (ON, libsick_ldmrs from https://github.com/SICKAG/libsick_ldmrs +// required) or without LDMRS support (OFF) +BUILD_WITH_LDMRS_SUPPORT:BOOL=ON + +//Build sick_scan with SCANSEGMENT_XD support (ON) or without SCANSEGMENT_XD +// support (OFF) +BUILD_WITH_SCANSEGMENT_XD_SUPPORT:BOOL=ON + //List of ';' separated packages to exclude CATKIN_BLACKLIST_PACKAGES:STRING= @@ -306,6 +321,10 @@ EMPY_EXECUTABLE:FILEPATH=EMPY_EXECUTABLE-NOTFOUND //Empy script EMPY_SCRIPT:STRING=/usr/lib/python3/dist-packages/em.py +//Build emulator for offline and unittests (ON) or without emulator +// (OFF) +ENABLE_EMULATOR:BOOL=OFF + //Path to a library. GMOCK_LIBRARY:FILEPATH=GMOCK_LIBRARY-NOTFOUND @@ -352,6 +371,9 @@ LSB_RELEASE_EXECUTABLE:FILEPATH=/usr/bin/lsb_release //Path to a program. NOSETESTS:FILEPATH=/usr/bin/nosetests3 +//pkg-config executable +PKG_CONFIG_EXECUTABLE:FILEPATH=/usr/bin/pkg-config + //Path to a program. PYTHON_EXECUTABLE:FILEPATH=/usr/bin/python3 @@ -397,6 +419,9 @@ SETUPTOOLS_DEB_LAYOUT:BOOL=ON //Name of the computer/site where compile is being run SITE:STRING=rbccps-2080 +//The directory containing a CMake configuration file for SickLDMRS. +SickLDMRS_DIR:PATH=SickLDMRS_DIR-NOTFOUND + //LSB Distrib tag UBUNTU:BOOL=TRUE @@ -433,6 +458,15 @@ cpp_common_DIR:PATH=/opt/ros/noetic/share/cpp_common/cmake //The directory containing a CMake configuration file for cv_bridge. cv_bridge_DIR:PATH=/opt/ros/noetic/share/cv_bridge/cmake +//The directory containing a CMake configuration file for diagnostic_msgs. +diagnostic_msgs_DIR:PATH=/opt/ros/noetic/share/diagnostic_msgs/cmake + +//The directory containing a CMake configuration file for diagnostic_updater. +diagnostic_updater_DIR:PATH=/opt/ros/noetic/share/diagnostic_updater/cmake + +//The directory containing a CMake configuration file for dynamic_reconfigure. +dynamic_reconfigure_DIR:PATH=/opt/ros/noetic/share/dynamic_reconfigure/cmake + //The directory containing a CMake configuration file for gencpp. gencpp_DIR:PATH=/opt/ros/noetic/share/gencpp/cmake @@ -510,7 +544,7 @@ interactive_markers_DIR:PATH=/opt/ros/noetic/share/interactive_markers/cmake laser_geometry_DIR:PATH=/opt/ros/noetic/share/laser_geometry/cmake //Path to a library. -lib:FILEPATH=/opt/ros/noetic/lib/libroscpp_serialization.so +lib:FILEPATH=/opt/ros/noetic/lib/libtf2.so //The directory containing a CMake configuration file for map_msgs. map_msgs_DIR:PATH=/opt/ros/noetic/share/map_msgs/cmake @@ -581,6 +615,12 @@ selected_points_publisher_SOURCE_DIR:STATIC=/home/rbccps/Desktop/RBCCPS2023/catk //The directory containing a CMake configuration file for sensor_msgs. sensor_msgs_DIR:PATH=/opt/ros/noetic/share/sensor_msgs/cmake +//Value Computed by CMake +sick_scan_BINARY_DIR:STATIC=/home/rbccps/Desktop/RBCCPS2023/catkin_ws/build/sick_scan_xd + +//Value Computed by CMake +sick_scan_SOURCE_DIR:STATIC=/home/rbccps/Desktop/RBCCPS2023/catkin_ws/src/sick_scan_xd + //The directory containing a CMake configuration file for std_msgs. std_msgs_DIR:PATH=/opt/ros/noetic/share/std_msgs/cmake @@ -765,7 +805,7 @@ CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 //ADVANCED property for variable: CMAKE_NM CMAKE_NM-ADVANCED:INTERNAL=1 //number of local generators -CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=6 +CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=5 //ADVANCED property for variable: CMAKE_OBJCOPY CMAKE_OBJCOPY-ADVANCED:INTERNAL=1 //ADVANCED property for variable: CMAKE_OBJDUMP @@ -810,6 +850,8 @@ CMAKE_UNAME:INTERNAL=/usr/bin/uname CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1 //Details about finding PY_em FIND_PACKAGE_MESSAGE_DETAILS_PY_em:INTERNAL=[/usr/lib/python3/dist-packages/em.py][v()] +//Details about finding PkgConfig +FIND_PACKAGE_MESSAGE_DETAILS_PkgConfig:INTERNAL=[/usr/bin/pkg-config][v0.29.1()] //Details about finding PythonInterp FIND_PACKAGE_MESSAGE_DETAILS_PythonInterp:INTERNAL=[/usr/bin/python3][v3.8.10()] //Details about finding Threads @@ -842,6 +884,8 @@ GTEST_LIBRARY_DEBUG-ADVANCED:INTERNAL=1 GTEST_MAIN_LIBRARY-ADVANCED:INTERNAL=1 //ADVANCED property for variable: GTEST_MAIN_LIBRARY_DEBUG GTEST_MAIN_LIBRARY_DEBUG-ADVANCED:INTERNAL=1 +//ADVANCED property for variable: PKG_CONFIG_EXECUTABLE +PKG_CONFIG_EXECUTABLE-ADVANCED:INTERNAL=1 //ADVANCED property for variable: PYTHON_EXECUTABLE PYTHON_EXECUTABLE-ADVANCED:INTERNAL=1 //This needs to be in PYTHONPATH when 'setup.py install' is called. diff --git a/catkin_ws/build/catkin_generated/order_packages.cmake b/catkin_ws/build/catkin_generated/order_packages.cmake index b6a2eec..ea87b9e 100644 --- a/catkin_ws/build/catkin_generated/order_packages.cmake +++ b/catkin_ws/build/catkin_generated/order_packages.cmake @@ -4,8 +4,8 @@ set(CATKIN_ORDERED_PACKAGES "") set(CATKIN_ORDERED_PACKAGE_PATHS "") set(CATKIN_ORDERED_PACKAGES_IS_META "") set(CATKIN_ORDERED_PACKAGES_BUILD_TYPE "") -list(APPEND CATKIN_ORDERED_PACKAGES "selected_points_publisher") -list(APPEND CATKIN_ORDERED_PACKAGE_PATHS "selected_points_publisher") +list(APPEND CATKIN_ORDERED_PACKAGES "sick_scan") +list(APPEND CATKIN_ORDERED_PACKAGE_PATHS "sick_scan_xd") list(APPEND CATKIN_ORDERED_PACKAGES_IS_META "False") list(APPEND CATKIN_ORDERED_PACKAGES_BUILD_TYPE "catkin") list(APPEND CATKIN_ORDERED_PACKAGES "vision") diff --git a/catkin_ws/build/catkin_make.cache b/catkin_ws/build/catkin_make.cache index a6f37e3..86d31da 100644 --- a/catkin_ws/build/catkin_make.cache +++ b/catkin_ws/build/catkin_make.cache @@ -1,2 +1,2 @@ -selected_points_publisher:vision +sick_scan_xd:vision -DCATKIN_DEVEL_PREFIX=/home/rbccps/Desktop/RBCCPS2023/catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/rbccps/Desktop/RBCCPS2023/catkin_ws/install -G Unix Makefiles \ No newline at end of file diff --git a/catkin_ws/build/sick_scan_xd/catkin_generated/ordered_paths.cmake b/catkin_ws/build/sick_scan_xd/catkin_generated/ordered_paths.cmake new file mode 100644 index 0000000..454cf03 --- /dev/null +++ b/catkin_ws/build/sick_scan_xd/catkin_generated/ordered_paths.cmake @@ -0,0 +1 @@ +set(ORDERED_PATHS "/opt/ros/noetic/lib") \ No newline at end of file diff --git a/catkin_ws/devel/lib/python3/dist-packages/sick_scan/__init__.py b/catkin_ws/devel/lib/python3/dist-packages/sick_scan/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/catkin_ws/devel/lib/python3/dist-packages/sick_scan/cfg/__init__.py b/catkin_ws/devel/lib/python3/dist-packages/sick_scan/cfg/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/computeHomography.py b/computeHomography.py index 728548f..444808e 100644 --- a/computeHomography.py +++ b/computeHomography.py @@ -1,17 +1,24 @@ import numpy as np -pts_src=np.array([[-18.5,-18.5,1],[18.5,-18.5,1],[18.5,18.5,1],[-18.5,18.5,1],[-18.5,101.5,1],[18.5,101.5,1],[18.5,138.5,1],[-18.5,138.5,1],[-18.5,221.5,1],[18.5,221.5,1],[18.5,258.5,1],[-18.5,258.5,1],[41.5,341.5,1],[78.5,341.5,1],[78.5,378.5,1],[41.5,378.5,1],[-138.5,221.5,1],[-101.5,221.5,1],[-101.5,258.5,1],[-138.5,258.5,1],[-138.5,101.5,1],[-101.5,101.5,1],[-101.5,138.5,1],[-138.5,138.5,1]]) # planar object points -pts_dst=np.array([[663,451,1],[755,449,1],[740,388,1],[655,390,1],[636,274,1],[712,273,1],[702,234,1],[632,234,1],[620,158,1],[681,159,1],[676,133,1],[616,132,1],[693,81,1],[744,83,1],[735,64,1],[687,62,1],[421,162,1],[482,161,1],[485,133,1],[427,136,1],[392,279,1],[467,278,1],[471,236,1],[401,238,1]]) # image points +pts_src=np.array([[-18.5,18.5,1],[-18.5,-18.5,1],[18.5,-18.5,1],[18.5,18.5,1],[-78.5,-41.5,1],[-78.5,-78.5,1],[-41.5,-78.5,1],[-41.5,-41.5,1],[-18.5,178.5,1],[-18.5,161.5,1],[18.5,161.5,1],[18.5,178.5,1],[-18.5,318.5,1],[-18.5,281.5,1],[18.5,281.5,1],[18.5,318.5,1],[-138.5,138.5,1],[-138.5,101.5,1],[-101.5,101.5,1],[-101.5,138.5,1],[-198.5,258.5,1],[-198.5,221.5,1],[-161.5,221.5,1],[-161.5,258.5,1]]) # planar object points +pts_dst=np.array([[836,462,1],[834,339,1],[743,396,1],[738,460,1],[657,581,1],[670,502,1],[568,497,1],[548,573,1],[823,224,1],[822,191,1],[756,189,1],[754,222,1],[816,131,1],[814,110,1],[758,109,1],[759,139,1],[573,279,1],[586,241,1],[517,242,1],[500,279,1],[516,173,1],[529,147,1],[475,148,1],[459,173,1]]) # image points import cv2 h, status = cv2.findHomography(pts_src, pts_dst) # print(h) -pts_src=np.array([[-78.5,341.5],[-41.5,341.5],[-41.5,378.5],[-78.5,378.5],[-18.5,-18.5],[18.5,-18.5],[18.5,18.5],[-18.5,18.5]]) # planar object points +#pts_src=np.array([[-78.5,341.5],[-41.5,341.5],[-41.5,378.5],[-78.5,378.5],[-18.5,-18.5],[18.5,-18.5],[18.5,18.5],[-18.5,18.5]]) # planar object points + +pts_src=np.array([[101.5,198.5],[101.5,161.5],[138.5,161.5],[138.5,198.5],[101.5,378.5],[101.5,341.5],[138.5,341.5],[138.5,378.5],[101.5,78.5],[101.5,41.5],[138.5,41.5],[138.5,78.5]]) # planar object test points + + + # print(np.shape(pts_src)) h=np.array([[2.59275014,1.22742257,703.045769],[0.0176127956,-0.801686794,417.718048],[0.000208861672,0.00224224441,1.00000000]]) pts_dst=np.zeros((3,1)) # image points distortion_matrix = np.array([-0.44779831 , 0.21493212,0.0086979,-0.00269077,0.00281984]) -camera_matrix = np.array([[931.82769928,0,645.03076458],[0,927.95336118,333.43480061],[0,0,1]]) +camera_matrix = np.array([[951.66304851,0,643.42125081], + [0,947.84899404,334.96279408], + [0,0,1]]) # print(np.shape(camera_matrix)) # print(np.shape(distortion_matrix)) pts_src_1=[] @@ -60,7 +67,10 @@ # print("Hello") # print(dst) -img_test=np.array([[[523.0],[80.0]],[[576.0],[80.0]],[[574.0],[61.0]],[[525.0],[63.0]],[[663.0],[451.0]],[[755.0],[449.0]],[[740.0],[388.0]],[[655.0],[390.0]]]) +#img_test=np.array([[[523.0],[80.0]],[[576.0],[80.0]],[[574.0],[61.0]],[[525.0],[63.0]],[[663.0],[451.0]],[[755.0],[449.0]],[[740.0],[388.0]],[[655.0],[390.0]]]) + +img_test=np.array([[[1039.0],[233.0]],[[1024.0],[202.0]],[[964.0],[198.0]],[[976.0],[231.0]],[[978.0],[109.0]],[[969.0],[88.0]],[[923.0],[85.0]],[[928.0],[104.0]],[[1089.0],[368.0]],[[1072.0],[321.0]],[[999.0],[319.0]],[[1013.0],[366.0]]])#image test points + # # print(img_test) img_test_1=[] diff --git a/ground_truth/track_sick.py b/ground_truth/track_sick.py index a25d433..1f4672a 100644 --- a/ground_truth/track_sick.py +++ b/ground_truth/track_sick.py @@ -19,7 +19,7 @@ def __init__(self): self.pub = rospy.Publisher("/converted_pc", PointCloud2, queue_size=1) self.header = Header() self.rate=rospy.Rate(50) - self.header.frame_id = "laser" + self.header.frame_id = "cloud" self.fields = [PointField('x', 0, PointField.FLOAT32, 1), PointField('y', 4, PointField.FLOAT32, 1), PointField('z', 8, PointField.FLOAT32, 1), @@ -109,7 +109,7 @@ def scan_cb(self,msg): pass # if lengthplank!=0.0: - if 0.35<=lengthplank<=0.61: + if 0.35<=lengthplank<=0.81: # if lengthplank>0.0: # print("again") diff --git a/images/321_Final.zip b/images/321_Final.zip new file mode 100644 index 0000000..9f6eea6 Binary files /dev/null and b/images/321_Final.zip differ diff --git a/images/321_Final/saved_img_1.jpg b/images/321_Final/saved_img_1.jpg new file mode 100644 index 0000000..f2e5421 Binary files /dev/null and b/images/321_Final/saved_img_1.jpg differ diff --git a/images/321_Final/saved_img_10.jpg b/images/321_Final/saved_img_10.jpg new file mode 100644 index 0000000..510d619 Binary files /dev/null and b/images/321_Final/saved_img_10.jpg differ diff --git a/images/321_Final/saved_img_2.jpg b/images/321_Final/saved_img_2.jpg new file mode 100644 index 0000000..9f4e191 Binary files /dev/null and b/images/321_Final/saved_img_2.jpg differ diff --git a/images/321_Final/saved_img_3.jpg b/images/321_Final/saved_img_3.jpg new file mode 100644 index 0000000..8518902 Binary files /dev/null and b/images/321_Final/saved_img_3.jpg differ diff --git a/images/321_Final/saved_img_4.jpg b/images/321_Final/saved_img_4.jpg new file mode 100644 index 0000000..899977c Binary files /dev/null and b/images/321_Final/saved_img_4.jpg differ diff --git a/images/321_Final/saved_img_5.jpg b/images/321_Final/saved_img_5.jpg new file mode 100644 index 0000000..ba9d2fa Binary files /dev/null and b/images/321_Final/saved_img_5.jpg differ diff --git a/images/321_Final/saved_img_6.jpg b/images/321_Final/saved_img_6.jpg new file mode 100644 index 0000000..925e34a Binary files /dev/null and b/images/321_Final/saved_img_6.jpg differ diff --git a/images/321_Final/saved_img_7.jpg b/images/321_Final/saved_img_7.jpg new file mode 100644 index 0000000..42408d1 Binary files /dev/null and b/images/321_Final/saved_img_7.jpg differ diff --git a/images/321_Final/saved_img_8.jpg b/images/321_Final/saved_img_8.jpg new file mode 100644 index 0000000..87e7d05 Binary files /dev/null and b/images/321_Final/saved_img_8.jpg differ diff --git a/images/321_Final/saved_img_9.jpg b/images/321_Final/saved_img_9.jpg new file mode 100644 index 0000000..8c442f7 Binary files /dev/null and b/images/321_Final/saved_img_9.jpg differ diff --git a/images/saved_img_0.jpg b/images/saved_img_0.jpg new file mode 100644 index 0000000..ecb31b0 Binary files /dev/null and b/images/saved_img_0.jpg differ diff --git a/images/saved_img_1.jpg b/images/saved_img_1.jpg new file mode 100644 index 0000000..a20792b Binary files /dev/null and b/images/saved_img_1.jpg differ diff --git a/images/saved_img_2.jpg b/images/saved_img_2.jpg new file mode 100644 index 0000000..4fa14ba Binary files /dev/null and b/images/saved_img_2.jpg differ diff --git a/images/saved_img_3.jpg b/images/saved_img_3.jpg new file mode 100644 index 0000000..9f01d5d Binary files /dev/null and b/images/saved_img_3.jpg differ diff --git a/img_coordinates.py b/img_coordinates.py index 94df087..8c9d06f 100644 --- a/img_coordinates.py +++ b/img_coordinates.py @@ -16,7 +16,7 @@ def click_event(event, x, y, flags, params): cv2.circle(img, (x,y), 3, (0,255,255), -1) # read the input image -img = cv2.imread('checker_points.png') +img = cv2.imread('saved_img.jpg') # create a window cv2.namedWindow('Point Coordinates') diff --git a/matrices.py b/matrices.py index f500d86..fcab9e5 100644 --- a/matrices.py +++ b/matrices.py @@ -1,4 +1,4 @@ -#mainstream # 1280x720 +#mainstream # 1280x720 distortion_matrix = np.array[[-0.44779831 0.21493212 0.0086979 -0.00269077 0.00281984]] camera_matrix = np.array[[931.82769928 0. 645.03076458] [ 0. 927.95336118 333.43480061] diff --git a/saved_img_1.jpg b/saved_img_1.jpg new file mode 100644 index 0000000..61bb97d Binary files /dev/null and b/saved_img_1.jpg differ diff --git a/saved_img_10.jpg b/saved_img_10.jpg new file mode 100644 index 0000000..11c39f6 Binary files /dev/null and b/saved_img_10.jpg differ diff --git a/saved_img_11.jpg b/saved_img_11.jpg new file mode 100644 index 0000000..fb6c03f Binary files /dev/null and b/saved_img_11.jpg differ diff --git a/saved_img_12.jpg b/saved_img_12.jpg new file mode 100644 index 0000000..bc8268f Binary files /dev/null and b/saved_img_12.jpg differ diff --git a/saved_img_2.jpg b/saved_img_2.jpg new file mode 100644 index 0000000..d3abb2d Binary files /dev/null and b/saved_img_2.jpg differ diff --git a/saved_img_3.jpg b/saved_img_3.jpg new file mode 100644 index 0000000..9a8e4d9 Binary files /dev/null and b/saved_img_3.jpg differ diff --git a/saved_img_4.jpg b/saved_img_4.jpg new file mode 100644 index 0000000..abbde81 Binary files /dev/null and b/saved_img_4.jpg differ diff --git a/saved_img_5.jpg b/saved_img_5.jpg new file mode 100644 index 0000000..7d1f0a8 Binary files /dev/null and b/saved_img_5.jpg differ diff --git a/saved_img_6.jpg b/saved_img_6.jpg new file mode 100644 index 0000000..c1cca4b Binary files /dev/null and b/saved_img_6.jpg differ diff --git a/saved_img_7.jpg b/saved_img_7.jpg new file mode 100644 index 0000000..7342c16 Binary files /dev/null and b/saved_img_7.jpg differ diff --git a/saved_img_8.jpg b/saved_img_8.jpg new file mode 100644 index 0000000..17e03de Binary files /dev/null and b/saved_img_8.jpg differ diff --git a/saved_img_9.jpg b/saved_img_9.jpg new file mode 100644 index 0000000..9387b3b Binary files /dev/null and b/saved_img_9.jpg differ