Recator calculating left down shoulder
This commit is contained in:
parent
3b9ff27524
commit
a6a1a5196c
@ -371,32 +371,17 @@ void NvInferServerManager::update_frame_with_face_body_meta(
|
|||||||
imprecise_face_obj_meta->text_params;
|
imprecise_face_obj_meta->text_params;
|
||||||
/* Assign bounding box coordinates. */
|
/* Assign bounding box coordinates. */
|
||||||
rect_params_imprecise_face.left =
|
rect_params_imprecise_face.left =
|
||||||
int(data[index * 57 + 0] * MUXER_OUTPUT_WIDTH / PGIE_NET_WIDTH);
|
(data[index * 57 + 0] * MUXER_OUTPUT_WIDTH / PGIE_NET_WIDTH);
|
||||||
rect_params_imprecise_face.top =
|
rect_params_imprecise_face.top =
|
||||||
int(data[index * 57 + 1] * MUXER_OUTPUT_HEIGHT / PGIE_NET_HEIGHT);
|
(data[index * 57 + 1] * MUXER_OUTPUT_HEIGHT / PGIE_NET_HEIGHT);
|
||||||
float x_shoulder;
|
Point2D left_down_shoulder =
|
||||||
float y_shoulder;
|
find_left_down_corner_shoulder(data, index);
|
||||||
if (data[index * 57 + 21] > data[index * 57 + 24]) {
|
|
||||||
x_shoulder = data[index * 57 + 21];
|
|
||||||
y_shoulder = data[index * 57 + 22];
|
|
||||||
} else {
|
|
||||||
x_shoulder = data[index * 57 + 24];
|
|
||||||
y_shoulder = data[index * 57 + 25];
|
|
||||||
}
|
|
||||||
rect_params_imprecise_face.width =
|
rect_params_imprecise_face.width =
|
||||||
int((x_shoulder - data[index * 57 + 0]) * MUXER_OUTPUT_WIDTH /
|
((left_down_shoulder.x - data[index * 57 + 0]) *
|
||||||
PGIE_NET_WIDTH);
|
MUXER_OUTPUT_WIDTH / PGIE_NET_WIDTH);
|
||||||
rect_params_imprecise_face.height =
|
rect_params_imprecise_face.height =
|
||||||
int((y_shoulder - data[index * 57 + 1]) * MUXER_OUTPUT_HEIGHT /
|
((left_down_shoulder.y - data[index * 57 + 1]) *
|
||||||
PGIE_NET_HEIGHT);
|
MUXER_OUTPUT_HEIGHT / PGIE_NET_HEIGHT);
|
||||||
|
|
||||||
// std::cout << "nvinferserver imprecise face for x = " <<
|
|
||||||
// rect_params_imprecise_face.left
|
|
||||||
// << " y = " << rect_params_imprecise_face.top
|
|
||||||
// << " w = " << rect_params_imprecise_face.width
|
|
||||||
// << " h = " << rect_params_imprecise_face.height
|
|
||||||
// << " score = " <<
|
|
||||||
// imprecise_face_obj_meta->confidence << std::endl;
|
|
||||||
|
|
||||||
/* Border of width 3. */
|
/* Border of width 3. */
|
||||||
rect_params_imprecise_face.border_width = 3;
|
rect_params_imprecise_face.border_width = 3;
|
||||||
@ -439,15 +424,15 @@ void NvInferServerManager::update_frame_with_face_body_meta(
|
|||||||
NvOSD_TextParams &text_params_body = body_obj_meta->text_params;
|
NvOSD_TextParams &text_params_body = body_obj_meta->text_params;
|
||||||
/* Assign bounding box coordinates. */
|
/* Assign bounding box coordinates. */
|
||||||
rect_params_body.left =
|
rect_params_body.left =
|
||||||
int(data[index * 57 + 0] * MUXER_OUTPUT_WIDTH / PGIE_NET_WIDTH);
|
(data[index * 57 + 0] * MUXER_OUTPUT_WIDTH / PGIE_NET_WIDTH);
|
||||||
rect_params_body.top =
|
rect_params_body.top =
|
||||||
int(data[index * 57 + 1] * MUXER_OUTPUT_HEIGHT / PGIE_NET_HEIGHT);
|
(data[index * 57 + 1] * MUXER_OUTPUT_HEIGHT / PGIE_NET_HEIGHT);
|
||||||
rect_params_body.width =
|
rect_params_body.width =
|
||||||
int((data[index * 57 + 2] - data[index * 57 + 0]) *
|
((data[index * 57 + 2] - data[index * 57 + 0]) *
|
||||||
MUXER_OUTPUT_WIDTH / PGIE_NET_WIDTH);
|
MUXER_OUTPUT_WIDTH / PGIE_NET_WIDTH);
|
||||||
rect_params_body.height =
|
rect_params_body.height =
|
||||||
int((data[index * 57 + 3] - data[index * 57 + 1]) *
|
((data[index * 57 + 3] - data[index * 57 + 1]) *
|
||||||
MUXER_OUTPUT_HEIGHT / PGIE_NET_HEIGHT);
|
MUXER_OUTPUT_HEIGHT / PGIE_NET_HEIGHT);
|
||||||
|
|
||||||
/* Border of width 3. */
|
/* Border of width 3. */
|
||||||
rect_params_body.border_width = 3;
|
rect_params_body.border_width = 3;
|
||||||
@ -480,6 +465,21 @@ void NvInferServerManager::update_frame_with_face_body_meta(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NvInferServerManager::Point2D
|
||||||
|
NvInferServerManager::find_left_down_corner_shoulder(float *data, uint index) {
|
||||||
|
Point2D left_down_shoulder;
|
||||||
|
// float x_shoulder;
|
||||||
|
// float y_shoulder;
|
||||||
|
if (data[index * 57 + 21] > data[index * 57 + 24]) {
|
||||||
|
left_down_shoulder.x = data[index * 57 + 21];
|
||||||
|
left_down_shoulder.y = data[index * 57 + 22];
|
||||||
|
} else {
|
||||||
|
left_down_shoulder.x = data[index * 57 + 24];
|
||||||
|
left_down_shoulder.y = data[index * 57 + 25];
|
||||||
|
}
|
||||||
|
return left_down_shoulder;
|
||||||
|
}
|
||||||
|
|
||||||
// add custom infromation to metadata by: set_metadata_ptr, copy_user_meta,
|
// add custom infromation to metadata by: set_metadata_ptr, copy_user_meta,
|
||||||
// release_user_meta
|
// release_user_meta
|
||||||
void *NvInferServerManager::set_metadata_ptr(float *arr) {
|
void *NvInferServerManager::set_metadata_ptr(float *arr) {
|
||||||
|
|||||||
@ -12,6 +12,13 @@
|
|||||||
class NvInferServerManager {
|
class NvInferServerManager {
|
||||||
private:
|
private:
|
||||||
public:
|
public:
|
||||||
|
struct Point2D {
|
||||||
|
double x; // X coordinate
|
||||||
|
double y; // Y coordinate
|
||||||
|
|
||||||
|
// Constructor
|
||||||
|
Point2D(double x_val = 0.0, double y_val = 0.0) : x(x_val), y(y_val) {}
|
||||||
|
};
|
||||||
GstElement *primary_detector = NULL;
|
GstElement *primary_detector = NULL;
|
||||||
int pgie_batch_size;
|
int pgie_batch_size;
|
||||||
|
|
||||||
@ -45,4 +52,5 @@ class NvInferServerManager {
|
|||||||
NvDsFrameMeta *);
|
NvDsFrameMeta *);
|
||||||
static void extract_tensor_metadata(NvDsUserMeta *, NvDsInferNetworkInfo,
|
static void extract_tensor_metadata(NvDsUserMeta *, NvDsInferNetworkInfo,
|
||||||
NvDsBatchMeta *, NvDsFrameMeta *);
|
NvDsBatchMeta *, NvDsFrameMeta *);
|
||||||
|
static Point2D find_left_down_corner_shoulder(float *, uint);
|
||||||
};
|
};
|
||||||
Loading…
x
Reference in New Issue
Block a user