v1.2.0

v1.2.0 เป็นรุ่นใหม่ที่ใหญ่มากและวางรากฐาน: สร้าง imaging API แบบคลาสสิกของ OpenMV ส่วนใหญ่ ได้แก่ เมธอด drawing, การดำเนินการ binary / morphology, keypoint descriptors (FAST / FREAK / LBP), การแปลงสีและ image.statistics, ไฟล์ I/O แบบ BMP / PPM / JPEG, โมดูล lcd, mjpeg, gif และ mlx thermal, กล้อง OV7725 และตัวควบคุม sensor อีกมากมาย พฤติกรรมหลักบางอย่างของ sensor เปลี่ยนแปลงไป — โปรดอ่านการเปลี่ยนแปลงที่ไม่เข้ากันด้านล่าง

ไฮไลต์

  • Drawing APIdraw_line() / draw_rectangle() / draw_circle() / draw_string() / draw_cross() / draw_keypoints()

  • Binary / morphologybinary(), invert(), and/or/xor/..., erode() / dilate() / morph(), negate() / difference()

  • Keypoints — FAST / FREAK / LBP descriptors พร้อม match_descriptor() / save_descriptor() / load_descriptor()

  • โมดูลใหม่lcd, mjpeg, gif (สี) และ mlx thermal

  • รองรับกล้อง OV7725; image.statistics; ไฟล์ I/O แบบ BMP/PPM/JPEG

  • เปลี่ยนแปลงครั้งใหญ่: พฤติกรรมของ sensor.reset(), sensor.snapshot() และ sensor.set_pixformat() เปลี่ยนแปลงไป — ดูการเปลี่ยนแปลงที่ไม่เข้ากัน

ฟีเจอร์ใหม่

  • Drawing — เพิ่ม image.draw_line() / draw_rectangle() / draw_circle() / draw_string() / draw_cross() / draw_keypoints() พร้อม keyword arguments (color, thickness, …)

  • Binary / morphology — เพิ่ม image.binary(), invert(), and() / nand() / or() / nor() / xor() / xnor(), erode() / dilate() / morph(), negate() / difference(), pixels(), centroid(), orientation_radians() / orientation_degrees() และ width() / height() / format()

  • Keypoints / descriptors — การดึง FAST keypoint ผ่าน find_keypoints(), match_descriptor() แบบรวม และ save_descriptor() / load_descriptor() สำหรับ FREAK / LBP รวมถึง Haar/LBP cascade สำหรับใบหน้าด้านข้าง

  • Color / statisticsimage.statistics และฟังก์ชันแปลงสี (rgb_to_lab / lab_to_rgb / rgb_to_grayscale / grayscale_to_rgb)

  • ไฟล์ I/O — โหลดและบันทึก BMP / PPM (P2/P3/P5/P6) / JPEG (รวมถึง JPEG ระดับสีเทา และ chroma subsampling 4:2:0 / 4:2:2)

  • โมดูลlcd ใหม่ (LCD shield), mjpeg (บันทึกวิดีโอ), gif แบบสี (พร้อม Gif.loop()), และโมดูล thermal camera mlx แต่ละโมดูลมีสคริปต์ตัวอย่าง

  • Sensor — เพิ่ม sensor.get_id() (+ ค่าคงที่ PID สำหรับ OV9650/OV2640/OV7725), sensor.set_special_effect() (ค่าคงที่ SDE_*), sensor.set_image_filter() (FILTER_BW / FILTER_SKIN), ขนาดเฟรม HQVGA และ image.set_pixel(x, y, …)

  • WiFi — เพิ่ม WiFi driver สำหรับ ATWINC1500 และฐานรากสำหรับ OpenMV 1/2 BSP รวมถึงตัวอย่าง BLE

การเปลี่ยนแปลงและการปรับปรุงอื่นๆ

  • ตอนนี้ framebuffer ถูกบีบอัด JPEG ก่อนส่งไปยัง OpenMV IDE (ลด bandwidth); การบีบอัด JPEG ทำ in-place; การ H/V zoom ของ OV7725 รองรับการปรับขนาดตามอำเภอใจ; การตรวจจับใบหน้า Haar ที่ดีขึ้น (เร็วกว่า) ทำงานที่ QVGA

การแก้ไขบัก

Imaging:

  • แก้ไขการคำนวณ integral-image, ความเสียหายจาก median() filter, การคำนวณ centroid, ฟิลเตอร์ RGB skin / ขาวดำบน RGB input และการอ่าน/เขียน BMP/PPM ระดับสีเทาที่เร็วขึ้น

Sensor และระบบ:

  • แก้ไข timers ของ pyb.Servo (Servo ทำงานได้แล้ว), ความละเอียด HQVGA, ความน่าเชื่อถือของ SD-card init, การเริ่มต้น storage ใหม่หลัง soft-reset และการรัน REPL ใหม่เมื่อไม่มีสคริปต์

ฮาร์ดแวร์และการรองรับบอร์ด

  • เซนเซอร์กล้อง OV7725

  • LCD shield (โมดูล lcd), กล้อง thermal mlx และฐาน WiFi ATWINC1500

การเปลี่ยนแปลง API ที่ไม่เข้ากัน

การเปลี่ยนแปลง API ที่ผู้ใช้มองเห็นได้ระหว่าง v1.1.0 และ v1.2.0 ขอบเขต: Python C-modules ใน modules/ และไลบรารี Python ใน scripts/libraries/

การเปลี่ยนแปลงที่ไม่เข้ากันทั้งสามรายการล้วนเป็นการเปลี่ยน behavior ของฟังก์ชัน sensor หลัก (API เหมือนเดิม แต่พฤติกรรมต่างออกไป) — ตรวจสอบสคริปต์ที่ได้รับผลกระทบอีกครั้ง แต่ละ commit hash มีลิงก์ไปยัง diff บน GitHub (ส่วนใหญ่ของรุ่นนี้เป็น API ใหม่ที่เพิ่มเติมในช่วง v1.1→v1.2 จึงเป็นการเพิ่มเติม ไม่ใช่การเปลี่ยนแปลงที่ไม่เข้ากัน)

sensor.reset() ไม่ใช้การตั้งค่า default อีกต่อไป (behavior)

sensor.reset() ไม่ใช้การตั้งค่าเริ่มต้นในตัวอีกต่อไป (pixformat / framesize / framerate / gain / contrast / brightness / saturation) สคริปต์ที่พึ่งพา reset() ให้ค่า default ที่ใช้งานได้ ต้องเรียก sensor.set_pixformat() และ sensor.set_framesize() (รวมถึงการตั้งค่าอื่นๆ) หลัง reset() อย่างชัดเจน

Commits: d1e782df3

sensor.snapshot() แสดง error เมื่อ timeout (behavior)

sensor.snapshot() ตอนนี้จะแสดง RuntimeError("Sensor Timeout!!") เมื่อเซนเซอร์ timeout แทนที่จะค้างตลอดไป ให้ครอบ snapshot() ด้วย try / except RuntimeError หากต้องการรับมือกับ timeout

Commits: e3f41d674

sensor.set_pixformat() แสดง error เมื่อรูปแบบไม่รองรับ (behavior)

sensor.set_pixformat() ตอนนี้จะแสดง exception เมื่อได้รับ pixel format ที่ไม่รองรับ แทนที่จะคืน False โค้ดที่ตรวจสอบค่าคืน False ต้องเปลี่ยนมา catch exception แทน

Commits: e0c5822c2

Migration checklist

สำหรับการแก้ไขให้เข้ากับ v1.2.0 งานทั่วไปที่ต้องทำ:

  1. เรียก sensor.set_pixformat() / sensor.set_framesize() อย่างชัดเจนหลัง sensor.reset() (การเปลี่ยน reset)

  2. ครอบ sensor.snapshot() ด้วย try / except RuntimeError หากต้องการรับมือกับ sensor timeout (การเปลี่ยน snapshot)

  3. Catch exception จาก sensor.set_pixformat() แทนการตรวจสอบค่า False (การเปลี่ยน set_pixformat)

สคริปต์อื่นๆ ทั้งหมดทำงานได้โดยไม่ต้องเปลี่ยนแปลง