Проблема дисплея с ограничивающей коробкой [закрыто]C++

Программы на C++. Форум разработчиков
Ответить
Anonymous
 Проблема дисплея с ограничивающей коробкой [закрыто]

Сообщение Anonymous »

Кто -нибудь знает ли кто -нибудь, почему мои коробки выглядят так? модель с разными опсами несколько раз, но ничего не исправляет. < /p>
Вы можете увидеть ошибку в IMG < /p>
[![enter image description here][1]][1]
#include
#include
#include
#include
#include
using namespace cv;
using namespace dnn;
using namespace std;

inline float sigmoid(float x) {
return 1.0f / (1.0f + exp(-x));
}

int main() {
string modelPath = "C:/Users/shlomi/yolo11x.onnx";
string imagePath = "C:/Users/shlomi/test.jpg"; // Change to your image path

Net net = readNet(modelPath);
net.setPreferableBackend(DNN_BACKEND_CUDA);
net.setPreferableTarget(DNN_TARGET_CUDA);

Mat frame = imread(imagePath);
if (frame.empty()) {
cerr confThreshold && class_id >= 0) {
conf = std::max(0.f, std::min(conf, 1.f));
float x = data[0];
float y = data[1];
float w = data[2];
float h = data[3];

int left = int((x - 0.5 * w));
int top = int((y - 0.5 * h));
int width = int(w);
int height = int(h);

left = std::max(0, left);
top = std::max(0, top);
width = std::min(640 - left, width);
height = std::min(640 - top, height);

boxes.emplace_back(left, top, width, height);
classIds.push_back(class_id);
confidences.push_back(conf);
}
}

vector indices;
NMSBoxes(boxes, confidences, confThreshold, iouThreshold, indices);

for (int idx : indices) {
Rect box = boxes[idx];
int class_id = classIds[idx];
float conf = confidences[idx];
rectangle(resized, box, Scalar(0, 255, 0), 2);
string label = format("id:%d %.2f", class_id, conf);
putText(resized, label, Point(box.x, max(box.y - 5, 0)), FONT_HERSHEY_SIMPLEX, 0.5, Scalar(0, 255, 0), 1);
}

imshow("YOLOv8 Object Detection", resized);
imwrite("result.jpg", resized); // Output always 640x640
waitKey(0);
destroyAllWindows();
return 0;
}


Подробнее здесь: https://stackoverflow.com/questions/797 ... play-issue
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C++»