diff --git a/Imgs/mainView.png b/Imgs/mainView.png index 1393148..19578a7 100644 Binary files a/Imgs/mainView.png and b/Imgs/mainView.png differ diff --git a/PLR_Vision.xcodeproj/project.pbxproj b/PLR_Vision.xcodeproj/project.pbxproj index 516b2bc..020ba85 100644 --- a/PLR_Vision.xcodeproj/project.pbxproj +++ b/PLR_Vision.xcodeproj/project.pbxproj @@ -2578,7 +2578,7 @@ "@loader_path/../Frameworks", ); LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/OpenCV"; - MARKETING_VERSION = 2.0.0; + MARKETING_VERSION = 2.0.1; PRODUCT_BUNDLE_IDENTIFIER = "com.inkinc.PLR-Vision"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "PLR_Vision/Others/PLR_Vision-Bridging-Header.h"; @@ -2611,7 +2611,7 @@ "@loader_path/../Frameworks", ); LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/OpenCV"; - MARKETING_VERSION = 2.0.0; + MARKETING_VERSION = 2.0.1; PRODUCT_BUNDLE_IDENTIFIER = "com.inkinc.PLR-Vision"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "PLR_Vision/Others/PLR_Vision-Bridging-Header.h"; diff --git a/PLR_Vision/Assets.xcassets/1.imageset/1.jpg b/PLR_Vision/Assets.xcassets/1.imageset/1.jpg deleted file mode 100644 index ce5966d..0000000 Binary files a/PLR_Vision/Assets.xcassets/1.imageset/1.jpg and /dev/null differ diff --git a/PLR_Vision/Assets.xcassets/StatusBarButtonImage.imageset/Contents.json b/PLR_Vision/Assets.xcassets/StatusBarButtonImage.imageset/Contents.json deleted file mode 100644 index 69b780b..0000000 --- a/PLR_Vision/Assets.xcassets/StatusBarButtonImage.imageset/Contents.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "StatusBarButtonImage@2x.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - }, - "properties" : { - "template-rendering-intent" : "template" - } -} \ No newline at end of file diff --git a/PLR_Vision/Assets.xcassets/StatusBarButtonImage.imageset/StatusBarButtonImage@2x.png b/PLR_Vision/Assets.xcassets/StatusBarButtonImage.imageset/StatusBarButtonImage@2x.png deleted file mode 100644 index 91d14db..0000000 Binary files a/PLR_Vision/Assets.xcassets/StatusBarButtonImage.imageset/StatusBarButtonImage@2x.png and /dev/null differ diff --git a/PLR_Vision/Assets.xcassets/back-arrow.imageset/back-arrow.png b/PLR_Vision/Assets.xcassets/back-arrow.imageset/back-arrow.png deleted file mode 100644 index e72e72c..0000000 Binary files a/PLR_Vision/Assets.xcassets/back-arrow.imageset/back-arrow.png and /dev/null differ diff --git a/PLR_Vision/Assets.xcassets/chinese_flag.imageset/Contents.json b/PLR_Vision/Assets.xcassets/chinese_flag.imageset/Contents.json deleted file mode 100644 index e0a15db..0000000 --- a/PLR_Vision/Assets.xcassets/chinese_flag.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "chinese_flag.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/PLR_Vision/Assets.xcassets/chinese_flag.imageset/chinese_flag.png b/PLR_Vision/Assets.xcassets/chinese_flag.imageset/chinese_flag.png deleted file mode 100644 index 9a0968a..0000000 Binary files a/PLR_Vision/Assets.xcassets/chinese_flag.imageset/chinese_flag.png and /dev/null differ diff --git a/PLR_Vision/Assets.xcassets/choseScan.imageset/Contents.json b/PLR_Vision/Assets.xcassets/choseScan.imageset/Contents.json deleted file mode 100644 index 9379358..0000000 --- a/PLR_Vision/Assets.xcassets/choseScan.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "choseScan.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/PLR_Vision/Assets.xcassets/choseScan.imageset/choseScan.png b/PLR_Vision/Assets.xcassets/choseScan.imageset/choseScan.png deleted file mode 100644 index 3e341e9..0000000 Binary files a/PLR_Vision/Assets.xcassets/choseScan.imageset/choseScan.png and /dev/null differ diff --git a/PLR_Vision/Assets.xcassets/more.imageset/more.png b/PLR_Vision/Assets.xcassets/more.imageset/more.png deleted file mode 100644 index 2af99da..0000000 Binary files a/PLR_Vision/Assets.xcassets/more.imageset/more.png and /dev/null differ diff --git a/PLR_Vision/Assets.xcassets/more_red.imageset/Contents.json b/PLR_Vision/Assets.xcassets/more_red.imageset/Contents.json deleted file mode 100644 index 0465180..0000000 --- a/PLR_Vision/Assets.xcassets/more_red.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "more_red.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/PLR_Vision/Assets.xcassets/more_red.imageset/more_red.png b/PLR_Vision/Assets.xcassets/more_red.imageset/more_red.png deleted file mode 100644 index aa26ff4..0000000 Binary files a/PLR_Vision/Assets.xcassets/more_red.imageset/more_red.png and /dev/null differ diff --git a/PLR_Vision/Assets.xcassets/nextArrow.imageset/Contents.json b/PLR_Vision/Assets.xcassets/nextArrow.imageset/Contents.json deleted file mode 100644 index 68beafa..0000000 --- a/PLR_Vision/Assets.xcassets/nextArrow.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "nextArrow.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/PLR_Vision/Assets.xcassets/nextArrow.imageset/nextArrow.png b/PLR_Vision/Assets.xcassets/nextArrow.imageset/nextArrow.png deleted file mode 100644 index 258058a..0000000 Binary files a/PLR_Vision/Assets.xcassets/nextArrow.imageset/nextArrow.png and /dev/null differ diff --git a/PLR_Vision/Assets.xcassets/plate_blue.imageset/Contents.json b/PLR_Vision/Assets.xcassets/plate_blue.imageset/Contents.json deleted file mode 100644 index 69e9020..0000000 --- a/PLR_Vision/Assets.xcassets/plate_blue.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "plate_blue.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/PLR_Vision/Assets.xcassets/plate_blue.imageset/plate_blue.png b/PLR_Vision/Assets.xcassets/plate_blue.imageset/plate_blue.png deleted file mode 100644 index ee5a460..0000000 Binary files a/PLR_Vision/Assets.xcassets/plate_blue.imageset/plate_blue.png and /dev/null differ diff --git a/PLR_Vision/Assets.xcassets/plate_yellow.imageset/Contents.json b/PLR_Vision/Assets.xcassets/plate_yellow.imageset/Contents.json deleted file mode 100644 index db090d5..0000000 --- a/PLR_Vision/Assets.xcassets/plate_yellow.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "plate_yellow.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/PLR_Vision/Assets.xcassets/plate_yellow.imageset/plate_yellow.png b/PLR_Vision/Assets.xcassets/plate_yellow.imageset/plate_yellow.png deleted file mode 100644 index 9b4868f..0000000 Binary files a/PLR_Vision/Assets.xcassets/plate_yellow.imageset/plate_yellow.png and /dev/null differ diff --git a/PLR_Vision/Assets.xcassets/preArrow.imageset/Contents.json b/PLR_Vision/Assets.xcassets/preArrow.imageset/Contents.json deleted file mode 100644 index db03cda..0000000 --- a/PLR_Vision/Assets.xcassets/preArrow.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "preArrow.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/PLR_Vision/Assets.xcassets/preArrow.imageset/preArrow.png b/PLR_Vision/Assets.xcassets/preArrow.imageset/preArrow.png deleted file mode 100644 index 9f792e1..0000000 Binary files a/PLR_Vision/Assets.xcassets/preArrow.imageset/preArrow.png and /dev/null differ diff --git a/PLR_Vision/Assets.xcassets/1.imageset/Contents.json b/PLR_Vision/Assets.xcassets/radio.imageset/Contents.json similarity index 89% rename from PLR_Vision/Assets.xcassets/1.imageset/Contents.json rename to PLR_Vision/Assets.xcassets/radio.imageset/Contents.json index 5017a6b..7b6feb7 100644 --- a/PLR_Vision/Assets.xcassets/1.imageset/Contents.json +++ b/PLR_Vision/Assets.xcassets/radio.imageset/Contents.json @@ -2,7 +2,7 @@ "images" : [ { "idiom" : "universal", - "filename" : "1.jpg", + "filename" : "radio.png", "scale" : "1x" }, { diff --git a/PLR_Vision/Assets.xcassets/radio.imageset/radio.png b/PLR_Vision/Assets.xcassets/radio.imageset/radio.png new file mode 100644 index 0000000..623f4ea Binary files /dev/null and b/PLR_Vision/Assets.xcassets/radio.imageset/radio.png differ diff --git a/PLR_Vision/Assets.xcassets/back-arrow.imageset/Contents.json b/PLR_Vision/Assets.xcassets/radio_highlighted.imageset/Contents.json similarity index 87% rename from PLR_Vision/Assets.xcassets/back-arrow.imageset/Contents.json rename to PLR_Vision/Assets.xcassets/radio_highlighted.imageset/Contents.json index e4b7e84..ebbd930 100644 --- a/PLR_Vision/Assets.xcassets/back-arrow.imageset/Contents.json +++ b/PLR_Vision/Assets.xcassets/radio_highlighted.imageset/Contents.json @@ -2,7 +2,7 @@ "images" : [ { "idiom" : "universal", - "filename" : "back-arrow.png", + "filename" : "sound-waves.png", "scale" : "1x" }, { diff --git a/PLR_Vision/Assets.xcassets/radio_highlighted.imageset/sound-waves.png b/PLR_Vision/Assets.xcassets/radio_highlighted.imageset/sound-waves.png new file mode 100644 index 0000000..b55de14 Binary files /dev/null and b/PLR_Vision/Assets.xcassets/radio_highlighted.imageset/sound-waves.png differ diff --git a/PLR_Vision/Assets.xcassets/smartScan.imageset/Contents.json b/PLR_Vision/Assets.xcassets/smartScan.imageset/Contents.json deleted file mode 100644 index cddffc8..0000000 --- a/PLR_Vision/Assets.xcassets/smartScan.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "smartScan.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/PLR_Vision/Assets.xcassets/smartScan.imageset/smartScan.png b/PLR_Vision/Assets.xcassets/smartScan.imageset/smartScan.png deleted file mode 100644 index 3ab9388..0000000 Binary files a/PLR_Vision/Assets.xcassets/smartScan.imageset/smartScan.png and /dev/null differ diff --git a/PLR_Vision/Assets.xcassets/videoPlay.imageset/Contents.json b/PLR_Vision/Assets.xcassets/videoPlay.imageset/Contents.json deleted file mode 100644 index c4f6a0d..0000000 --- a/PLR_Vision/Assets.xcassets/videoPlay.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "videoPlay.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/PLR_Vision/Assets.xcassets/videoPlay.imageset/videoPlay.png b/PLR_Vision/Assets.xcassets/videoPlay.imageset/videoPlay.png deleted file mode 100644 index d6a1465..0000000 Binary files a/PLR_Vision/Assets.xcassets/videoPlay.imageset/videoPlay.png and /dev/null differ diff --git a/PLR_Vision/Assets.xcassets/videobg.imageset/Contents.json b/PLR_Vision/Assets.xcassets/videobg.imageset/Contents.json deleted file mode 100644 index 2bdd33c..0000000 --- a/PLR_Vision/Assets.xcassets/videobg.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "videobg.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/PLR_Vision/Assets.xcassets/videobg.imageset/videobg.png b/PLR_Vision/Assets.xcassets/videobg.imageset/videobg.png deleted file mode 100644 index 8fa5ded..0000000 Binary files a/PLR_Vision/Assets.xcassets/videobg.imageset/videobg.png and /dev/null differ diff --git a/PLR_Vision/Assets.xcassets/more.imageset/Contents.json b/PLR_Vision/Assets.xcassets/wave_1.imageset/Contents.json similarity index 89% rename from PLR_Vision/Assets.xcassets/more.imageset/Contents.json rename to PLR_Vision/Assets.xcassets/wave_1.imageset/Contents.json index 64c6f6b..c371dc1 100644 --- a/PLR_Vision/Assets.xcassets/more.imageset/Contents.json +++ b/PLR_Vision/Assets.xcassets/wave_1.imageset/Contents.json @@ -2,7 +2,7 @@ "images" : [ { "idiom" : "universal", - "filename" : "more.png", + "filename" : "wave_1.png", "scale" : "1x" }, { diff --git a/PLR_Vision/Assets.xcassets/wave_1.imageset/wave_1.png b/PLR_Vision/Assets.xcassets/wave_1.imageset/wave_1.png new file mode 100644 index 0000000..9d024d0 Binary files /dev/null and b/PLR_Vision/Assets.xcassets/wave_1.imageset/wave_1.png differ diff --git a/PLR_Vision/Controller/AboutViewController.swift b/PLR_Vision/Controller/AboutViewController.swift index 9a9d512..786c425 100644 --- a/PLR_Vision/Controller/AboutViewController.swift +++ b/PLR_Vision/Controller/AboutViewController.swift @@ -18,7 +18,7 @@ class AboutViewController: NSViewController { view.wantsLayer = true // CGColor(red: 249 / 255, green: 241 / 255, blue: 233 / 255, alpha: 0.6) - view.layer?.backgroundColor = CGColor(red: 0 / 255, green: 0 / 255, blue: 0 / 255, alpha: 0.8) + view.layer?.backgroundColor = CGColor.clear detailView.wantsLayer = true detailView.layer?.backgroundColor = L_Yellow @@ -32,25 +32,25 @@ class AboutViewController: NSViewController { // 项目地址 @IBAction func showProjectPage(_ sender: NSButton) { - let url = URL(fileURLWithPath: "https://github.com/NathanYu1124/PLR_Vision") + let url = URL(string: "https://github.com/NathanYu1124/PLR_Vision")! NSWorkspace.shared.open(url) } // 关于我们 @IBAction func showUsPage(_ sender: NSButton) { - let url = URL(fileURLWithPath: "https://github.com/NathanYu1124/PLR_Vision") + let url = URL(string: "https://github.com/NathanYu1124/PLR_Vision")! NSWorkspace.shared.open(url) } // 帮助支持 @IBAction func showHelpPage(_ sender: NSButton) { - let url = URL(fileURLWithPath: "https://github.com/NathanYu1124/PLR_Vision") + let url = URL(string: "https://github.com/NathanYu1124/PLR_Vision")! NSWorkspace.shared.open(url) } // 更新日志 @IBAction func showLogPage(_ sender: NSButton) { - let url = URL(fileURLWithPath: "https://github.com/NathanYu1124/PLR_Vision/releases") + let url = URL(string: "https://github.com/NathanYu1124/PLR_Vision/releases")! NSWorkspace.shared.open(url) } } diff --git a/PLR_Vision/Controller/ImageViewController.swift b/PLR_Vision/Controller/ImageViewController.swift index c7a0516..4637083 100644 --- a/PLR_Vision/Controller/ImageViewController.swift +++ b/PLR_Vision/Controller/ImageViewController.swift @@ -7,6 +7,7 @@ // import Cocoa +import AVFoundation class ImageViewController: NSViewController { @@ -23,12 +24,15 @@ class ImageViewController: NSViewController { @IBOutlet weak var timeView: TimeView! @IBOutlet weak var contentView: NSView! @IBOutlet weak var recordsView: RecordsView! + @IBOutlet weak var audioButton: NSButton! private var preImage: NSImage! private var dictModels: [PlateInfoModel]! private var plateIndex: Int = 0 private var records: Int = 0 + private var soundPlayer: AVAudioPlayer? + // MARK: - View lifeCycle override func viewDidLoad() { @@ -198,4 +202,51 @@ class ImageViewController: NSViewController { updateUI(plateModel: dictModels[plateIndex]) } } + + @IBAction func playSound(_ sender: NSButton) { + + if let player = soundPlayer { + if player.isPlaying { return } + } + + let currentLicense = dictModels[plateIndex].plateLicense! as NSString + + // 后台播放音乐 + DispatchQueue.global().async { + self.playPlateSound(license: currentLicense) + } + } + +} + +// MARK: - 音频处理 +extension ImageViewController { + + // 播放车牌号码 + func playPlateSound(license: NSString) { + + + for i in 0...6 { + // 加载音效 + let audioName = license.substring(with: NSMakeRange(i, 1)) + guard let audioFileUrl = Bundle.main.url(forResource: audioName, withExtension: "mp3") else { return } + + do { + soundPlayer = try AVAudioPlayer(contentsOf: audioFileUrl) + soundPlayer?.enableRate = true + soundPlayer?.rate = 2.0 + soundPlayer?.prepareToPlay() + } catch { + print("Sound player not available: \(error)") + } + + // 播放 + soundPlayer?.play() + + while(soundPlayer!.isPlaying) { + + } + } + } + } diff --git a/PLR_Vision/Controller/LoadingViewController.swift b/PLR_Vision/Controller/LoadingViewController.swift index 78f6bb4..6df8be3 100644 --- a/PLR_Vision/Controller/LoadingViewController.swift +++ b/PLR_Vision/Controller/LoadingViewController.swift @@ -22,6 +22,7 @@ class LoadingViewController: NSViewController { SVM_MODEL_PATH = Bundle.main.path(forResource: "svm", ofType: "xml") CNN_CHAR_MODEL_PATH = Bundle.main.path(forResource: "CNN_CHAR_MODEL", ofType: "md") CNN_ZH_MODEL_PATH = Bundle.main.path(forResource: "CNN_ZH63_MODEL", ofType: "md") - CACHE_PATH = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).last + CACHE_PATH = NSTemporaryDirectory() + } } diff --git a/PLR_Vision/Others/AppDelegate.swift b/PLR_Vision/Others/AppDelegate.swift index b434784..a03fe62 100644 --- a/PLR_Vision/Others/AppDelegate.swift +++ b/PLR_Vision/Others/AppDelegate.swift @@ -11,16 +11,16 @@ import Cocoa @NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate { - // 创建状态栏 - let statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength) +// // 创建状态栏 +// let statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength) func applicationDidFinishLaunching(_ aNotification: Notification) { - // 设置状态栏Item - if let button = statusItem.button { - button.image = NSImage(named: NSImage.Name("StatusBarButtonImage")) - button.action = #selector(showPopMenu(_:)) - } +// // 设置状态栏Item +// if let button = statusItem.button { +// button.image = NSImage(named: NSImage.Name("StatusBarButtonImage")) +// button.action = #selector(showPopMenu(_:)) +// } } @objc func showPopMenu(_ sender: Any?) { diff --git a/PLR_Vision/Others/Main.storyboard b/PLR_Vision/Others/Main.storyboard index 64a04a0..0a65397 100644 --- a/PLR_Vision/Others/Main.storyboard +++ b/PLR_Vision/Others/Main.storyboard @@ -229,6 +229,9 @@ + + + @@ -241,8 +244,8 @@ - - + + @@ -413,7 +416,11 @@ + + + + @@ -438,7 +445,7 @@ - + @@ -485,7 +492,7 @@ - + @@ -581,7 +588,7 @@ - + @@ -1035,7 +1042,7 @@ - + @@ -1206,18 +1213,18 @@ - + - + - + - + @@ -1236,7 +1243,7 @@ - @@ -1327,7 +1350,7 @@ -