Commit 0c999ad4 by 李乾广

修改bug,数据聚类--单张特征对比功能优化

1 parent 57a5e9d7
...@@ -17,7 +17,8 @@ class FeatureResultApi { ...@@ -17,7 +17,8 @@ class FeatureResultApi {
return axiosInstance.request( return axiosInstance.request(
{ {
method: 'GET', method: 'GET',
url: `/feature/allPersonContrast`, // url: `/feature/allPersonContrast`,
url: `/feature/allPersonContrastGroup`,
params: filterEmptyValueInObject( params: filterEmptyValueInObject(
data data
) )
......
...@@ -630,6 +630,8 @@ export default { ...@@ -630,6 +630,8 @@ export default {
let parmas = { let parmas = {
person_unid:currobj.value.person_unid, person_unid:currobj.value.person_unid,
pic_type:rawData.picType, pic_type:rawData.picType,
endTime:rawData.endTime,
startTime:rawData.startTime,
countdate:formatDate(rawData.date), countdate:formatDate(rawData.date),
pic_id:currobj.value.id, pic_id:currobj.value.id,
ip:window._baseImgUrl, ip:window._baseImgUrl,
......
...@@ -105,6 +105,9 @@ ...@@ -105,6 +105,9 @@
<a-form-item style="padding: 5px 0"> <a-form-item style="padding: 5px 0">
<a-button type="primary" @click="comparativeFun">特征对比验证</a-button> <a-button type="primary" @click="comparativeFun">特征对比验证</a-button>
</a-form-item> </a-form-item>
<a-form-item style="padding: 5px 0">
<a-button type="primary" @click="singleComparativeFun">单张特征对比</a-button>
</a-form-item>
</a-form> </a-form>
<div v-loading="isLoading"> <div v-loading="isLoading">
...@@ -150,6 +153,7 @@ ...@@ -150,6 +153,7 @@
</div> </div>
<!-- <imgDialog ref='imgModelRef'></imgDialog> --> <!-- <imgDialog ref='imgModelRef'></imgDialog> -->
<DetailDialog ref="DetailDialogRef" /> <DetailDialog ref="DetailDialogRef" />
<singleImgComparisonDialog ref="singleImgComparisonRef"></singleImgComparisonDialog>
</template> </template>
<script> <script>
...@@ -161,10 +165,12 @@ import {filterEmptyValueInObject, formatDate, formatTime, getPagedList} from '@/ ...@@ -161,10 +165,12 @@ import {filterEmptyValueInObject, formatDate, formatTime, getPagedList} from '@/
// import imgDialog from '../imgDialog.vue' // import imgDialog from '../imgDialog.vue'
import {ElMessage} from 'element-plus' import {ElMessage} from 'element-plus'
import DetailDialog from "../../ComparisonCapturedPictures/DetailDialog.vue"; import DetailDialog from "../../ComparisonCapturedPictures/DetailDialog.vue";
import singleImgComparisonDialog from "../singleImgComparisonDialog.vue";
export default { export default {
components:{ components:{
// imgDialog , // imgDialog ,
DetailDialog DetailDialog,
singleImgComparisonDialog
}, },
setup() { setup() {
// scalar // scalar
...@@ -512,6 +518,40 @@ export default { ...@@ -512,6 +518,40 @@ export default {
} }
DetailDialogRef.value.initDialog(currobj.value,parmas); DetailDialogRef.value.initDialog(currobj.value,parmas);
} }
//单张特征对比
const singleImgComparisonRef = ref()
const singleComparativeFun = function(){
if(!currobj.value.id){
ElMessage(
{
message: `请选择图片`,
type: 'warning'
}
)
return
}
if(!currobj.value.picture_url){
ElMessage(
{
message: `该图片没有特征,请选择有效的图片`,
type: 'warning'
}
)
return
}
const rawData = toRaw(queryForm)
let parmas = {
person_unid:currobj.value.person_unid,
pic_type:rawData.picType,
endTime:rawData.endTime,
startTime:rawData.startTime,
countdate:formatDate(rawData.date),
pic_id:currobj.value.id,
ip:window._baseImgUrl,
plaza_id:currobj.value.mall_id
}
singleImgComparisonRef.value.initDialog(parmas);
}
const clickSearch = function() { const clickSearch = function() {
pageNum.value = 1 pageNum.value = 1
confirmSearch() confirmSearch()
...@@ -557,7 +597,9 @@ export default { ...@@ -557,7 +597,9 @@ export default {
clickSearch, clickSearch,
// ref // ref
DetailDialogRef, DetailDialogRef,
imgModelRef imgModelRef,
singleComparativeFun,
singleImgComparisonRef
} }
} }
} }
......
<template> <template>
<a-modal <a-modal
title="图片" :title="'图片' + ' ' + unidStr"
v-if='isVisible' v-if='isVisible'
v-model:visible="isVisible" v-model:visible="isVisible"
width="1200px" width="1200px"
...@@ -25,8 +25,11 @@ export default { ...@@ -25,8 +25,11 @@ export default {
const imgUrl = ref() const imgUrl = ref()
const canvas = ref() const canvas = ref()
const ctx = ref() const ctx = ref()
const initDialog = (url,data) => { const unidStr = ref('')
const initDialog = (unid,url,data) => {
console.log(unid,url,data,)
imgUrl.value = url imgUrl.value = url
unidStr.value = unid
isVisible.value = true; isVisible.value = true;
setTimeout(()=>{ setTimeout(()=>{
var imgscream=document.getElementById("img"); var imgscream=document.getElementById("img");
...@@ -56,6 +59,7 @@ export default { ...@@ -56,6 +59,7 @@ export default {
initDialog, initDialog,
isLoading, isLoading,
imgUrl, imgUrl,
unidStr,
detailData detailData
}; };
}, },
......
<template> <template>
<a-modal <a-modal title="单张图片特征对比" v-if='isVisible' v-model:visible="isVisible" width="1066px" height='90%'
title="单张图片特征对比" class="detail-modal">
v-if='isVisible' <el-row :gutter="20">
v-model:visible="isVisible" <el-col :span="12" class='imgBox1' v-loading='isLoading'>
width="1600px" <p class="title">
height='90%' <span class="name">现在聚类</span>
class="detail-modal" <span class="id">{{detailData.person_unid}}</span>
> <span class="num">{{featureList.length}}</span>
<el-row :gutter="20"> </p>
<el-col :span="8" class='imgBox1' v-loading='isLoading'> <el-row :gutter="10" class="imgBox1_top">
<p class="title"> <el-col :span="8" class="itemBox" v-for="item in featureList">
<span class="name">现在聚类</span> <el-image :src="item.picture_url" :fit="'fill'" class="single-image" @click='clickItem(item)'>
<span class="id">{{detailData.person_unid}}</span> </el-image>
<span class="num">{{featureList.length}}</span> <span class="el-icon-document downloadFile" @click="downloadFile(item,$event)"></span>
</p> <span class="el-icon-picture-outline openImage" @click="openImage(item,$event)"></span>
<el-row :gutter="10" class="imgBox1_top"> <p class="featureNum">{{(item.featureNum).toFixed(2)}}</p>
<el-col :span="8" class="itemBox" v-for="item in featureList"> <div>时间:{{ item.counttime }}</div>
<el-image :src="item.picture_url" :fit="'fill'" class="single-image" @click='clickItem(item)'> <div>人员类型:{{ item.person_type==1?'店员':'顾客' }}</div>
</el-image> <div class="direction" :class="'direction'+item.direction">方向:{{ formatDirection(item.direction) }}</div>
<span class="el-icon-document downloadFile" @click="downloadFile(item,$event)"></span> <div>地点:{{ item.gate_name }}</div>
<span class="el-icon-picture-outline openImage" @click="openImage(item,$event)"></span> </el-col>
<p class="featureNum">{{(item.featureNum).toFixed(2)}}</p> <a-empty v-if='featureList.length==0' style='margin: 0 auto;'></a-empty>
<div>时间:{{ item.counttime }}</div> </el-row>
<div>人员类型:{{ item.person_type==1?'店员':'顾客' }}</div> </el-col>
<div class="direction" :class="'direction'+item.direction">方向:{{ formatDirection(item.direction) }}</div> <el-col :span="12" class='imgBox1' v-loading='isLoading1'>
<div>地点:{{ item.gate_name }}</div> <p class="title">
</el-col> <span class="name">特征比对</span>
<a-empty v-if='featureList.length==0' style='margin: 0 auto;'></a-empty> <span class="num">{{comparisonList&&comparisonList.length > 0?comparisonList[0].numLength:0}}</span>
</el-row> </p>
</el-col> <el-row class="imgBox1_top">
<el-col :span="8" class='imgBox1' v-loading='isLoading1'> <el-row :gutter="10" v-for="(one,ind) in comparisonList" style="width: 100%;">
<p class="title"> <div style="height: 30px;line-height: 30px;width: 100%;padding-left: 5px;margin-bottom: 5px;">
<span class="name">特征比对</span> {{one.person_unid}}
<span class="num">{{comparisonList.length}}</span> <span style="float: right;padding-right: 11px;" v-if="one.personList">{{one.personList.length}}</span>
</p> </div>
<el-row :gutter="10" class="imgBox1_top"> <el-col :span="8" class="itemBox" v-for="(item,index) in one.personList">
<el-col :span="8" class="itemBox" v-for="item in comparisonList"> <el-image :src="item.picture_url" :fit="'fill'" class="single-image" @click='clickItem(item)'></el-image>
<el-image :src="item.picture_url" :fit="'fill'" class="single-image" @click='clickItem(item)'> <span class="el-icon-picture-outline openImage" @click="openImage(item,$event)"></span>
</el-image> <span class="el-icon-document downloadFile" @click="downloadFile(item,$event)"></span>
<span class="el-icon-picture-outline openImage" @click="openImage(item,$event)"></span> <p class="featureNum">{{item.featureNum?(item.featureNum).toFixed(2):0}}</p>
<span class="el-icon-document downloadFile" @click="downloadFile(item,$event)"></span> <div>时间:{{ item.counttime }}</div>
<p class="featureNum">{{item.featureNum?(item.featureNum).toFixed(2):0}}</p> <div>人员类型:{{ item.person_type==1?'店员':'顾客' }}</div>
<div>时间:{{ item.counttime }}</div> <div class="direction" :class="'direction'+item.direction">方向:{{ formatDirection(item.direction) }}</div>
<div>人员类型:{{ item.person_type==1?'店员':'顾客' }}</div> <div>地点:{{ item.gate_name }}</div>
<div class="direction" :class="'direction'+item.direction">方向:{{ formatDirection(item.direction) }}</div> </el-col>
<div>地点:{{ item.gate_name }}</div> </el-row>
</el-col> <a-empty v-if='comparisonList.length==0' style='margin: 0 auto;'></a-empty>
<a-empty v-if='comparisonList.length==0' style='margin: 0 auto;'></a-empty> </el-row>
</el-row> </el-col>
</el-col> <!-- <el-col :span="8" class='imgBox1' v-loading='isLoading2'>
<el-col :span="8" class='imgBox1' v-loading='isLoading2'>
<p class="title"> <p class="title">
<span class="name">重提特征后比对</span> <span class="name">重提特征后比对</span>
<a-button class="id" type="primary" @click="reComparisonFeature" >重提特征比对</a-button> <a-button class="id" type="primary" @click="reComparisonFeature" >重提特征比对</a-button>
...@@ -69,251 +68,287 @@ ...@@ -69,251 +68,287 @@
</el-col> </el-col>
<a-empty v-if='reComparisonList.length==0' style='margin: 0 auto;'></a-empty> <a-empty v-if='reComparisonList.length==0' style='margin: 0 auto;'></a-empty>
</el-row> </el-row>
</el-col> </el-col> -->
</el-row> </el-row>
<template #footer> <template #footer>
<a-button @click="onCancel">返回</a-button> <a-button @click="onCancel">返回</a-button>
</template> </template>
</a-modal> </a-modal>
<imgDialog ref='imgModelRef'></imgDialog> <imgDialog ref='imgModelRef'></imgDialog>
<imgOtherDialog ref="imgOtherDialogRef" ></imgOtherDialog> <imgOtherDialog ref="imgOtherDialogRef"></imgOtherDialog>
</template> </template>
<script> <script>
import { reactive, ref, watch } from "vue"; import {
import featureApi from '@/views/FeatureComparisonVerification/api.js' reactive,
import clusterResultApi from '@/views/SnapshotCluster/ClusterResult/ClusterResultApi' ref,
import {isArray} from '@/PublicUtil/Judgment' watch
import imgDialog from './imgDialog.vue' } from "vue";
import imgOtherDialog from "../ComparisonCapturedPictures/imgOtherDialog.vue"; import featureApi from '@/views/FeatureComparisonVerification/api.js'
export default { import clusterResultApi from '@/views/SnapshotCluster/ClusterResult/ClusterResultApi'
components:{ import {
imgDialog, isArray
imgOtherDialog } from '@/PublicUtil/Judgment'
}, import imgDialog from './imgDialog.vue'
setup() { import imgOtherDialog from "../ComparisonCapturedPictures/imgOtherDialog.vue";
const isVisible = ref(false); export default {
const isLoading = ref(false); components: {
const isLoading1 = ref(false); imgDialog,
const isLoading2= ref(false); imgOtherDialog
const detailData = ref({}); },
const featureList = ref([]) setup() {
const imgModelRef = ref(); const isVisible = ref(false);
const imgOtherDialogRef = ref(); const isLoading = ref(false);
const comparisonList = ref([]) const isLoading1 = ref(false);
const reComparisonList = ref([]) const isLoading2 = ref(false);
const formatDirection = function(number) { const detailData = ref({});
switch (number) { const featureList = ref([])
case 1: { const imgModelRef = ref();
return '进' const imgOtherDialogRef = ref();
} const comparisonList = ref([])
case -1: { const reComparisonList = ref([])
return '出' const formatDirection = function(number) {
} switch (number) {
case 0: { case 1: {
return '横穿' return '进'
} }
default: { case -1: {
return '出'
break }
} case 0: {
} return '横穿'
} }
watch([featureList],(newVal,oldVal)=>{ default: {
},{deep:true}) break
const initDialog = (data) => { }
isLoading.value = true; }
isLoading1.value = true; }
isLoading2.value = false; watch([featureList], (newVal, oldVal) => {
detailData.value = data;
featureList.value = [] }, {
reComparisonList.value = [] deep: true
featureApi.getPersonContrastList(data).then((r) => { })
isLoading.value = false const initDialog = (data) => {
if (r.data&&isArray(r.data.personList)) { isLoading.value = true;
r.data.personList.forEach((item) => { isLoading1.value = true;
if (item.features_url) { isLoading2.value = false;
item.features_url = window._baseImgUrl + item.features_url detailData.value = data;
} featureList.value = []
if (item.picture_url) { reComparisonList.value = []
item.picture_url = window._baseImgUrl + item.picture_url featureApi.getPersonContrastList(data).then((r1) => {
} isLoading.value = false
}) if (r1.data && isArray(r1.data.personList)) {
featureList.value = r.data.personList r1.data.personList.forEach((item) => {
} if (item.features_url) {
} item.features_url = window._baseImgUrl + item.features_url
) }
comparisonList.value = [] if (item.picture_url) {
featureApi.getAllPersonContrastList(data).then((r) => { item.picture_url = window._baseImgUrl + item.picture_url
isLoading1.value = false }
if (isArray(r.data)) { })
if(r.data.length>0){ featureList.value = r1.data.personList
r.data.forEach((item) => { }
if (item.features_url) { })
item.features_url = window._baseImgUrl + item.features_url comparisonList.value = []
} featureApi.getAllPersonContrastList(data).then((r) => {
if (item.picture_url) { isLoading1.value = false
item.picture_url = window._baseImgUrl + item.picture_url if (isArray(r.data)) {
} if (r.data.length > 0) {
}) let numLength = 0
comparisonList.value = r.data r.data.forEach((item) => {
} if(item.personList&&item.personList.length>0) {
} numLength += item.personList.length
} item.personList.forEach((one) => {
) if (one.picture_url) {
isVisible.value = true; one.picture_url = window._baseImgUrl + one.picture_url
}; }
const clickItem = function(data){ })
clusterResultApi.getBodyPoint({'feature_url':data.features_url}).then((r) => { }
imgModelRef.value.initDialog(data.picture_url,r.data); })
}) r.data[0].numLength = numLength
} comparisonList.value = r.data
const reComparisonFeature = function(){ }
isLoading2.value = true }
reComparisonList.value = [] /* isLoading1.value = false
featureApi.getNewPersonContrastList(detailData.value).then((r) => { console.log(r)
isLoading2.value = false
if (isArray(r.data)) { if (isArray(r.data)) {
if(r.data.length>0){ if (r.data.length > 0) {
r.data.forEach((item) => { r.data.forEach((item) => {
if (item.features_url) { if (item.features_url) {
item.features_url = window._baseImgUrl + item.features_url item.features_url = window._baseImgUrl + item.features_url
} }
if (item.picture_url) { if (item.picture_url) {
item.picture_url = window._baseImgUrl + item.picture_url item.picture_url = window._baseImgUrl + item.picture_url
} }
}) })
reComparisonList.value = r.data comparisonList.value = r.data
} }
} */
})
isVisible.value = true;
};
const clickItem = function(data) {
console.log(data)
clusterResultApi.getBodyPoint({
'feature_url': data.features_url
}).then((r) => {
imgModelRef.value.initDialog(data.unid, data.picture_url, r.data);
})
}
const reComparisonFeature = function() {
isLoading2.value = true
reComparisonList.value = []
featureApi.getNewPersonContrastList(detailData.value).then((r) => {
isLoading2.value = false
if (isArray(r.data)) {
if (r.data.length > 0) {
r.data.forEach((item) => {
if (item.features_url) {
item.features_url = window._baseImgUrl + item.features_url
}
if (item.picture_url) {
item.picture_url = window._baseImgUrl + item.picture_url
}
})
reComparisonList.value = r.data
}
}
})
}
const downloadFile = function(item, event) {
event.stopPropagation()
if (item.features_url) {
window.open(item.features_url)
} else {
ElMessage({
message: `该图片没有特征`,
type: 'warning'
})
return
}
}
const openImage = function(item, event) {
event.stopPropagation()
if (item.features_url) {
let url = item.picture_url
imgOtherDialogRef.value.initDialog(url.split('0.jpg')[0] + '1.jpg')
} else {
ElMessage({
message: `该图片没有特征`,
type: 'warning'
})
return
} }
} }
) const onCancel = () => {
} isVisible.value = false;
const downloadFile = function(item,event){ };
event.stopPropagation()
if(item.features_url){
window.open(item.features_url)
}else{
ElMessage(
{
message: `该图片没有特征`,
type: 'warning'
}
)
return
}
}
const openImage = function(item,event){
event.stopPropagation()
if(item.features_url){
let url = item.picture_url
imgOtherDialogRef.value.initDialog(url.split('0.jpg')[0]+'1.jpg')
}else{
ElMessage(
{
message: `该图片没有特征`,
type: 'warning'
}
)
return
}
}
const onCancel = () => {
isVisible.value = false;
};
return { return {
isVisible, isVisible,
onCancel, onCancel,
initDialog, initDialog,
isLoading, isLoading,
isLoading1, isLoading1,
isLoading2, isLoading2,
detailData, detailData,
featureList, featureList,
formatDirection, formatDirection,
downloadFile, downloadFile,
clickItem, clickItem,
imgModelRef, imgModelRef,
comparisonList, comparisonList,
reComparisonList, reComparisonList,
reComparisonFeature, reComparisonFeature,
openImage, openImage,
imgOtherDialogRef imgOtherDialogRef
}; };
}, },
}; };
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.single-image { .single-image {
height: 200px; height: 200px;
width: 150px; width: 150px;
cursor: pointer; cursor: pointer;
} }
.direction{
font-weight: 900; .direction {
background-color: red; font-weight: 900;
color: white; background-color: red;
} color: white;
.direction1{ }
background-color: green;
} .direction1 {
.direction0{ background-color: green;
background-color: orange; }
}
.title{ .direction0 {
background-color: orange;
}
.title {
height: 32px; height: 32px;
line-height: 32px; line-height: 32px;
padding: 0; padding: 0;
.name{
.name {
font-weight: 900; font-weight: 900;
font-size: 18px; font-size: 18px;
} }
.id{
.id {
margin-left: 20px; margin-left: 20px;
} }
.num{
.num {
float: right; float: right;
margin-right: 15px; margin-right: 15px;
} }
} }
.imgBox1{
// border-left: 10px solid #efefef; .imgBox1 {
box-sizing: border-box; // border-left: 10px solid #efefef;
min-height: 100%; box-sizing: border-box;
.itemBox{ min-height: 100%;
position: relative;
} .itemBox {
.downloadFile{ position: relative;
position: absolute; }
color: #1890ff;
font-size: 32px; .downloadFile {
top: 0; position: absolute;
right: 10px; color: #1890ff;
cursor: pointer; font-size: 32px;
} top: 0;
.openImage{ right: 10px;
position: absolute; cursor: pointer;
color: #1890ff; }
font-size: 32px;
top: 0; .openImage {
left: 90px; position: absolute;
cursor: pointer; color: #1890ff;
} font-size: 32px;
.featureNum{ top: 0;
position: absolute; left: 90px;
top: 0; cursor: pointer;
left: 15px; }
color: red;
font-weight: 900; .featureNum {
font-size: 16px; position: absolute;
} top: 0;
left: 15px;
color: red;
font-weight: 900;
font-size: 16px;
}
}
.imgBox1_top {
min-height: 400px;
max-height: 600px;
overflow-y: auto;
} }
.imgBox1_top{ </style>
min-height: 400px;
max-height: 600px;
overflow-y: auto;
}
</style>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!