* 处理图片
()
| 491 | * 处理图片 |
| 492 | */ |
| 493 | async processImage() { |
| 494 | if (!this.originalImage || this.isProcessing) return; |
| 495 | |
| 496 | try { |
| 497 | this.isProcessing = true; |
| 498 | this.showProgress(0, '开始处理...'); |
| 499 | |
| 500 | const mode = document.querySelector('input[name="detectionMode"]:checked').value; |
| 501 | |
| 502 | if (mode === 'auto') { |
| 503 | await this.processAutoMode(); |
| 504 | } else { |
| 505 | await this.processManualMode(); |
| 506 | } |
| 507 | |
| 508 | this.showPreview(); |
| 509 | this.hideProgress(); |
| 510 | |
| 511 | } catch (error) { |
| 512 | console.error('Processing failed:', error); |
| 513 | this.showError('处理失败: ' + error.message); |
| 514 | } finally { |
| 515 | this.isProcessing = false; |
| 516 | } |
| 517 | } |
| 518 | |
| 519 | async processAutoMode() { |
| 520 | this.showProgress(20, '分析像素块结构...'); |
no test coverage detected