|
@ -48,6 +48,7 @@ |
|
|
v-model="simulation_brightness" |
|
|
v-model="simulation_brightness" |
|
|
:min="0" |
|
|
:min="0" |
|
|
:max="65535" |
|
|
:max="65535" |
|
|
|
|
|
:disabled="!isCameraOpen" |
|
|
@change="handleSimulationBrightness" |
|
|
@change="handleSimulationBrightness" |
|
|
/> |
|
|
/> |
|
|
<p class="number">{{ simulation_brightness }}</p> |
|
|
<p class="number">{{ simulation_brightness }}</p> |
|
@ -56,6 +57,7 @@ |
|
|
<p class="title">曝光时间</p> |
|
|
<p class="title">曝光时间</p> |
|
|
<t-slider |
|
|
<t-slider |
|
|
v-model="exposure" |
|
|
v-model="exposure" |
|
|
|
|
|
:disabled="!isCameraOpen" |
|
|
:min="0" |
|
|
:min="0" |
|
|
:max="100000" |
|
|
:max="100000" |
|
|
@change="handleExposureTime" |
|
|
@change="handleExposureTime" |
|
@ -70,7 +72,7 @@ |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="identify_results"> |
|
|
<div class="identify_results"> |
|
|
<p class="title">识别结果</p> |
|
|
|
|
|
|
|
|
<p class="title">结果</p> |
|
|
<div class="result">{{ recognitionResult }}</div> |
|
|
<div class="result">{{ recognitionResult }}</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
@ -123,7 +125,7 @@ import { |
|
|
import { MessagePlugin } from 'tdesign-vue-next' |
|
|
import { MessagePlugin } from 'tdesign-vue-next' |
|
|
|
|
|
|
|
|
const photoUrl = ref('') |
|
|
const photoUrl = ref('') |
|
|
const recognitionResult = ref({}) |
|
|
|
|
|
|
|
|
const recognitionResult = ref('') |
|
|
|
|
|
|
|
|
setInterval( |
|
|
setInterval( |
|
|
() => { |
|
|
() => { |
|
@ -171,10 +173,20 @@ const handleStopCharacterRecognition = () => { |
|
|
websocketsend(stopCharacterRecognition) |
|
|
websocketsend(stopCharacterRecognition) |
|
|
} |
|
|
} |
|
|
const handleGetCharacterRecognitionResult = () => { |
|
|
const handleGetCharacterRecognitionResult = () => { |
|
|
|
|
|
if (isCameraOpen.value) { |
|
|
|
|
|
// 如果相机打开则发送拍照,如果相机关闭 则提醒用户 |
|
|
websocketsend(getCharacterRecognitionResult) |
|
|
websocketsend(getCharacterRecognitionResult) |
|
|
|
|
|
} else { |
|
|
|
|
|
MessagePlugin('error', { content: '请先开启相机' }) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
const handleGetMechanicalArmState = () => { |
|
|
const handleGetMechanicalArmState = () => { |
|
|
|
|
|
if (isCameraOpen.value) { |
|
|
|
|
|
// 如果相机打开则发送拍照,如果相机关闭 则提醒用户 |
|
|
websocketsend(getMechanicalArmState) |
|
|
websocketsend(getMechanicalArmState) |
|
|
|
|
|
} else { |
|
|
|
|
|
MessagePlugin('error', { content: '请先开启相机' }) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const handleOpenFlashLight = () => { |
|
|
const handleOpenFlashLight = () => { |
|
@ -243,6 +255,16 @@ const websocketonmessage = e => { |
|
|
const { isOpen } = cameraState |
|
|
const { isOpen } = cameraState |
|
|
isCameraOpen.value = isOpen |
|
|
isCameraOpen.value = isOpen |
|
|
break |
|
|
break |
|
|
|
|
|
case 'getMechanicalArmState': |
|
|
|
|
|
const { state } = data |
|
|
|
|
|
const { x, y } = state || {} |
|
|
|
|
|
recognitionResult.value = `机械臂坐标x:${x}, y: ${y}` |
|
|
|
|
|
break |
|
|
|
|
|
case 'takeAndSavePhoto': |
|
|
|
|
|
const { photoInfo } = data |
|
|
|
|
|
const { path } = photoInfo |
|
|
|
|
|
recognitionResult.value = `图片保存路径为${path}` |
|
|
|
|
|
break |
|
|
case 'getCameraParametersInteger': |
|
|
case 'getCameraParametersInteger': |
|
|
const { value } = data |
|
|
const { value } = data |
|
|
exposure.value = value |
|
|
exposure.value = value |
|
@ -259,7 +281,10 @@ const websocketonmessage = e => { |
|
|
break |
|
|
break |
|
|
case 'getCharacterRecognitionResult': |
|
|
case 'getCharacterRecognitionResult': |
|
|
const { result } = data |
|
|
const { result } = data |
|
|
recognitionResult.value = result |
|
|
|
|
|
|
|
|
const { result: str, srcImagePath } = result || {} |
|
|
|
|
|
recognitionResult.value = `识别结果为${ |
|
|
|
|
|
str ? str : '空结果' |
|
|
|
|
|
}, 图片保存路径为${srcImagePath}` |
|
|
break |
|
|
break |
|
|
default: |
|
|
default: |
|
|
break |
|
|
break |
|
|