Thiết kế và điều khiển gương tương tác thông minh khoa đào tạo chất lượng cao ngành công nghệ kỹ thuật cơ điện tử

154 4 0
Thiết kế và điều khiển gương tương tác thông minh khoa đào tạo chất lượng cao ngành công nghệ kỹ thuật cơ điện tử

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

BỘ GIÁO DỤC VÀ ĐÀO TẠO TRƯỜNG ĐẠI HỌC SƯ PHẠM KỸ THUẬT THÀNH PHỐ HỒ CHÍ MINH ĐỒ ÁN TỐT NGHIỆP NGÀNH CÔNG NGHỆ KỸ THUẬT CƠ ĐIỆN TỬ THIẾT KẾ VÀ ĐIỀU KHIỂN GƯƠNG TƯƠNG TÁC THÔNG MINH GVHD: TS BÙI HÀ ĐỨC SVTH: NGUYỄN GIA BẢO NGUYỄN THỊ HẢI YẾN PHẠM THỊ THANH THỦY SKL008100 Tp Hồ Chí Minh, tháng 09/2021 TRƯỜNG ĐẠI HỌC SƯ PHẠM KỸ THUẬT TP HỒ CHÍ MINH KHOA ĐÀO TẠO CHẤT LƯỢNG CAO  ĐỒ ÁN TỐT NGHIỆP THIẾT KẾ VÀ ĐIỀU KHIỂN GƯƠNG TƯƠNG TÁC THÔNG MINH SVTH: NGUYỄN GIA BẢO 17146084 NGUYỄN THỊ HẢI YẾN 17146225 PHẠM THỊ THANH THỦY 17146199 Khóa: 2017-2021 Ngành: CNKT CƠ ĐIỆN TỬ GVHD: TS BÙI HÀ ĐỨC Tp Hồ Chí Minh, tháng 09 năm 2021 TRƯỜNG ĐẠI HỌC SƯ PHẠM KỸ THUẬT TP HCM CỘNG HOÀ XÃ HỘI CHỦ NGHĨA VIỆT NAM KHOA ĐÀO TẠO CHẤT LƯỢNG CAO Độc lập - Tự – Hạnh phúc NHIỆM VỤ ĐỒ ÁN TỐT NGHIỆP Giảng viên hướng dẫn: TS Bùi Hà Đức MSSV:17146084 ĐThoại: 0981675553 Nguyễn Thị Hải Yến MSSV:17146225 ĐThoại: 0918240145 Phạm Thị Thanh Thủy MSSV:17146199 ĐThoại: 0347314959 Sinh viên: Nguyễn Gia Bảo Tên đề tài: Thiết kế điều khiển hệ thống gương tương tác thông minh Các số liệu, tài liệu ban đầu: - Cơ sở lý thuyết - Camera 3D Nội dung đồ án: - Nghiên cứu sở lý thuyết xử lý ảnh 3D - Xây dựng mơ hình phần cứng hệ thống gương tương tác thông minh - Thu thập xử lý liệu ảnh 3D - Xây dựng phần mềm xử lý ảnh - Thiết kế giao diện tương tác người hệ thống Các sản phẩm dự kiến Mô hình, báo cáo, thuyết minh Ngày giao đồ án: Ngày nộp đồ án: Ngơn ngữ trình bày: Tiếng Anh  Tiếng Việt  Trình bày bảo vệ: Tiếng Anh  Tiếng Việt  Bản báo cáo: TRƯỞNG KHOA TRƯỞNG NGÀNH GIẢNG VIÊN HƯỚNG DẪN (Ký, ghi rõ họ tên) (Ký, ghi rõ họ tên) (Ký, ghi rõ họ tên) TRƯỜNG ĐẠI HỌC SƯ PHẠM KỸ THUẬT TP HCM CỘNG HOÀ XÃ HỘI CHỦ NGHĨA VIỆT NAM KHOA ĐÀO TẠO CHẤT LƯỢNG CAO Độc lập - Tự – Hạnh phúc Bộ môn: Cơ điện tử PHIẾU NHẬN XÉT ĐỒ ÁN TỐT NGHIỆP (Dành cho giảng viên hướng dẫn) Họ tên sinh viên: Nguyễn Gia Bảo MSSV: 17146084 Hội đồng: Họ tên sinh viên: Nguyễn Thị Hải Yến MSSV: 17146225 Hội đồng: Họ tên sinh viên: Phạm Thị Thanh Thủy MSSV: 17146199 Hội đồng: Tên đề tài: Thiết kế điều khiển hệ thống gương tương tác thông minh Ngành đào tạo: Công nghệ kỹ thuật Cơ điện tử Họ tên GV hướng dẫn: TS Bùi Hà Đức Ý KIẾN NHẬN XÉT Nhận xét tinh thần, thái độ làm việc sinh viên (không đánh máy) Nhận xét kết thực ĐATN (không đánh máy) 2.1 Kết cấu, cách thức trình bày ĐATN: 2.2 Nội dung đồ án: (Cơ sở lý luận, tính thực tiễn khả ứng dụng đồ án, hướng nghiên cứu tiếp tục phát triển) 2.3 Kết đạt được: 2.4 Những tồn (nếu có): Đánh giá: Mục đánh giá TT Điểm Điểm tối đa đạt Hình thức kết cấu ĐATN 30 Đúng format với đầy đủ hình thức nội dung mục 10 Mục tiêu, nhiệm vụ, tổng quan đề tài 10 Tính cấp thiết đề tài 10 Nội dung ĐATN 50 Khả ứng dụng kiến thức toán học, khoa học kỹ thuật, khoa học xã hội… Khả thực hiện/phân tích/tổng hợp/đánh giá 10 Khả thiết kế chế tạo hệ thống, thành phần, quy trình đáp ứng yêu cầu đưa với ràng buộc thực tế 15 Khả cải tiến phát triển 15 Khả sử dụng công cụ kỹ thuật, phần mềm chuyên ngành… Đánh giá khả ứng dụng đề tài 10 Sản phẩm cụ thể ĐATN 10 Tổng điểm 100 Kết luận:  Được phép bảo vệ  Không phép bảo vệ TP.HCM, ngày tháng năm 2021 Giảng viên hướng dẫn (Ký, ghi rõ họ tên) TRƯỜNG ĐẠI HỌC SƯ PHẠM KỸ THUẬT TP HCM CỘNG HOÀ XÃ HỘI CHỦ NGHĨA VIỆT NAM KHOA ĐÀO TẠO CHẤT LƯỢNG CAO Độc lập - Tự – Hạnh phúc Bộ môn: Cơ điện tử PHIẾU NHẬN XÉT ĐỒ ÁN TỐT NGHIỆP (Dành cho giảng viên phản biện) Họ tên sinh viên: Nguyễn Gia Bảo MSSV: 17146084 Hội đồng: Họ tên sinh viên: Nguyễn Thị Hải Yến MSSV: 17146225 Hội đồng: Họ tên sinh viên: Phạm Thị Thanh Thủy MSSV: 17146199 Hội đồng: Tên đề tài: Thiết kế điều khiển hệ thống gương tương tác thông minh Ngành đào tạo: Công nghệ kỹ thuật Cơ điện tử Họ tên GV phản biện: (Mã GV) Ý KIẾN NHẬN XÉT Nhận xét tinh thần, thái độ làm việc sinh viên (không đánh máy) Nội dung đồ án: (Cơ sở lý luận, tính thực tiễn khả ứng dụng đồ án, hướng nghiên cứu tiếp tục phát triển) Kết đạt được: Những thiếu sót tồn ĐATN: Câu hỏi: Đánh giá: Mục đánh giá TT Điểm Điểm tối đa đạt Hình thức kết cấu ĐATN 30 Đúng format với đầy đủ hình thức nội dung mục 10 Mục tiêu, nhiệm vụ, tổng quan đề tài 10 Tính cấp thiết đề tài 10 Nội dung ĐATN 50 Khả ứng dụng kiến thức toán học, khoa học kỹ thuật, khoa học xã hội… Khả thực hiện/phân tích/tổng hợp/đánh giá 10 Khả thiết kế chế tạo hệ thống, thành phần, quy trình đáp ứng yêu cầu đưa với ràng buộc thực tế 15 Khả cải tiến phát triển 15 Khả sử dụng công cụ kỹ thuật, phần mềm chuyên ngành… Đánh giá khả ứng dụng đề tài 10 Sản phẩm cụ thể ĐATN 10 Tổng điểm 100 Kết luận:  Được phép bảo vệ  Không phép bảo vệ TP.HCM, ngày tháng năm 2021 Giảng viên phản biện (Ký, ghi rõ họ tên) LỜI CAM ĐOAN Chúng em xin cam đoan đề tài “Thiết kế điều khiển gương tương tác thơng minh” cơng trình nghiên cứu thân Những phần có sử dụng tài liệu tham khảo có đồ án liệt kê nêu rõ phần tài liệu tham khảo Đồng thời số liệu hay kết trình bày đồ án mang tính chất trung thực, không chép, đạo nhái Nếu sai chúng em xin chịu hoàn toàn trách nhiệm chịu tất kỷ luật môn nhà trường đề Người thực Nguyễn Gia Bảo Phạm Thị Thanh Thủy Nguyễn Thị Hải Yến i did_once = False i=0 cnt = save = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] for joint_index in range(len(joints_2D)): if did_once == False: cv2.putText( render_image, "id: " + str(skeleton_2D.id), (int(joints_2D[joint_index].x), int(joints_2D[joint_index].y - 30)), cv2.FONT_HERSHEY_SIMPLEX, 0.55, text_color, thickness, ) did_once = True # check if the joint was detected and has valid coordinate if skeleton_2D.confidences[joint_index] > joint_confidence: distance_in_kernel = [] # of image RGB low_bound_x = max( 0, int( 120 joints_2D[joint_index].x - math.floor(distance_kernel_size / 2) ) ) upper_bound_x = min( cols - 1, int(joints_2D[joint_index].x + math.ceil(distance_kernel_size / 2)), ) low_bound_y = max( 0, int( joints_2D[joint_index].y - math.floor(distance_kernel_size / 2) ), ) upper_bound_y = min( rows - 1, int(joints_2D[joint_index].y + math.ceil(distance_kernel_size / 2)), ) # have to change to Depth for x in range(low_bound_x, upper_bound_x): for y in range(low_bound_y, upper_bound_y): 121 distance_in_kernel.append(depth_map.get_distance(847-y, x)) if len(distance_in_kernel) == 25: median_distance = np.percentile(np.array(distance_in_kernel), 50) else: continue depth_pixel = [ 847-int(joints_2D[joint_index].y), int(joints_2D[joint_index].x), ] # if joint_index == 4: # print("median_distance", median_distance) if median_distance >= 0.3: point_3d = rs.rs2_deproject_pixel_to_point( depth_intrinsic, depth_pixel, median_distance ) point_3d = np.round([float(i) for i in point_3d], 3) # if joint_index == 4: # print("joints_2D[joint_index].y:", joints_2D[joint_index].y) # print("point3d sau:",point_3d) point_str = [str(x) for x in point_3d] i = "{}".format(joint_index) cnt +=1 save[cnt-1] = [point_3d[1], 122 -point_3d[0], point_3d[2]] cv2.putText( render_image, str(i) + ' ' + str([point_3d[1], point_3d[0], -point_3d[2]]) , (int(joints_2D[joint_index].x), int(joints_2D[joint_index].y)), cv2.FONT_HERSHEY_DUPLEX, 0.4, text_color, thickness, ) if cnt == 18: return save else: return None if name == " main ": try: # Configure depth and color streams of the intel realsense # from Camera config_1 = rs.config() config_1.enable_device('046122251324') 123 config_1.enable_stream(rs.stream.depth, 848, 480, rs.format.z16, 30) config_1.enable_stream(rs.stream.color, 848, 480, rs.format.rgb8, 30) # from Camera config_2 = rs.config() config_2.enable_device('108222250284') config_2.enable_stream(rs.stream.depth, 848, 480, rs.format.z16, 30) config_2.enable_stream(rs.stream.color, 848, 480, rs.format.rgb8, 30) # Start the realsense pipeline # from Camera pipeline_1 = rs.pipeline() pipeline_1.start(config_1) # from Camera pipeline_2 = rs.pipeline() pipeline_2.start(config_2) # Create align object to align depth frames to color frames # from Camera align_1 = rs.align(rs.stream.color) # from Camera align_2 = rs.align(rs.stream.color) # Get the intrinsics information for calculation of 3D point # from Camera unaligned_frames_1 = pipeline_1.wait_for_frames() frames_1 = align_1.process(unaligned_frames_1) depth_frame_1 = frames_1.get_depth_frame() 124 depth_intrinsic_1 = depth_frame_1.profile.as_video_stream_profile().intrinsics color_1 = frames_1.get_color_frame() color_image_1= np.asanyarray(color_1.get_data()) # from Camera unaligned_frames_2 = pipeline_2.wait_for_frames() frames_2 = align_2.process(unaligned_frames_2) depth_frame_2 = frames_2.get_depth_frame() depth_intrinsic_2 = depth_frame_2.profile.as_video_stream_profile().intrinsics color_2 = frames_2.get_color_frame() color_image_2 = np.asanyarray(color_2.get_data()) # Initialize the cubemos api with a valid license key in default_license_dir() skeletrack = skeletontracker(cloud_tracking_api_key="") joint_confidence = 0.2 # Create window for initialisation window_name = "cubemos skeleton tracking with realsense D400 series" # Initialize out = cv2.VideoWriter('person.avi',cv2.VideoWriter_fourcc('M','J','P','G'), 30, (color_image_1.shape[0],color_image_1.shape[1])) loaded_model = pickle.load(open('traindongtac.sav', 'rb')) P15_distance = np.arange(15).reshape((15,)).tolist() Points_15 = np.arange(15).reshape((15,1)).tolist() Points_3 = np.arange(3).reshape((3,1)).tolist() 125 pc1 = rs.pointcloud() pc2 = rs.pointcloud() vong = times1 = times2 = cnt = first_loop = True flag = mydb = mysql.connector.connect( host="localhost", user="byt", password="123", database="interaction" ) # send_flagtable(mydb,0) while True: # Create a pipeline_1 object This object configures the streaming camera and owns it's handle # from Camera unaligned_frames_1 = pipeline_1.wait_for_frames() frames_1 = align_1.process(unaligned_frames_1) depth_frame_1 = frames_1.get_depth_frame() color_1 = frames_1.get_color_frame() # from Camera 126 unaligned_frames_2 = pipeline_2.wait_for_frames() frames_2 = align_2.process(unaligned_frames_2) depth_frame_2 = frames_2.get_depth_frame() color_2 = frames_2.get_color_frame() if not depth_frame_1 or not depth_frame_2 or not color_1 or not color_2: continue # Convert images to numpy arrays # from camera depth_image_1 = np.asanyarray(depth_frame_1.get_data()) color_image_1 = np.asanyarray(color_1.get_data()) color_image_1 = cv2.cvtColor(color_image_1, cv2.COLOR_BGR2RGB) # from camera depth_image_2 = np.asanyarray(depth_frame_2.get_data()) color_image_2 = np.asanyarray(color_2.get_data()) color_image_2 = cv2.cvtColor(color_image_2, cv2.COLOR_BGR2RGB) # rotation color_image_1 = cv2.rotate(color_image_1, cv2.ROTATE_90_COUNTERCLOCKWISE) color_image_2 = cv2.rotate(color_image_2, cv2.ROTATE_90_COUNTERCLOCKWISE) out.write(color_image_1) # print('depth_image_shape1',depth_image_1) 127 # print('depth_image_shape2',depth_image_2) flag = read_flagtable(mydb) if flag == 1: '''find size''' # perform inference and update the tracking id skeletons = skeletrack.track_skeletons(color_image_1) # render the skeletons on top of the acquired image and display it cm.render_result(skeletons, color_image_1, joint_confidence) skeletons_3D = render_ids_3d( color_image_1, skeletons, depth_frame_1, depth_intrinsic_1, joint_confidence) if skeletons_3D is not None: # depth_image_1 = np.asanyarray(depth_2.get_data()) #calculate pcd points_1 = pc1.calculate(depth_frame_1) points_2 = pc2.calculate(depth_frame_2) v1 = points_1.get_vertices() v2 = points_2.get_vertices() verts1 = np.asanyarray(v1).view(np.float32).reshape(-1, 3) # xyz verts2 = np.asanyarray(v2).view(np.float32).reshape(-1, 3) # xyz 128 print('verts 1: ',verts1) print('verts 2: ',verts2) pcl1 = o3d.geometry.PointCloud() pcl1.points = o3d.utility.Vector3dVector(verts1) pcl2 = o3d.geometry.PointCloud() pcl2.points = o3d.utility.Vector3dVector(verts2) size = process_3D(pcl1,pcl2,skeletons_3D) send_sizetable(size[0],size[1],size[2],size[3]) print('da gui size') elif flag == 2: '''tuong tac''' # ghi lien tuc doc tac vao database skeletons = skeletrack.track_skeletons(color_image_1) # render the skeletons on top of the acquired image and display it cm.render_result(skeletons, color_image_1, joint_confidence) skeletons_3D = render_ids_3d( color_image_1, skeletons, depth_frame_1, depth_intrinsic_1, joint_confidence) if skeletons_3D is not None: k = motion_detection(skeletons_3D[4]) if k is not None: 129 print('k = ',k) if k == 1: times1 += times2 = elif k == 2: times1 = times2 += elif k == 3: times1 = times2 = if times1 >=3: mycursor = mydb.cursor() sql = "INSERT INTO movement (id,kind) VALUES (%s, %s)" val = (None,1) mycursor.execute(sql, val) mydb.commit() times1 = print('gat 1') elif times2 >=3: mycursor = mydb.cursor() sql = "INSERT INTO movement (id,kind) VALUES (%s, %s)" val = (None,2) 130 mycursor.execute(sql, val) mydb.commit() times2 = print('gat 2') cv2.imshow('1', color_image_1) # cv2.imshow('2', color_image_2) if cv2.waitKey(1) == 27: break pipeline_1.stop() pipeline_2.stop() cv2.destroyAllWindows() #sle = except Exception as ex: print('Exception occured: "{}"'.format(ex)) 131 Phụ lục B: Bản vẽ 132 133 S K L 0 ...TRƯỜNG ĐẠI HỌC SƯ PHẠM KỸ THUẬT TP HỒ CHÍ MINH KHOA ĐÀO TẠO CHẤT LƯỢNG CAO  ĐỒ ÁN TỐT NGHIỆP THIẾT KẾ VÀ ĐIỀU KHIỂN GƯƠNG TƯƠNG TÁC THÔNG MINH SVTH: NGUYỄN GIA BẢO 17146084 NGUYỄN... Thanh Thủy MSSV: 17146199 Hội đồng: Tên đề tài: Thiết kế điều khiển hệ thống gương tương tác thông minh Ngành đào tạo: Công nghệ kỹ thuật Cơ điện tử Họ tên GV hướng dẫn: TS Bùi Hà Đức Ý KIẾN NHẬN... Thanh Thủy MSSV: 17146199 Hội đồng: Tên đề tài: Thiết kế điều khiển hệ thống gương tương tác thông minh Ngành đào tạo: Công nghệ kỹ thuật Cơ điện tử Họ tên GV phản biện: (Mã GV) Ý KIẾN

Ngày đăng: 10/08/2022, 23:01

Tài liệu cùng người dùng

Tài liệu liên quan