| | |
| | | "strings" |
| | | "sync" |
| | | "time" |
| | | "webserver/cache" |
| | | "webserver/extend/code" |
| | | "webserver/extend/config" |
| | | "webserver/extend/esutil" |
| | |
| | | util.ResponseFormat(c, code.RequestParamError, "参数有误") |
| | | return |
| | | } |
| | | var weedfsUri = "http://"+config.WeedFs.Ip+":"+strconv.Itoa(config.WeedFs.UploadPort)+"/submit" |
| | | localConf, err2 := cache.GetServerInfo() |
| | | if err2 !=nil || localConf.WebPicIp == "" { |
| | | logger.Debug("localConfig is wrong!!!") |
| | | return |
| | | } |
| | | var weedfsUri = "http://"+localConf.WebPicIp+":"+strconv.Itoa(int(localConf.WebPicPort))+"/submit" |
| | | resultMap :=make(map[string]interface{},0) |
| | | //将上传的图片交人脸检测和人脸提取,获得特征 |
| | | fileBytes, _ := ioutil.ReadAll(file) |
| | |
| | | } |
| | | } |
| | | if len(captureIds) >0 { |
| | | videopersons, _ := esApi.Videopersonsinfosbyid(captureIds, config.EsInfo.EsIndex.VideoPersons.IndexName, config.EsInfo.Masterip, config.EsInfo.Httpport) |
| | | localConf, err2 := cache.GetServerInfo() |
| | | if err2 !=nil || localConf.AlarmIp == "" { |
| | | logger.Debug("localConfig is wrong!!!") |
| | | return nil |
| | | } |
| | | videopersons, _ := esApi.Videopersonsinfosbyid(captureIds, config.EsInfo.EsIndex.VideoPersons.IndexName, localConf.AlarmIp, strconv.Itoa(int(localConf.AlarmPort))) |
| | | logger.Debug("comp videoPersons.len:",len(videopersons)) |
| | | for _,vp :=range videopersons { |
| | | isAlarmInt, _ := strconv.Atoi(vp.IsAlarm) |
| | |
| | | } |
| | | var faceB []byte |
| | | if searchBody.CaptureId != "" {//做查找此人,搜所有抓拍和底库 |
| | | searchBase64Fea, err := esApi.GetVideoPersonFaceFeatureById(searchBody.CaptureId, config.EsInfo.EsIndex.VideoPersons.IndexName, config.EsInfo.Masterip, config.EsInfo.Httpport) |
| | | localConf, err2 := cache.GetServerInfo() |
| | | if err2 !=nil || localConf.AlarmIp == "" { |
| | | logger.Debug("localConfig is wrong!!!") |
| | | util.ResponseFormat(c,code.ComError,"localConf wrong") |
| | | return |
| | | } |
| | | searchBase64Fea, err := esApi.GetVideoPersonFaceFeatureById(searchBody.CaptureId, config.EsInfo.EsIndex.VideoPersons.IndexName, localConf.AlarmIp, strconv.Itoa(int(localConf.AlarmPort))) |
| | | if err !=nil { |
| | | util.ResponseFormat(c, code.ComError, "抓拍数据不存在,请检查") |
| | | return |
| | |
| | | util.ResponseFormat(c, code.RequestParamError, "参数有误") |
| | | return |
| | | } |
| | | var weedfsUri = "http://"+config.WeedFs.Ip+":"+strconv.Itoa(config.WeedFs.UploadPort)+"/submit" |
| | | localConf, err2 := cache.GetServerInfo() |
| | | if err2 !=nil || localConf.WebPicIp == "" { |
| | | logger.Debug("localConfig is wrong!!!") |
| | | return |
| | | } |
| | | var weedfsUri = "http://"+localConf.WebPicIp+":"+strconv.Itoa(int(localConf.WebPicPort))+"/submit" |
| | | |
| | | //将上传的图片交人脸检测和人脸提取,获得特征 |
| | | fileBytes, _ := ioutil.ReadAll(file) |
| | |
| | | break |
| | | } |
| | | } |
| | | var weedfsUri = "http://"+config.WeedFs.Ip+":"+strconv.Itoa(config.WeedFs.UploadPort)+"/submit" |
| | | localConf, err2 := cache.GetServerInfo() |
| | | if err2 !=nil || localConf.WebPicIp == "" { |
| | | logger.Debug("localConfig is wrong!!!") |
| | | return "",nil,err2 |
| | | } |
| | | var weedfsUri = "http://"+localConf.WebPicIp+":"+strconv.Itoa(int(localConf.WebPicPort))+"/submit" |
| | | //根据人脸坐标扣出人脸小图 |
| | | t1 := time.Now() |
| | | cutFaceImgData := util.SubImg(*pI, int(rcFace.Left), int(rcFace.Top), int(rcFace.Right), int(rcFace.Bottom)) |
| | |
| | | util.ResponseFormat(c, code.UploadFileError, err2.Error()) |
| | | return |
| | | } |
| | | var weedfsUri = "http://"+config.WeedFs.Ip+":"+strconv.Itoa(config.WeedFs.UploadPort)+"/submit" |
| | | localConf, err2 := cache.GetServerInfo() |
| | | if err2 !=nil || localConf.WebPicIp == "" { |
| | | logger.Debug("localConfig is wrong!!!") |
| | | return |
| | | } |
| | | var weedfsUri = "http://"+localConf.WebPicIp+":"+strconv.Itoa(int(localConf.WebPicPort))+"/submit" |
| | | { |
| | | uri := weedfsUri |
| | | fileInfo, e := esutil.PostFormBufferData(uri, filename, "file", uploadData) |