Skip to content

Commit

Permalink
[CAPI]update rotated boxe detection result for capi
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaoII committed Apr 16, 2024
1 parent cd0ee79 commit 4b67273
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions c_api/fastdeploy_capi/vision/result.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ void FD_C_DestroyDetectionResult(
delete[] fd_c_detection_result->boxes.data[i].data;
}
delete[] fd_c_detection_result->boxes.data;
//delete rotated_boxes
for (size_t i = 0; i < fd_c_detection_result->rotated_boxes.size; i++) {
delete[] fd_c_detection_result->rotated_boxes.data[i].data;
}
delete[] fd_c_detection_result->rotated_boxes.data;
// delete scores
delete[] fd_c_detection_result->scores.data;
// delete label_ids
Expand Down Expand Up @@ -166,6 +171,22 @@ void FD_C_DetectionResultWrapperToCResult(
detection_result->boxes[i][j];
}
}
// copy rotated_boxes
const int rotated_boxes_coordinate_dim = 8;
fd_c_detection_result->rotated_boxes.size =
detection_result->rotated_boxes.size();
fd_c_detection_result->rotated_boxes.data =
new FD_C_OneDimArrayFloat[fd_c_detection_result->rotated_boxes.size];
for (size_t i = 0; i < detection_result->rotated_boxes.size(); i++) {
fd_c_detection_result->rotated_boxes.data[i].size =
rotated_boxes_coordinate_dim;
fd_c_detection_result->rotated_boxes.data[i].data =
new float[rotated_boxes_coordinate_dim];
for (size_t j = 0; j < rotated_boxes_coordinate_dim; j++) {
fd_c_detection_result->rotated_boxes.data[i].data[j] =
detection_result->rotated_boxes[i][j];
}
}
// copy scores
fd_c_detection_result->scores.size = detection_result->scores.size();
fd_c_detection_result->scores.data =
Expand Down

0 comments on commit 4b67273

Please sign in to comment.