(Đồ án tốt nghiệp) thiết kế và thi công hệ thống gửi xe thông minh

84 3 0
(Đồ án tốt nghiệp) thiết kế và thi công hệ thống gửi xe thông minh

Đ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 ĐIỆN TỬ, TRUYỀN THÔNG THIẾT KẾ VÀ THI CÔNG HỆ THỐNG GỬI XE THƠNG MINH GVHD:Nguyễn Đình Phú SVTT: PHẠM VĂN NAM MSSV: 15141044 SVTH: LÊ QUANG NAM MSSV: 14141493 SKL006753 Tp Hồ Chí Minh, tháng 12/2019 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 KHOA ĐÀO TẠO CHẤT LƯỢNG CAO ĐỒ ÁN TỐT NGHIỆP Đề tài: THIẾT KẾ VÀ THI CÔNG HỆ THỐNG GỬI XE THÔNG MINH SVTH: PHẠM VĂN NAM MSSV: 15141044 SVTH: LÊ QUANG NAM MSSV: 14141493 Ngành: Công nghệ kỹ thuật Điện tử, Truyền thông GVHD: GVC ThS Nguyễn Đình Phú Tp Hồ Chí Minh, tháng 12 năm 2019 CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT NAM Độc lập – Tự – Hạnh phúc *** Tp Hồ Chí Minh, ngày … tháng … năm 2020 NHIỆM VỤ ĐỒ ÁN TỐT NGHIỆP MSSV:15141044 Họ tên sinh viên: Phạm Văn Nam Lê Quang Nam MSSV:14141493 Ngành:Công Nghệ Kỹ Thuật Điện tử, Truyền thông Giảng viên hướng dẫn: GVC ThS Nguyễn Đình Phú ĐT:0919026244- 09777774280 Ngày nhận đề tài: 18/09/2019 Ngày nộp đề tài: 31/12/2019 Tên đề tài: Thiết kế thi công hệ thống gửi xe thông minh Các số liệu, tài liệu ban đầu: Kiến thức môn: Điện tử bản, Hệ thống điều khiển tự động, Lập trình C, Vi xử lý, Xử lý ảnh Nội dung thực đề tài: Thiết kế hệ thống Thi cơng mơ hình Lập trình hệ thống Viết báo cáo Sản phẩm: Mơ hình hệ thống gửi xe thơng minh TRƯỞNG NGÀNH GIẢNG VIÊN HƯỚNG DẪN i CỘNG HOÀ XÃ HỘI CHỦ NGHĨA VIỆT NAM Độc lập – Tự – Hạnh Phúc ******* PHIẾU NHẬN XÉT CỦA GIÁO VIÊN HƯỚNG DẪN Họ tên Sinh viên 1: Phạm Văn Nam MSSV: 15141044 Họ tên Sinh viên 2: Lê Quang Nam MSSV: 14141493 Ngành: Công nghệ kỹ thuật Điện tử - Truyền thông Tên đề tài: Thiết kế thi công hệ thống gửi xe thông minh Họ tên Giáo viên hướng dẫn: GVC ThS Nguyễn Đình Phú NHẬN XÉT Về nội dung đề tài & khối lượng thực hiện: Ưu điểm: Khuyết điểm: Đề nghị cho bảo vệ hay không? Đánh giá loại: Điểm: (Bằng chữ: ) Tp Hồ Chí Minh, ngày tháng năm 2020 Giáo viên hướng dẫn (Ký & ghi rõ họ tên) ii CỘNG HOÀ XÃ HỘI CHỦ NGHĨA VIỆT NAM Độc lập – Tự – Hạnh Phúc ******* PHIẾU NHẬN XÉT CỦA GIÁO VIÊN PHẢN BIỆN Họ tên Sinh viên: MSSV: Ngành: Tên đề tài: Họ tên Giáo viên phản biện: NHẬN XÉT Về nội dung đề tài & khối lượng thực hiện: Ưu điểm: Khuyết điểm: Đề nghị cho bảo vệ hay không? Đánh giá loại: Điểm: (Bằng chữ: ) Tp Hồ Chí Minh, ngày tháng năm 2020 Giáo viên phản biện (Ký & ghi rõ họ tên) iii CỘNG HOÀ XÃ HỘI CHỦ NGHĨA VIỆT NAM Độc lập – Tự – Hạnh Phúc ******* PHIẾU NHẬN XÉT CỦA GIÁO VIÊN PHẢN BIỆN Họ tên Sinh viên: MSSV: Ngành: Tên đề tài: Họ tên Giáo viên phản biện: NHẬN XÉT Về nội dung đề tài & khối lượng thực hiện: Ưu điểm: Khuyết điểm: 10 Đề nghị cho bảo vệ hay không? 11 Đánh giá loại: 12 Điểm: (Bằng chữ: ) Tp Hồ Chí Minh, ngày tháng năm 2020 Giáo viên phản biện (Ký & ghi rõ họ tên) iv LỜI CẢM ƠN Để hoàn thành đồ án tốt nghiệp này, lời chúng em xin cảm ơn sâu sắc đến thầy GVC ThS Nguyễn Đình Phú tận tình hướng dẫn bảo chúng em suốt trình thực đồ án Chúng em xin chân thành cảm ơn quý thầy, cô trường Đại Học Sư Phạm Kỹ Thuật TP.HCM, đặc biệt thầy cô mơn Điện tử, truyền thơng nhiệt tình giúp đỡ, truyền đạt kiến thức suốt trình học tập nhóm chúng em trường Những kiến thức tiếp thu trình học tập thực tế khơng tảng cho q trình thực đồ án tốt nghiệp mà hành trang quý báu cho tương lai chúng em Cuối cùng, xin cảm ơn tập thể lớp 15141CL3 bạn chung chuyên ngành nhiệt tình hỗ trợ giúp đỡ nhóm suốt thời gian học tập Đặc biệt, chúng xin gửi lời cảm ơn trân trọng đến cha mẹ, người ủng hộ, động viên nguồn động lực cho chúng cố gắng phấn đấu đường học tập Nhóm thực đề tài Lê Quang Nam Phạm Văn Nam v MỤC LỤC NHIỆM VỤ ĐỒ ÁN TỐT NGHIỆP PHIẾU NHẬN XÉT CỦA GIÁO VIÊN HƯỚNG DẪN PHIẾU NHẬN XÉT CỦA GIÁO VIÊN PHẢN BIỆN PHIẾU NHẬN XÉT CỦA GIÁO VIÊN PHẢN BIỆN LỜI CẢM ƠN MỤC LỤC DANH MỤC CÁC TỪ VIẾT TẮT DANH SÁCH CÁC HÌNH ẢNH, BIỂU ĐỒ CHƯƠNG 1: TỔNG QUAN 1.1 Đặt vấn đề 1.2 Mục tiêu đề tài 1.3 Nội dung nghiên cứu 1.4 Giới hạn 1.5 Bố cục CHƯƠNG 2: CƠ SỞ LÝ THUYẾT LIÊN QUAN 2.1 Giới thiệu giao thức UART 2.2 Giới thiệu thư viện EmguCV 2.2.1 EmguCv 2.3 Giới thiệu công cụ phân tích ký tự Tesse 2.4 Nguyên lý nhận dạng biển số 2.4.1 Tách biển s 2.4.2 Phân đoạn ký tự 2.4.3 Nhận dạng ký tự 2.5 Giới thiệu mã QR 2.5.1 Giới thiệu m 2.5.2 Đặc điểm 2.5.3 Cấu tạo vi 2.6 Giới thiệu SQL Server 2.6.1 Giới thiệu S 2.6.2 Các ứng dụ CHƯƠNG 3: XÂY DỰNG VÀ THIẾT KẾ HỆ THỐNG 3.1 Sơ đồ khối hệ thống 3.1.1 Yêu cầu 3.1.2 Sơ đồ khối 3.1.3 Chức 3.2 Thiết kế tính tốn hệ thống 3.2.1 Giao diện đ 3.2.2 Khối động c 3.2.3 Khối lưu trữ 3.2.4 Khối nút nh 3.2.5 Khối camer 3.2.6 Khối xử lý t 3.2.7 Khối thông 3.2.8 Khối nguồn CHƯƠNG 4: THI CÔNG HỆ THỐNG 4.1 Lập trình ứng dụng 4.1.1 Giới thiệu v 4.1.2 Lưu đồ giải 4.1.3 Chương trìn 4.2 Lập trình hệ thống 4.2.1 Giới thiệu p 4.2.2 Lưu đồ giải CHƯƠNG 5: KẾT QUẢ THỰC HIỆN 5.1 Mơ hình hệ thống 5.2 Kết 5.3 Nhận xét 5.4 Đánh giá CHƯƠNG 6: KẾT LUẬN VÀ HƯỚNG PHÁT TRIỂN vii 6.1 Kết luận 42 6.2 Hướng phát triển 42 TÀI LIỆU THAM KHẢO 43 PHỤ LỤC 44 viii full_tesseract.Clear(); full_tesseract.ClearAdaptiveClassifier(); temp = full_tesseract.Apply(ch); cou++; if (cou > 10) { listRect.RemoveAt(i); i ; di = 0; break; } di = cou; } } for (int i = 0; i < listRect.Count; i++) { for (int j = i; j < listRect.Count; j++) { if (listRect[i].Y > listRect[j].Y + 100) { flag_up = true; up_y = listRect[j].Y; dow_y = listRect[i].Y; break; } else if (listRect[j].Y > listRect[i].Y + 100) { flag_up = true; up_y = listRect[i].Y; dow_y = listRect[j].Y; break; } if (flag_up == true) break; } } for (int i = 0; i < listRect.Count; i++) { if (listRect[i].Y < up_y + 50 && listRect[i].Y > up_y - 50) { up.Add(listRect[i]); } else if (listRect[i].Y < dow_y + 50 && listRect[i].Y > dow_y - 50) { dow.Add(listRect[i]); } } if (flag_up == false) dow = listRect; for (int i = 0; i < up.Count; i++) { for (int j = i; j < up.Count; j++) { if (up[i].X > up[j].X) { Rectangle w = up[i]; 54 up[i] = up[j]; up[j] = w; } } } for (int i = 0; i < dow.Count; i++) { for (int j = i; j < dow.Count; j++) { if (dow[i].X > dow[j].X) { Rectangle w = dow[i]; dow[i] = dow[j]; dow[j] = w; } } } int x = 0; int c_x = 0; for (int i = 0; i < up.Count; i++) { Bitmap ch = grayframe.Clone(up[i], grayframe.PixelFormat); Bitmap o = ch; string temp; if (i < 2) { temp = clsBSoft.Ocr(ch, false, full_tesseract, num_tesseract, ch_tesseract, true); // nhan dien so } else { temp = clsBSoft.Ocr(ch, false, full_tesseract, num_tesseract, ch_tesseract, false); // nhan dien chu } zz += temp; box[i].Location = new Point(x + i * 50, 0); box[i].Size = new Size(50, 100); box[i].SizeMode = PictureBoxSizeMode.StretchImage; box[i].Image = ch; panel1.Controls.Add(box[i]); c_x++; } zz += " "; for (int i = 0; i < dow.Count; i++) { Bitmap ch = grayframe.Clone(dow[i], grayframe.PixelFormat); string temp = clsBSoft.Ocr(ch, false, full_tesseract, num_tesseract, ch_tesseract, true); // nhan dien so zz += temp; box[i + c_x].Location = new Point(x + i * 50, 100); box[i + c_x].Size = new Size(50, 100); box[i + c_x].SizeMode = PictureBoxSizeMode.StretchImage; box[i + c_x].Image = ch; panel1.Controls.Add(box[i + c_x]); 55 } string sa = zz.ToString(); sa = sa.Replace("\n", String.Empty); biensora.Text = sa; //end xu ly anh dau if (String.Compare(biensovao.Text, biensora.Text)==0) { lblketqua.Text = "ĐÚNG BẢN SỐ"; serialPort1.Write("3"); biensoQR.Text = null; biensoQR.Text = null; finalFrame2.Start(); } else { lblketqua.Text = "SAI BẢN SỐ"; serialPort1.Write("4"); finalFrame2.Start(); biensoQR.Text = null; } } } } //chup hinh bien so xe private void button2_Click(object sender, EventArgs e) { hinhrafinish.Image = (Bitmap)hinhvao.Image.Clone(); //JPEG hinhrafinish.SizeMode = PictureBoxSizeMode.StretchImage; finalFrame1.Stop(); hinhrafinish.Image.Save(@"D:\Test2.bmp", ImageFormat.Bmp); } / / / chon hinh may phan tich hinh roi luu bien so xe vao xuong database in barcode private void button3_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "Image (*.bmp; *.jpg; *.jpeg; *.png) |*.bmp; *.jpg; *.jpeg; *.png|All files (*.*)|*.*||"; dlg.InitialDirectory = Application.StartupPath + "\\ImageTest"; if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.Cancel) { return; } string startupPath = dlg.FileName; ProcessImage(startupPath); if (PlateImagesList.Count != 0) { Image src = new Image(PlateImagesList[0].ToBitmap()); Bitmap grayframe; Bitmap color; 56 int c = clsBSoft.IdentifyContours(src.ToBitmap(), 50, false, out grayframe, out color, out listRect); textBox2.Text = c.ToString(); Image dst = new Image(grayframe); grayframe = dst.ToBitmap(); string zz = ""; // lọc xếp số List bmp = new List(); List erode = new List(); List up = new List(); List dow = new List(); int up_y = 0, dow_y = 0; bool flag_up = false; int di = 0; if (listRect == null) return; for (int i = 0; i < listRect.Count; i++) { Bitmap ch = grayframe.Clone(listRect[i], grayframe.PixelFormat); int cou = 0; full_tesseract.Clear(); full_tesseract.ClearAdaptiveClassifier(); string temp = full_tesseract.Apply(ch); while (temp.Length > 3) { Image temp2 = new Image(ch); temp2 = temp2.Erode(2); ch = temp2.ToBitmap(); full_tesseract.Clear(); full_tesseract.ClearAdaptiveClassifier(); temp = full_tesseract.Apply(ch); cou++; if (cou > 10) { listRect.RemoveAt(i); i ; di = 0; break; } di = cou; } } for (int i = 0; i < listRect.Count; i++) { for (int j = i; j < listRect.Count; j++) { if (listRect[i].Y > listRect[j].Y + 100) { flag_up = true; up_y = listRect[j].Y; dow_y = listRect[i].Y; break; } else if (listRect[j].Y > listRect[i].Y + 100) { 57 flag_up = true; up_y = listRect[i].Y; dow_y = listRect[j].Y; break; } if (flag_up == true) break; } } for (int i = 0; i < listRect.Count; i++) { if (listRect[i].Y < up_y + 50 && listRect[i].Y > up_y - 50) { up.Add(listRect[i]); } else if (listRect[i].Y < dow_y + 50 && listRect[i].Y > dow_y - 50) { dow.Add(listRect[i]); } } if (flag_up == false) dow = listRect; for (int i = 0; i < up.Count; i++) { for (int j = i; j < up.Count; j++) { if (up[i].X > up[j].X) { Rectangle w = up[i]; up[i] = up[j]; up[j] = w; } } } for (int i = 0; i < dow.Count; i++) { for (int j = i; j < dow.Count; j++) { if (dow[i].X > dow[j].X) { Rectangle w = dow[i]; dow[i] = dow[j]; dow[j] = w; } } } int x = 0; int c_x = 0; for (int i = 0; i < up.Count; i++) { Bitmap ch = grayframe.Clone(up[i], grayframe.PixelFormat); Bitmap o = ch; string temp; if (i < 2) { 58 temp = clsBSoft.Ocr(ch, false, full_tesseract, num_tesseract, ch_tesseract, true); // nhan dien so } else { temp = clsBSoft.Ocr(ch, false, full_tesseract, num_tesseract, ch_tesseract, false); // nhan dien chu } zz += temp; box[i].Location = new Point(x + i * 50, 0); box[i].Size = new Size(50, 100); box[i].SizeMode = PictureBoxSizeMode.StretchImage; box[i].Image = ch; panel1.Controls.Add(box[i]); c_x++; } zz += " "; for (int i = 0; i < dow.Count; i++) { Bitmap ch = grayframe.Clone(dow[i], grayframe.PixelFormat); string temp = clsBSoft.Ocr(ch, false, full_tesseract, num_tesseract, ch_tesseract, true); // nhan dien so zz += temp; box[i + c_x].Location = new Point(x + i * 50, 100); box[i + c_x].Size = new Size(50, 100); box[i + c_x].SizeMode = PictureBoxSizeMode.StretchImage; box[i + c_x].Image = ch; panel1.Controls.Add(box[i + c_x]); } string sa = zz.ToString(); sa = sa.Replace("\n", String.Empty); biensovao.Text = sa; BarcodeWriter barcodeWriter = new BarcodeWriter(); EncodingOptions encodingOptions = new EncodingOptions() { Width = 100, Height = 100, Margin = 0, PureBarcode = false }; encodingOptions.Hints.Add(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H); barcodeWriter.Renderer = new BitmapRenderer(); barcodeWriter.Options = encodingOptions; barcodeWriter.Format = BarcodeFormat.QR_CODE; string xs = biensovao.Text.ToString(); Bitmap bitmap = barcodeWriter.Write(xs); qr.SizeMode = PictureBoxSizeMode.StretchImage; qr.Image = bitmap; PrintDocument pd = new PrintDocument(); pd.PrinterSettings.PrinterName = printer_selected; pd.PrintPage += PrintPage; pd.Print(); byte[] img = null; FileStream Stream = new FileStream(startupPath, FileMode.Open, FileAccess.Read); 59 BinaryReader brs = new BinaryReader(Stream); img = brs.ReadBytes((int)Stream.Length); string sql = "INSERT INTO csdl(ID, BSX, THOIGIAN, HINH) VALUES('" + "123" + "','" + biensovao.Text + "','" + DateTime.Now.ToString() + "', @img)"; connection.Open(); cmd = new SqlCommand(sql, connection); cmd.Parameters.Add(new SqlParameter("@img", img)); cmd.ExecuteNonQuery(); connection.Close(); } finalFrame1.Start(); } private void dữLiệuVàoToolStripMenuItem_Click(object sender, EventArgs e) { XEVAO f = new XEVAO(); f.Show(); this.Hide(); } // bat/tat ket noi vdk private void button4_Click_1(object sender, EventArgs e) { dem++; if(dem%2==0) { if (!serialPort1.IsOpen) { serialPort1.PortName = comboBox3.Text; serialPort1.BaudRate = Convert.ToInt32(9600); serialPort1.Open(); button4.Text = "Kết nối"; } } else { serialPort1.Close(); } } // private void DataReceive(object obj, SerialDataReceivedEventArgs e) { InputData = serialPort1.ReadExisting(); if (InputData != String.Empty) { SetText(InputData); } } // xu ly vi dieu khien private void SetText(string text) { if (this.textBox1.InvokeRequired) { SetTextCallback d = new SetTextCallback(SetText); // khởi tạo delegate gọi đến SetText this.Invoke(d, new object[] { text }); } 60 else { if(text == "0"||text == "1") { hinhvaofinish.Image = (Bitmap)hinhvao.Image.Clone(); //JPEG hinhvaofinish.SizeMode = PictureBoxSizeMode.StretchImage; finalFrame1.Stop(); int t = RandomNumber(0, 1000); string s = @"D:\XX" + t.ToString() + ".bmp"; hinhvaofinish.Image.Save(s, ImageFormat.Bmp); ProcessImage(s); if (PlateImagesList.Count != 0) { Image src = new Image(PlateImagesList[0].ToBitmap()); Bitmap grayframe; Bitmap color; int c = clsBSoft.IdentifyContours(src.ToBitmap(), 50, false, out grayframe, out color, out listRect); textBox2.Text = c.ToString(); Image dst = new Image(grayframe); grayframe = dst.ToBitmap(); string zz = ""; // lọc xếp số List bmp = new List(); List erode = new List(); List up = new List(); List dow = new List(); int up_y = 0, dow_y = 0; bool flag_up = false; int di = 0; if (listRect == null) return; for (int i = 0; i < listRect.Count; i++) { Bitmap ch = grayframe.Clone(listRect[i], grayframe.PixelFormat); int cou = 0; full_tesseract.Clear(); full_tesseract.ClearAdaptiveClassifier(); string temp = full_tesseract.Apply(ch); while (temp.Length > 3) { Image temp2 = new Image(ch); temp2 = temp2.Erode(2); ch = temp2.ToBitmap(); full_tesseract.Clear(); full_tesseract.ClearAdaptiveClassifier(); temp = full_tesseract.Apply(ch); cou++; if (cou > 10) { listRect.RemoveAt(i); i ; di = 0; 61 break; } di = cou; } } for (int i = 0; i < listRect.Count; i++) { for (int j = i; j < listRect.Count; j++) { if (listRect[i].Y > listRect[j].Y + 100) { flag_up = true; up_y = listRect[j].Y; dow_y = listRect[i].Y; break; } else if (listRect[j].Y > listRect[i].Y + 100) { flag_up = true; up_y = listRect[i].Y; dow_y = listRect[j].Y; break; } if (flag_up == true) break; } } for (int i = 0; i < listRect.Count; i++) { if (listRect[i].Y < up_y + 50 && listRect[i].Y > up_y 50) { up.Add(listRect[i]); } else if (listRect[i].Y < dow_y + 50 && listRect[i].Y > dow_y 50) { dow.Add(listRect[i]); } } if (flag_up == false) dow = listRect; for (int i = 0; i < up.Count; i++) { for (int j = i; j < up.Count; j++) { if (up[i].X > up[j].X) { Rectangle w = up[i]; up[i] = up[j]; up[j] = w; } } } for (int i = 0; i < dow.Count; i++) { for (int j = i; j < dow.Count; j++) 62 { if (dow[i].X > dow[j].X) { Rectangle w = dow[i]; dow[i] = dow[j]; dow[j] = w; } } } int x = 0; int c_x = 0; for (int i = 0; i < up.Count; i++) { Bitmap ch = grayframe.Clone(up[i], grayframe.PixelFormat); Bitmap o = ch; string temp; if (i < 2) { temp = clsBSoft.Ocr(ch, false, full_tesseract, num_tesseract, ch_tesseract, true); // nhan dien so } else { temp = clsBSoft.Ocr(ch, false, full_tesseract, num_tesseract, ch_tesseract, false); // nhan dien chu } zz += temp; box[i].Location = new Point(x + i * 50, 0); box[i].Size = new Size(50, 100); box[i].SizeMode = PictureBoxSizeMode.StretchImage; box[i].Image = ch; panel1.Controls.Add(box[i]); c_x++; } zz += " "; for (int i = 0; i < dow.Count; i++) { Bitmap ch = grayframe.Clone(dow[i], grayframe.PixelFormat); string temp = clsBSoft.Ocr(ch, false, full_tesseract, num_tesseract, ch_tesseract, true); // nhan dien so zz += temp; box[i + c_x].Location = new Point(x + i * 50, 100); box[i + c_x].Size = new Size(50, 100); box[i + c_x].SizeMode = PictureBoxSizeMode.StretchImage; box[i + c_x].Image = ch; panel1.Controls.Add(box[i + c_x]); } string sa = zz.ToString(); sa = sa.Replace("\n" , String.Empty); biensovao.Text = sa; BarcodeWriter barcodeWriter = new BarcodeWriter(); 63 EncodingOptions encodingOptions = new EncodingOptions() { Width = 100, Height = 100, Margin = 0, PureBarcode = false }; encodingOptions.Hints.Add(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H); barcodeWriter.Renderer = new BitmapRenderer(); barcodeWriter.Options = encodingOptions; barcodeWriter.Format = BarcodeFormat.QR_CODE; string xs = biensovao.Text.ToString(); Bitmap bitmap = barcodeWriter.Write(xs); qr.SizeMode = PictureBoxSizeMode.StretchImage; qr.Image = bitmap; PrintDocument pd = new PrintDocument(); pd.PrinterSettings.PrinterName = printer_selected; pd.PrintPage += PrintPage; pd.Print(); byte[] img = null; FileStream Stream = new FileStream(s, FileMode.Open, FileAccess.Read); BinaryReader brs = new BinaryReader(Stream); img = brs.ReadBytes((int)Stream.Length); string sql = "INSERT INTO csdl(ID, BSX, THOIGIAN, HINH) VALUES('" + t.ToString() + "','" + biensovao.Text + "','" + DateTime.Now.ToString() + "', @img)"; connection.Open(); cmd = new SqlCommand(sql, connection); cmd.Parameters.Add(new SqlParameter("@img", img)); cmd.ExecuteNonQuery(); connection.Close(); serialPort1.Write("2"); } finalFrame1.Start(); }//end nhan du lieu uART } } } } Code phần cứng: #include int chuong = 2; int bt = 3; int led1 = 4; int led2 = 7; int dem = 1; int n = 0; int k = 0; int x = 0, y = 0; Servo myservo1; // create servo object to control a servo Servo myservo2; 64 // twelve servo objects can be created on most boards int pos1 = 0; // variable to store the servo position int pos2 = 0; void setup() { / put your setup code here, to run once: pinMode(bt, INPUT_PULLUP); Serial.begin(9600); pinMode(chuong, OUTPUT); pinMode(led1, OUTPUT); pinMode(led2, OUTPUT); digitalWrite(led1, 0); digitalWrite(led2, 0); digitalWrite(chuong, 0); myservo1.attach(9); // attaches the servo on pin to the servo object myservo2.attach(10); } void loop() { int t = digitalRead(bt); if (Serial.available()) { char c = Serial.read(); if (c == '1') { digitalWrite(chuong, 1); delay(200); digitalWrite(chuong, 0); delay(200); } if (c == '2') { for (pos1 = 29; pos1 = 29; pos1 -= 1) { // goes from 180 degrees to degrees myservo1.write(pos1); delay(15); // tell servo to go to position in variable 'pos' // waits 15ms for the servo to reach the position 65 } } if (c == '3') { digitalWrite(led2, 1); for (pos2 = 25; pos2 = 25; pos2 -= 1) { // goes from 180 degrees to degrees myservo2.write(pos2); delay(15); // tell servo to go to position in variable 'pos' // waits 15ms for the servo to reach the position } digitalWrite(led2, 0); delay(1000); } if (c == '4') { digitalWrite(chuong, 1); delay(5000); digitalWrite(chuong, 0); delay(200); } } if (t == 0) { delay(200); dem++; n = 1; } if (dem % == && n == 1) { Serial.write('1'); x = 1; delay(100); n = 0; } else if (n == 1) { 66 Serial.write('0'); x = 1; delay(100); n = 0; } if (x == 1) { Serial.println("Chay SERVO"); / for (pos1 = 29; pos1 = 29; pos1 -= 1) { // goes from 180 degrees to degrees // myservo1.write(pos1); // tell servo to go to position in variable 'pos' // delay(15); // waits 15ms for the servo to reach the position / } x = 0; } } 67 ... nhận diện biển số xe Nội dung 3: Thi? ??t kế thi công hệ thống giao tiếp với camera Nội dung 4: Thi? ??t kế thi công hệ thống giao tiếp với máy in Nội dung 5: Thi? ??t kế thi công hệ thống đối chiếu với... đề tài ? ?Thi? ??t kế thi công hệ thống gửi xe thông minh ”, điều khiển thông qua máy tính kết nối với hệ thống camera 1.2 Mục tiêu đề tài Lưu lại biển số xe in vé Giám sát lịch sử vào nhà xe Cảnh...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 KHOA ĐÀO TẠO CHẤT LƯỢNG CAO ĐỒ ÁN TỐT NGHIỆP Đề tài: THI? ??T KẾ VÀ THI CÔNG HỆ THỐNG GỬI XE THÔNG MINH SVTH: PHẠM

Ngày đăng: 22/12/2021, 06:04