|
|
@@ -95,7 +95,7 @@
|
|
|
<view class="recognition-result" v-if="pestList.length">
|
|
|
<view class="result-title">当前图片识别结果</view>
|
|
|
<!-- 一类害虫 -->
|
|
|
- <view v-if="is_mark == 0">
|
|
|
+ <view>
|
|
|
<view class="pest-category" v-for="(pest,index) in pestList" :key="index">
|
|
|
<view class="category-header">
|
|
|
<text class="category-title">{{ pest[0] }}</text>
|
|
|
@@ -110,7 +110,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view v-else>
|
|
|
+ <!-- <view v-else>
|
|
|
<view class="pest-category" v-for="(pest,index) in pestList" :key="index">
|
|
|
<view class="pest-item">
|
|
|
<view class="pest-info">
|
|
|
@@ -120,7 +120,7 @@
|
|
|
<text class="pest-count">{{ pest[1].value }}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
- </view>
|
|
|
+ </view> -->
|
|
|
</view>
|
|
|
<u-empty v-else text="暂无数据"></u-empty>
|
|
|
<u-calendar
|
|
|
@@ -471,17 +471,16 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
- console.log(markers,'markersmarkers')
|
|
|
this.bugMarkers = markers;
|
|
|
} catch (error) {
|
|
|
console.error('处理label参数失败:', error);
|
|
|
this.bugMarkers = [];
|
|
|
}
|
|
|
} else {
|
|
|
- this.pestList = [];
|
|
|
+ // this.pestList = [];
|
|
|
const markers = [];
|
|
|
// 根据原图宽度计算缩放比例
|
|
|
- let scaleRatio = 4;
|
|
|
+ let scaleRatio = 3.1;
|
|
|
// if (this.imageWidth >= 5000) {
|
|
|
// scaleRatio = 4;
|
|
|
// } else if (this.imageWidth >= 4000) {
|
|
|
@@ -489,31 +488,31 @@ export default {
|
|
|
// } else {
|
|
|
// scaleRatio = 2.5;
|
|
|
// }
|
|
|
- const pestArr = new Map()
|
|
|
+ // const pestArr = new Map()
|
|
|
this.currentImg.mark.map((item, index) => {
|
|
|
- if(pestArr.has(item.text)){
|
|
|
- pestArr.set(item.text,{
|
|
|
- value: pestArr.get(item.text).value+=1,
|
|
|
- text: item.text
|
|
|
- })
|
|
|
- }else{
|
|
|
- pestArr.set(item.text, {
|
|
|
- value: 1,
|
|
|
- text: item.text
|
|
|
- })
|
|
|
- }
|
|
|
- const pestList = []
|
|
|
- for(let key of pestArr){
|
|
|
- pestList.push(key)
|
|
|
- }
|
|
|
- this.pestList = pestList
|
|
|
+ // if(pestArr.has(item.text)){
|
|
|
+ // pestArr.set(item.text,{
|
|
|
+ // value: pestArr.get(item.text).value+=1,
|
|
|
+ // text: item.text
|
|
|
+ // })
|
|
|
+ // }else{
|
|
|
+ // pestArr.set(item.text, {
|
|
|
+ // value: 1,
|
|
|
+ // text: item.text
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ // const pestList = []
|
|
|
+ // for(let key of pestArr){
|
|
|
+ // pestList.push(key)
|
|
|
+ // }
|
|
|
+ // this.pestList = pestList
|
|
|
this.is_mark = 1
|
|
|
const { startX, startY,text } = item;
|
|
|
// 使用缩放比例计算标记位置和尺寸
|
|
|
- const x = (startX * scaleRatio / this.imageWidth) * 100;
|
|
|
- const y = (startY * scaleRatio / this.imageHeight) * 100;
|
|
|
- const width = (item.width * scaleRatio / this.imageWidth) * 100;
|
|
|
- const height = (item.height * scaleRatio / this.imageHeight) * 100;
|
|
|
+ const x = item.width > 0 ? (startX * scaleRatio / this.imageWidth) * 105 : ((startX + item.width) * scaleRatio / this.imageWidth) * 105;
|
|
|
+ const y = item.height > 0 ? (startY * scaleRatio / this.imageHeight) * 105 : ((startY + item.height) * scaleRatio / this.imageHeight) * 105;
|
|
|
+ const width = (item.width > 0 ? item.width : -item.width) * scaleRatio / this.imageWidth * 100;
|
|
|
+ const height = (item.height > 0 ? item.height : -item.height) * scaleRatio / this.imageHeight * 100;
|
|
|
|
|
|
// 从字典中获取虫子名字(尝试字符串和数字两种类型)
|
|
|
const pestName = text;
|