mirror of
https://gitee.com/open-visual/face-search.git
synced 2025-07-25 19:41:42 +08:00
update: 修改由于OpenCV3.4不兼容的API
This commit is contained in:
parent
8bc494ff12
commit
c788dc4bd9
@ -44,8 +44,8 @@ public class InsightAttributeDetection extends BaseOnnxInfer implements FaceAttr
|
|||||||
OrtSession.Result output = null;
|
OrtSession.Result output = null;
|
||||||
try {
|
try {
|
||||||
Mat image = imageMat.toCvMat();
|
Mat image = imageMat.toCvMat();
|
||||||
int w = image.size(1);
|
int w = image.width();
|
||||||
int h = image.size(0);
|
int h = image.height();
|
||||||
float cx = 1.0f * w / 2;
|
float cx = 1.0f * w / 2;
|
||||||
float cy = 1.0f * h / 2;
|
float cy = 1.0f * h / 2;
|
||||||
float[]center = new float[]{cx, cy};
|
float[]center = new float[]{cx, cy};
|
||||||
|
@ -42,8 +42,8 @@ public class InsightCoordFaceKeyPoint extends BaseOnnxInfer implements FaceKeyPo
|
|||||||
OrtSession.Result output = null;
|
OrtSession.Result output = null;
|
||||||
try {
|
try {
|
||||||
Mat image = imageMat.toCvMat();
|
Mat image = imageMat.toCvMat();
|
||||||
int w = image.size(1);
|
int w = image.width();
|
||||||
int h = image.size(0);
|
int h = image.height();
|
||||||
float cx = 1.0f * w / 2;
|
float cx = 1.0f * w / 2;
|
||||||
float cy = 1.0f * h / 2;
|
float cy = 1.0f * h / 2;
|
||||||
float[]center = new float[]{cx, cy};
|
float[]center = new float[]{cx, cy};
|
||||||
|
@ -288,8 +288,8 @@ public class PcnNetworkFaceDetection extends BaseOnnxInfer implements FaceDetect
|
|||||||
private static List<FaceInfo> trans_window(Mat img, Mat imgPad, List<Window2> winlist, float scale){
|
private static List<FaceInfo> trans_window(Mat img, Mat imgPad, List<Window2> winlist, float scale){
|
||||||
List<FaceInfo> ret = new ArrayList<>();
|
List<FaceInfo> ret = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
int row = (imgPad.size(0) - img.size(0)) / 2;
|
int row = (imgPad.height() - img.height()) / 2;
|
||||||
int col = (imgPad.size(1) - img.size(1)) / 2;
|
int col = (imgPad.width() - img.width()) / 2;
|
||||||
for(Window2 win : winlist){
|
for(Window2 win : winlist){
|
||||||
if( win.w > 0 && win.h > 0){
|
if( win.w > 0 && win.h > 0){
|
||||||
int x1 = win.x - col;
|
int x1 = win.x - col;
|
||||||
@ -304,8 +304,8 @@ public class PcnNetworkFaceDetection extends BaseOnnxInfer implements FaceDetect
|
|||||||
int h = Math.abs(y2 - y1);
|
int h = Math.abs(y2 - y1);
|
||||||
x1 = Math.max(Float.valueOf((x1 - (int)(w * rw)) * scale).intValue(), 1);
|
x1 = Math.max(Float.valueOf((x1 - (int)(w * rw)) * scale).intValue(), 1);
|
||||||
y1 = Math.max(Float.valueOf((y1 - (int)(h * rh)) * scale).intValue(), 1);
|
y1 = Math.max(Float.valueOf((y1 - (int)(h * rh)) * scale).intValue(), 1);
|
||||||
x2 = Math.min(Float.valueOf((x2 + (int)(w * rw)) * scale).intValue(), Float.valueOf((img.size(1)) * scale).intValue()-1);
|
x2 = Math.min(Float.valueOf((x2 + (int)(w * rw)) * scale).intValue(), Float.valueOf((img.width()) * scale).intValue()-1);
|
||||||
y2 = Math.min(Float.valueOf((y2 + (int)(h * rh)) * scale).intValue(), Float.valueOf((img.size(0)) * scale).intValue()-1);
|
y2 = Math.min(Float.valueOf((y2 + (int)(h * rh)) * scale).intValue(), Float.valueOf((img.height()) * scale).intValue()-1);
|
||||||
//构建人脸信息
|
//构建人脸信息
|
||||||
FaceInfo faceInfo = FaceInfo.build(win.conf, angle, FaceInfo.FaceBox.build(x1, y1, x2, y2), FaceInfo.Points.build());
|
FaceInfo faceInfo = FaceInfo.build(win.conf, angle, FaceInfo.FaceBox.build(x1, y1, x2, y2), FaceInfo.Points.build());
|
||||||
ret.add(faceInfo);
|
ret.add(faceInfo);
|
||||||
@ -412,7 +412,7 @@ public class PcnNetworkFaceDetection extends BaseOnnxInfer implements FaceDetect
|
|||||||
OnnxTensor input = null;
|
OnnxTensor input = null;
|
||||||
OrtSession.Result output = null;
|
OrtSession.Result output = null;
|
||||||
Size size = img.size();
|
Size size = img.size();
|
||||||
int height = img.size(0);
|
int height = img.height();
|
||||||
try {
|
try {
|
||||||
datalist = Mats.build();
|
datalist = Mats.build();
|
||||||
for(Window2 win : winlist){
|
for(Window2 win : winlist){
|
||||||
@ -529,8 +529,8 @@ public class PcnNetworkFaceDetection extends BaseOnnxInfer implements FaceDetect
|
|||||||
OnnxTensor input = null;
|
OnnxTensor input = null;
|
||||||
OrtSession.Result output = null;
|
OrtSession.Result output = null;
|
||||||
|
|
||||||
int height = imgPad.size(0);
|
int height = imgPad.height();
|
||||||
int width = imgPad.size(1);
|
int width = imgPad.width();
|
||||||
Size imgPadSize = imgPad.size();
|
Size imgPadSize = imgPad.size();
|
||||||
Size img180Size = img180.size();
|
Size img180Size = img180.size();
|
||||||
Size img90Size = img90.size();
|
Size img90Size = img90.size();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user