klimi
Oh ok sorry my first time
I mean if you have something you want to share in private, you can DM me, but i think it will have lower impact.
5iiii
My problem is my project is about yolov8 to auto select the moving car and draw a box for it ,but mouse can’t keep up with the moving car
5iiii
But static cars are normal.
Abbasi
If it works with static then the issue might be objects' life-time.
Chat Boss
5iiii sent a code, it has been re-uploaded as a quote
class PIDController {
public:
PIDController(double sensitivity, double Ki, double Kd)
: sensitivity(sensitivity), Ki(Ki), Kd(Kd), lastError(0), integral(0) {}
void updatePosition(cv::Point2f& current, const cv::Point2f& target, double dt) {
float errorX = target.x - current.x;
float errorY = target.y - current.y;
double pTermX = sensitivity * errorX;
double pTermY = sensitivity * errorY;
integral += (errorX + errorY) * dt;
double iTermX = Ki * integral;
double iTermY = Ki * integral;
double dTermX = Kd * (errorX - lastError) / dt;
double dTermY = Kd * (errorY - lastError) / dt;
float moveX = static_cast<float>(pTermX + iTermX + dTermX);
float moveY = static_cast<float>(pTermY + iTermY + dTermY);
current.x += moveX;
current.y += moveY;
lastError = (errorX + errorY) / 2;
}
void setSensitivity(double newSensitivity) {
sensitivity = newSensitivity;
}
cv::Point2f stabilize(const cv::Point2f& moveVector) {
double errorX = moveVector.x;
double errorY = moveVector.y;
double moveX = sensitivity * errorX + Kd * (errorX - lastErrorX);
double moveY = sensitivity * errorY + Kd * (errorY - lastErrorY);
lastErrorX = errorX;
lastErrorY = errorY;
return cv::Point2f(moveX, moveY);
}
private:
double sensitivity;
double Ki, Kd;
double lastError;
double integral;
double lastErrorX;
double lastErrorY;
};
static PIDController normalPid(sensitivity, 0, 0.5);
// main 循環
if (mouseControlInitialized) {
cv::Point2f currentPos(frame.cols / 2, frame.rows / 2);
float maxDistance = frame.cols * currentFov / 2;
bool hasValidTarget = (closest.x != -1 && closest.y != -1);
if (hasValidTarget && !targets.empty()) {
cv::Point2f targetPos(closest.x, closest.y);
float distance = cv::norm(targetPos - currentPos);
if (isAiming && autoAim && distance <= maxDistance) {
cv::Point2f moveVector = targetPos - currentPos;
// 使用 normalPid 進行穩定化
cv::Point2f stabilizedMove = normalPid.stabilize(moveVector);
// 執行移動
if (abs(stabilizedMove.x) > 0.01 || abs(stabilizedMove.y) > 0.01) {
control->SelectBox(
static_cast<short>(stabilizedMove.x),
static_cast<short>(stabilizedMove.y)
);
}
}
5iiii
My actual time is 1 a.m. I go to bed first and get up in the morning to reply. Sorry
Redeemer
Hey
Abbasi
Never Spam Bot
YA sent multiple messages that looks like a spam.
Why was my message deleted?
Spam deleted in this group: 2805
Natxo
Yesterday, Happy Birthday to Bjarne Stroustrup, inventor of C++: bit.ly/2E33g6O
Natxo
2025 is a mathematically perfect number.
It is the square of the sum of the numbers in the decimal metric system:
(1+2+3+4+5+6+7+8+9)² = (45)² = 2025
It is also the sum of the same numbers raised to the cube:
(1³+2³+3³+4³+5³+6³+7³+8³+9³) = 2025
Have a perfect 2025, full of health and lots of 8-bit tinkering!
HAPPY NEW YEAR!
You can't birader
Helo I'm also developer I make a website can anyone rate this
You can't birader
quotica . life
You can't birader
Please check
ⁱᵃᵐ|ýᥙ𝗴₂.₀⚡𒆜
Hy is anyone from india here who is coder/programmer/developer
Pavel
#ot
Rose
#ot
Offtopic discussions should be done in the C/C++ Offtopic group. Please take your discussion/questions there.
Rose
Another one bites the dust...!
Banned #𝐯𝐞𝐟𝐭𝐮.
Reason:
spam & abusive
Anunay
quotica . life
off-topic, please use the OT chat for such stuff
CELINCERS
Why ?
A
Program to print the reverse of a given array without using an extra array ? Anyone gimme some hints
consteval
Blue
Why is my message deleted which I asked on c++?
Pavel
Blue
𝘞𝘦𝘢𝘳𝘪𝘯𝘨𝘔𝘦𝘥𝘢𝘭
char *termcmd[] = {"xterm", "+sb", NULL};
char *roficmd[] = {"rofi", "-show", "run", NULL};
how can I make something like this in a config.h file and then import it in multiple files without errors?
consteval
𝘞𝘦𝘢𝘳𝘪𝘯𝘨𝘔𝘦𝘥𝘢𝘭
𝘞𝘦𝘢𝘳𝘪𝘯𝘨𝘔𝘦𝘥𝘢𝘭
so the user could change the values inside the config.h instead of doing it in the c file
𝘞𝘦𝘢𝘳𝘪𝘯𝘨𝘔𝘦𝘥𝘢𝘭
so the best approach is to make them extern and modify everything in the config.c? but this is confusional, isn't it?
Pavel
TouLo
Anonymous
Welcome
zakaria
I have a question in c++
Pavel
zakaria
I can't send messages !!
𝘞𝘦𝘢𝘳𝘪𝘯𝘨𝘔𝘦𝘥𝘢𝘭
Never Spam Bot
zakaria sent multiple messages that looks like a spam.
Why was my message deleted?
Spam deleted in this group: 2826
Pavel
Pavel
I have no idea how to make the bot not delete the messages, it should stop eventually I guess
FriedRice
FriedRice
It depends on your data set, if you have clustered data you probably want b+ tree instead of hash table.
consteval
Never Spam Bot
..... Malik sent multiple messages that looks like a spam.
Why was my message deleted?
Spam deleted in this group: 2829
Jojo
Considering to use c prime prime as a way through re-embarking on C, what you think?
Engine
Lang integration question: I know multiple ways to integrate C++ in python to maintain runtime speed, what is the best way to do that and why? Is there also a way to do the opposite (Write libs in python then use them in C or C++)?
A
david
hi guys
Ludovic 'Archivist'
david
well,ok then
Sarthak
Should I follow some website for practice if I am not a beginner or not an intermediate, like code chef, Leet code
MᏫᎻᎯᎷᎷᎬᎠ
Why std::string_view is normally passed by value when its sizeof returns 16 bytes (since it contains both the pointer and the size)
MᏫᎻᎯᎷᎷᎬᎠ
I mean it's better to just pass it by reference
Vlad
Vlad
Vlad
Stack is preallocated and is free anyway
Vlad
All modern cpus have simd to copy 16 bytes in 1 cycle
Vlad
Even if you don't and it's 2 cycles
Vlad
It is definitely not a big deal
Vlad
Double de-referencing will be probably worse
MᏫᎻᎯᎷᎷᎬᎠ
What do you mean by the being being preallocated, I thought that the stack grows and shrinks with functions calls
Vlad
Vlad
So allocating a variable is basically add ebp, 16
Vlad
Or whatever
Vlad
Vlad
If you do recursive calls like that it's your skill issue tbh