活动介绍

#include<iostream> using namespace std; int n, m, k[1000],k2[2000],j=0; int main() { while(cin>>n&&n!=0) { int a=0, b=0, c=1; for (int i = 0; i <6; i++) { m = n % 2; a = n / 2; n = a; k[i] = m; } for (int i = 5; i >= 0; i--) if (k[i] == 1) b = i; if (b == 0) cout << "1" << endl; else { for (int i = 0; i < b; i++) c *= 2; cout << c << endl; } } return 0; }哪里错了

时间: 2023-12-10 20:06:14 浏览: 104
这段代码有几个问题: 1. `k` 数组的大小为 `1000`,但是只使用了前 `6` 个元素,这会导致数组越界访问的问题。你可以将数组大小改为 `6`。 2. 在第一个 `for` 循环中,你将 `n` 转换成二进制表示存储在数组 `k` 中,但是你没有重置 `m` 和 `a` 的值。你可以将 `int a=0, b=0, c=1;` 的定义放到 `while` 循环内部,确保每次循环开始时这些变量都被重置。 3. 在第二个 `for` 循环中,你希望找到二进制表示中最高位的 `1` 的位置,并将其存储在变量 `b` 中。但是在循环结束后,`b` 的值仍然是上一次循环的结果,这会导致错误的输出。你可以将 `b = i;` 的语句移动到循环内部,并添加一个 `break;` 语句来结束循环。 以下是修改后的代码: ```cpp #include<iostream> using namespace std; int n, m, k[6], k2[2000], j = 0; int main() { while (cin >> n && n != 0) { int a = 0, b = 0, c = 1; for (int i = 0; i < 6; i++) { m = n % 2; a = n / 2; n = a; k[i] = m; } for (int i = 5; i >= 0; i--) { if (k[i] == 1) { b = i; break; } } if (b == 0) cout << "1" << endl; else { for (int i = 0; i < b; i++) c *= 2; cout << c << endl; } } return 0; } ``` 这样修改后的代码应该可以正常运行了。
阅读全文

相关推荐

#include <iostream> #include <string> #include <chrono> #include <iomanip> #include <thread> #include <vector> #include <cmath> #include <fstream> #include <sstream> #include <cstdlib> #include <atomic> #include <mutex> #ifdef _WIN32 #include <windows.h> #include #include <d3d11.h> #include <dxgi.h> #pragma comment(lib, "d3d11.lib") #pragma comment(lib, "dxgi.lib") #else #include <sys/sysinfo.h> #include <unistd.h> #endif using namespace std; // 系统资源监控结构体 struct SystemResources { double cpu_usage; double gpu_usage; long memory_used; long memory_total; long memory_available; }; // 全局变量用于线程控制 atomic<bool> running(true); mutex data_mutex; string current_pi_value = "3"; int current_precision = 0; // 高性能π计算算法 (Chudnovsky算法) class PiCalculator { private: // Chudnovsky算法常数 const double kC = 640320.0; const double kC3_24 = kC * kC * kC / 24.0; // 多精度计算参数 int precision; int terms; public: PiCalculator(int prec) : precision(prec) { // 根据所需精度计算需要的项数 terms = static_cast<int>(log10(kC3_24) * precision / 3) + 1; } int get_precision() const { return precision; } string calculate() { double sum = 0.0; double term; double factorial = 1.0; double sign = 1.0; // Chudnovsky算法实现 for (int k = 0; k < terms; ++k) { if (k > 0) { factorial *= (6.0 * k) * (6.0 * k - 1) * (6.0 * k - 2) * (6.0 * k - 3) * (6.0 * k - 4) * (6.0 * k - 5); factorial /= (3.0 * k) * (3.0 * k - 1) * (3.0 * k - 2) * pow(k, 3.0); sign *= -1; } term = (13591409.0 + 545140134.0 * k) * factorial; term *= sign; term /= pow(kC3_24, k + 0.5); sum += term; } double pi = 1.0 / (12.0 * sum); stringstream ss; ss << fixed << setprecision(precision) << pi; string result = ss.str(); // 确保格式正确,以3.开头 size_t dot_pos = result.find('.'); if (dot_pos != string::npos) { result = "3." + result.substr(dot_pos + 1); } else { result = "3.0"; } return result; } void update_precision(int new_precision) { precision = new_precision; terms = static_cast<int>(log10(kC3_24) * new_precision / 3) + 1; } }; #ifdef _WIN32 double get_gpu_usage() { return 0.0; // 简化处理 } #endif SystemResources get_system_resources() { SystemResources res{}; #ifdef _WIN32 // Windows CPU使用率计算 static ULARGE_INTEGER lastCPU, lastSysCPU, lastUserCPU; static int numProcessors = 0; static HANDLE self = GetCurrentProcess(); if (numProcessors == 0) { SYSTEM_INFO sysInfo; GetSystemInfo(&sysInfo); numProcessors = sysInfo.dwNumberOfProcessors; } FILETIME ftime, fsys, fuser; ULARGE_INTEGER now, sys, user; GetSystemTimeAsFileTime(&ftime); memcpy(&now, &ftime, sizeof(FILETIME)); GetProcessTimes(self, &ftime, &ftime, &fsys, &fuser); memcpy(&sys, &fsys, sizeof(FILETIME)); memcpy(&user, &fuser, sizeof(FILETIME)); double percent = (sys.QuadPart - lastSysCPU.QuadPart) + (user.QuadPart - lastUserCPU.QuadPart); percent /= (now.QuadPart - lastCPU.QuadPart); percent /= numProcessors; res.cpu_usage = min(100.0, max(0.0, percent * 100)); lastCPU = now; lastUserCPU = user; lastSysCPU = sys; // 内存使用情况 MEMORYSTATUSEX memInfo; memInfo.dwLength = sizeof(MEMORYSTATUSEX); if (GlobalMemoryStatusEx(&memInfo)) { res.memory_total = memInfo.ullTotalPhys / (1024 * 1024); res.memory_available = memInfo.ullAvailPhys / (1024 * 1024); res.memory_used = res.memory_total - res.memory_available; } res.gpu_usage = get_gpu_usage(); #else // Linux CPU使用率计算 static unsigned long long lastTotalUser = 0, lastTotalUserLow = 0, lastTotalSys = 0, lastTotalIdle = 0; FILE* file = fopen("/proc/stat", "r"); if (file) { unsigned long long totalUser, totalUserLow, totalSys, totalIdle; if (fscanf(file, "cpu %llu %llu %llu %llu", &totalUser, &totalUserLow, &totalSys, &totalIdle) == 4) { if (lastTotalUser != 0) { unsigned long long total = (totalUser - lastTotalUser) + (totalUserLow - lastTotalUserLow) + (totalSys - lastTotalSys); unsigned long long totalIdleDiff = totalIdle - lastTotalIdle; unsigned long long totalUsed = total - totalIdleDiff; if (total > 0) { res.cpu_usage = (100.0 * totalUsed) / total; } } lastTotalUser = totalUser; lastTotalUserLow = totalUserLow; lastTotalSys = totalSys; lastTotalIdle = totalIdle; } fclose(file); } // Linux内存使用情况 struct sysinfo memInfo; if (sysinfo(&memInfo) == 0) { res.memory_total = memInfo.totalram * memInfo.mem_unit / (1024 * 1024); res.memory_available = memInfo.freeram * memInfo.mem_unit / (1024 * 1024); res.memory_used = res.memory_total - res.memory_available; } res.gpu_usage = 0.0; #endif return res; } void display_thread_func() { auto start_time = chrono::high_resolution_clock::now(); int iteration = 0; while (running) { iteration++; SystemResources res = get_system_resources(); string pi_value; int digits_calculated; { lock_guard<mutex> lock(data_mutex); pi_value = current_pi_value; digits_calculated = current_precision; } // 准备显示内容 stringstream display; display << "π: " << pi_value << "\n\n"; display << "CPU: " << fixed << setprecision(1) << res.cpu_usage << "%\n"; display << "GPU: " << fixed << setprecision(1) << res.gpu_usage << "%\n"; if (res.memory_total > 1024) { display << "内存: " << fixed << setprecision(1) << res.memory_used / 1024.0 << "GB/" << res.memory_total / 1024.0 << "GB (可用: " << res.memory_available / 1024.0 << "GB)\n"; } else { display << "内存: " << res.memory_used << "MB/" << res.memory_total << "MB (可用: " << res.memory_available << "MB)\n"; } display << "\n迭代次数: " << iteration << "\n"; auto current_time = chrono::high_resolution_clock::now(); double elapsed_seconds = chrono::duration_cast<chrono::duration<double>>(current_time - start_time).count(); double digits_per_second = digits_calculated / max(1.0, elapsed_seconds); display << "计算速度: " << fixed << setprecision(2) << digits_per_second << " 位/秒\n"; display << "已计算位数: " << digits_calculated << "\n"; system("clear || cls"); cout << display.str(); this_thread::sleep_for(chrono::milliseconds(500)); } } void calculation_thread_func() { PiCalculator calculator(2); // 初始精度 while (running) { string pi_value = calculator.calculate(); int precision = calculator.get_precision(); { lock_guard<mutex> lock(data_mutex); current_pi_value = pi_value; current_precision = precision; } // 逐步增加精度 int new_precision = min(precision * 2, 1000000); calculator.update_precision(new_precision); this_thread::sleep_for(chrono::milliseconds(100)); } } int main() { cout << "启动高性能π计算器..." << endl; cout << "使用Chudnovsky算法计算π" << endl; cout << "正在初始化..." << endl; this_thread::sleep_for(chrono::seconds(1)); try { thread display_thread(display_thread_func); thread calculation_thread(calculation_thread_func); cout << "按任意键停止计算..." << endl; cin.get(); running = false; display_thread.join(); calculation_thread.join(); cout << "\n计算已停止。" << endl; } catch (const exception& e) { cerr << "程序出错: " << e.what() << endl; return 1; } return 0; } 修改代码,使其可以正常的显示已计算的π位数和值,且可以正常的显示 CPU,内存 和 GPU 的使用率或占用大小,正确的使用内存,CPU 和 GPU,确保可以正常使用且可以打好配合 不在乎代码的工程量和长短,只追求完美的效果

#include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #include <iostream> #include <set> #include <map> #include <queue> using namespace std; typedef long long ll; const ll INF = (1ll << 62); #define DEBUG(x) std::cerr << #x << " = " << x << std::endl #define int ll inline ll read() { ll f = 1, x = 0;char ch; do {ch = getchar();if (ch == '-')f = -1;} while (ch > '9' || ch < '0'); do {x = x * 10 + ch - '0';ch = getchar();} while (ch >= '0' && ch <= '9'); return f * x; } const int MAX_N = 100000 + 50; const int MAX_M = 300000 + 50; const int MAX_F = 30 + 5; struct EDGE { int to, next, w; } edge[MAX_M << 1]; int head[MAX_N], cnt; void addedge (int u, int v, int w) { edge[++cnt].to = v; edge[cnt].w = w; edge[cnt].next = head[u]; head[u] = cnt; } int f[MAX_N][MAX_F], g[MAX_N][MAX_F], h[MAX_N][MAX_F], dep[MAX_N]; inline void ckmax (int &x, int y) { x = (x > y ? x : y); } inline void dfs (int u, int fa, int w) { dep[u] = dep[fa] + 1; f[u][0] = fa; g[u][0] = w; h[u][0] = -INF; for (int i = 1; i <= 20; i ++ ) { f[u][i] = f[f[u][i - 1]][i - 1]; g[u][i] = max (g[u][i - 1], g[f[u][i - 1]][i - 1]); h[u][i] = max (h[u][i - 1], h[f[u][i - 1]][i - 1]); if (g[u][i - 1] > g[f[u][i - 1]][i - 1]) h[u][i] = max (h[u][i], g[f[u][i - 1]][i - 1]); else if (g[u][i - 1] < g[f[u][i - 1]][i - 1]) h[u][i] = max (h[u][i], g[u][i - 1]); } for (int i = head[u]; i; i = edge[i].next ) { int v = edge[i].to, w = edge[i].w; if (v == fa) continue; dfs (v, u, w); } } inline int LCA (int x, int y) { if (dep[x] < dep[y]) swap (x, y); for (int i = 20; i >= 0; i -- ) { if (dep[f[x][i]] >= dep[y]) x = f[x][i]; } if (x == y) return x; for (int i = 20; i >= 0; i -- ) { if (f[x][i] != f[y][i]) { x = f[x][i]; y = f[y][i]; } } return f[x][0]; } int n, m, fa[MAX_N], res, sum; struct Node { int u, v, w; bool operator < (const Node & rhs ) const { return w < rhs.w; } } a[MAX_M << 1]; inline int find (int x) { return x == fa[x] ? x : fa[x] = find (fa[x]); } inline void merge (int x, int y) { x = find (x); y = find (y); if (x == y) return; fa[x] = y; } bool vis[MAX_M]; inline void kruskal () { n = read (); m = read (); for (int i = 1; i <= m; i ++ ) { a[i].u = read (); a[i].v = read (); a[i].w = read (); } sort (a + 1, a + m + 1); for (int i = 1; i <= n; i ++ ) fa[i] = i; res = 0; for (int i = 1; i <= m; i ++ ) { if (find (a[i].u) != find (a[i].v)) { vis[i] = 1; res ++ ; merge (a[i].u, a[i].v); sum += a[i].w; addedge (a[i].u, a[i].v, a[i].w); addedge (a[i].v, a[i].u, a[i].w); } if (res == n - 1) break; } res = 0; dfs (1, 0, 0); } inline int qmax (int u, int v, int maxx) { int ans = -INF; for (int i = 18; i >= 0; i -- ) { if (dep[f[u][i]] >= dep[v]) { if (maxx != g[u][i]) ans = max (ans, g[u][i]); else ans = max (ans, h[u][i]); u = f[u][i]; } } return ans; } inline void ckmin (int &x, int y) { x = (x < y ? x : y); } inline void calc () { int ans = INF; for (int i = 1; i <= m; i ++ ) { if (vis[i]) continue; int lca = LCA (a[i].u, a[i].v); int max_u = qmax (a[i].u, lca, a[i].w); int max_v = qmax (a[i].v, lca, a[i].w); ckmin (ans, sum - max (max_u, max_v) + a[i].w); } printf ("%lld\n", ans); } signed main() { kruskal (); calc (); return 0; }为什么qmax函数 需要循环 i 从大到小

#include <opencv2/opencv.hpp> #include <opencv2/calib3d.hpp> #include <iostream> #include <vector> using namespace cv; using namespace std; // 分离投影矩阵为R, t, K void decomposeProjectionMatrix(const Mat& projMat, Mat& R, Mat& t, Mat& K) { Mat projMat3x4 = projMat(Rect(0, 0, 3, 4)); Mat K_temp, R_temp, t_temp; decomposeProjectionMatrix(projMat3x4, K_temp, R_temp, t_temp); K = K_temp.clone(); R = R_temp.clone(); t = t_temp.clone(); } // 计算核线影像的Kop和Rop void calculateKopRop(const Mat& K, const Mat& R, const Mat& t, Mat& Kop, Mat& Rop) { // 初始化Kop,假设主点为(0, 0) double fx = K.at<double>(0, 0); double fy = K.at<double>(1, 1); double f_op = (fx + fy) / 2.0; // 使用焦距的平均值 Kop = (Mat_<double>(3, 3) << f_op, 0, 0, 0, f_op, 0, 0, 0, 1); // 计算Rop Mat temp = R.t() * t; temp = temp / norm(temp); // 归一化temp // 当核线影像为水平时,temp应为[0, 0, 1] if (temp.at<double>(0) == 0 && temp.at<double>(1) == 0 && temp.at<double>(2) == 1) { Rop = Mat::eye(3, 3, CV_64F); // 如果temp已经是[0, 0, 1],Rop为单位矩阵 } else { Mat e1 = (Mat_<double>(3, 1) << 1, 0, 0); Mat e2 = (Mat_<double>(3, 1) << 0, 1, 0); Mat e3 = (Mat_<double>(3, 1) << 0, 0, 1); Mat r1 = e1 - temp.dot(e1) * temp; r1 = r1 / norm(r1); Mat r2 = e2 - temp.dot(e2) * temp; r2 = r2 / norm(r2); Mat r3 = temp; Rop = (Mat_<double>(3, 3) << r1.at<double>(0), r2.at<double>(0), r3.at<double>(0), r1.at<double>(1), r2.at<double>(1), r3.at<double>(1), r1.at<double>(2), r2.at<double>(2), r3.at<double>(2)); } } // 计算单应矩阵 Mat calculateHomography(const Mat& K1, const Mat& R1, const Mat& t1, const Mat& K2, const Mat& R2, const Mat& t2) { Mat E = K1.t() * (R1.t() * R2) * K2; Mat t1_norm = K1.inv() * t1; Mat t2_norm = K2.inv() * t2; Mat t_cross = (t1_norm.cross(t2_norm)).reshape(0, 3); Mat H = E + t_cross; return H; } // 调整Kop的主点 void adjustKop(const Mat& img, Mat& Kop) { int w = img.cols; int h = img.rows; double cx = w / 2.0; double cy = h / 2.0; Kop.at<double>(0, 2) = cx; Kop.at<double>(1, 2) = cy; } int main() { // 读取两个图像 Mat img1 = imread("017ER030.tif"); Mat img2 = imread("017ER030.tif"); if (img1.empty() || img2.empty()) { cout << "Error loading images" << endl; return -1; } // 假设投影矩阵已知 Mat projMat1 = (Mat_<double>(3, 4) << 5526.4864457012472, 6363.7183421283298, -4131.0482340017224, -24448406087.5781860000000, 6172.8397894815880, -5588.8214670529014, -3384.5650572725663, 15591209748.2791840000000, -0.0319353657001, 0.0213700694115, -0.9992614535500, -54202.4500385644710 ); Mat projMat2 = (Mat_<double>(3, 4) << 5544.3514690660313, 6327.0017140488953, -4163.3807394948353, -24333678727.6017230000000, 6125.8241039199602, -5628.1100012630295, -3404.8221606458665, 15747662227.6377830000000, -0.0362355312611, 0.0203282471373, -0.9991365015065, -48380.1370322157820); // 分离投影矩阵 Mat R1, t1, K1; Mat R2, t2, K2; decomposeProjectionMatrix(projMat1, R1, t1, K1); decomposeProjectionMatrix(projMat2, R2, t2, K2); // 计算Kop和Rop Mat Kop1, Rop1; Mat Kop2, Rop2; calculateKopRop(K1, R1, t1, Kop1, Rop1); calculateKopRop(K2, R2, t2, Kop2, Rop2); // 计算单应矩阵 Mat H = calculateHomography(K1, R1, t1, K2, R2, t2); // 应用单应矩阵变换图像 Mat img1_warped, img2_warped; warpPerspective(img1, img1_warped, H, img1.size()); warpPerspective(img2, img2_warped, H, img2.size()); // 调整Kop的主点 adjustKop(img1_warped, Kop1); adjustKop(img2_warped, Kop2); // 显示结果 imshow("Epipolar Image 1", img1_warped); imshow("Epipolar Image 2", img2_warped); waitKey(0); return 0; }

// 结构体版 #include <cstring> #include <iostream> #include <algorithm> using namespace std; #define N 100005 #define LL long long #define lc u<<1 #define rc u<<1|1 LL w[N]; struct Tree{ //线段树 LL l,r,sum,add; }tr[N*4]; void pushup(LL u){ //上传 tr[u].sum=tr[lc].sum+tr[rc].sum; } void pushdown(LL u){ //下传 if(tr[u].add){ tr[lc].sum+=tr[u].add*(tr[lc].r-tr[lc].l+1), tr[rc].sum+=tr[u].add*(tr[rc].r-tr[rc].l+1), tr[lc].add+=tr[u].add, tr[rc].add+=tr[u].add, tr[u].add=0; } } void build(LL u,LL l,LL r){ //建树 tr[u]={l,r,w[l],0}; if(l==r) return; LL m=l+r>>1; build(lc,l,m); build(rc,m+1,r); pushup(u); } void change(LL u,LL l,LL r,LL k){ //区修 if(l<=tr[u].l&&tr[u].r<=r){ tr[u].sum+=(tr[u].r-tr[u].l+1)*k; tr[u].add+=k; return; } LL m=tr[u].l+tr[u].r>>1; pushdown(u); if(l<=m) change(lc,l,r,k); if(r>m) change(rc,l,r,k); pushup(u); } LL query(LL u,LL l,LL r){ //区查 if(l<=tr[u].l && tr[u].r<=r) return tr[u].sum; LL m=tr[u].l+tr[u].r>>1; pushdown(u); LL sum=0; if(l<=m) sum+=query(lc,l,r); if(r>m) sum+=query(rc,l,r); return sum; } int main(){ LL n,m,op,x,y,k; cin>>n>>m; for(int i=1; i<=n; i ++) cin>>w[i]; build(1,1,n); while(m--){ cin>>op>>x>>y; if(op==2)cout<<query(1,x,y)<<endl; else cin>>k,change(1,x,y,k); } return 0; }这是别人的 #include <bits/stdc++.h> using namespace std; #define lc p<<1 #define rc p<<1|1 const int N = 1e5+10; int n,m, a[N]; struct node {int l, r, sum, add; }; node tr[N*4]; void build(int p, int l, int r) { tr[p] = {l,r,a[l],0}; if(l == r) { tr[p].sum = a[l]; return; } int mid = (tr[p].l + tr[p].r) >> 1; build(lc, l, mid); build(rc, mid+1, r); tr[p].sum = tr[lc].sum + tr[rc].sum; } void updatedown(int p) { if(tr[p].add) { tr[lc].sum += (tr[lc].r - tr[lc].l + 1) * tr[p].add; tr[rc].sum += (tr[lc].r - tr[lc].l + 1) * tr[p].add; tr[lc].add += tr[p].add; tr[rc].add += tr[p].add; tr[p].add = 0; } } int query(int p, int l, int r) { // 当前区间被覆盖 if(tr[p].l >= l && tr[p].r <= r) return tr[p].sum; int mid = (tr[p].l + tr[p].r) >> 1; updatedown(p); // 先把帐算清 int sum = 0; if(mid >= l) sum += query(lc, l, mid); if(mid+1 <= r) sum += query(rc, mid+1, r); return sum; } void update(int p, int l, int r, int k) { if(tr[p].l >= l && tr[p].r <= r) { // 惰性标记 tr[p].sum += (k * (tr[p].r - tr[p].l + 1)); tr[p].add = k; return; } int mid = (tr[p].l + tr[p].r) >> 1; if(mid >= l) update(lc, l, mid,k); if(mid+1 <= r) update(rc, mid+1, r,k); tr[p].sum = tr[lc].sum + tr[rc].sum; } int main() { ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin >> n >> m; for(int i = 1; i <= n; i++) cin >> a[i]; build(1,1,n); while(m--) { int op,l,r,k; cin >> op; if(op == 1) { cin >> l >> r >> k; update(1,l,r,k); } else { cin >> l >> r; int s = query(1,l,r); cout << s << endl; } } return 0; }这是我的为什么别人的能ac,我的是wa

给错了,这才是问题代码#include <opencv2/opencv.hpp> #include <direct.h> #include <fstream> #include <vector> #include <iostream> #include <cmath> using namespace cv; using namespace std; int main() { // 创建输出目录 if (_mkdir("D:\\data1\\shuchu") != 0 && errno != EEXIST) { printf("目录创建失败!错误代码: %d", errno); return -1; } // 1. 读取视差图 Mat disp = imread("D:/data1/data1/DispImg/017ER030_017ER031_DISP_ET0.tif", IMREAD_UNCHANGED); if (disp.empty()) { printf("视差图加载失败!请检查路径和文件格式"); return -1; } // 调试输出:视差图信息 cout << "===== 视差图信息 =====" << endl; cout << "尺寸: " << disp.cols << "x" << disp.rows << endl; cout << "类型: " << disp.type() << " ("; if (disp.type() == CV_8U) cout << "8位无符号整数)"; else if (disp.type() == CV_16U) cout << "16位无符号整数)"; else if (disp.type() == CV_32F) cout << "32位浮点数)"; else cout << "未知类型)"; cout << endl; double minVal, maxVal; minMaxLoc(disp, &minVal, &maxVal); cout << "视差范围: " << minVal << " - " << maxVal << endl; // 2. 视差图处理:取绝对值(因为您的视差图为负值) Mat dispAbs; disp.convertTo(dispAbs, CV_32F); dispAbs = abs(dispAbs); // 取绝对值 // 3. 视差图归一化处理 Mat dispNormalized; normalize(dispAbs, dispNormalized, 0, 255, NORM_MINMAX, CV_8U); // 4. 伪彩色增强 Mat colorMap; applyColorMap(dispNormalized, colorMap, COLORMAP_JET); // 5. 保存处理结果 imwrite("D:/data1/shuchu/disparity_normalized.tif", dispNormalized); imwrite("D:/data1/shuchu/disparity_colormap.tif", colorMap); // ====== 深度图计算和点云生成 ====== // 6. 使用您提供的投影矩阵参数 Mat P1 = (Mat_<double>(3, 4) << 5526.4864457012472, 6363.7183421283298, -4131.0482340017224, -24448406087.578186, 6172.8397894815880, -5588.8214670529014, -3384.5650572725663, 15591209748.279184, -0.0319353657001, 0.0213700694115, -0.9992614535500, -54202.4500385644710); Mat P2 = (Mat_<double>(3, 4) << 5544.3514690660313, 6327.0017140488953, -4163.3807394948353, -24333678727.601723, 6125.8241039199602, -5628.1100012630295, -3404.8221606458665, 15747662227.637783, -0.0362355312611, 0.0203282471373, -0.9991365015065, -48380.1370322157820); // 7. 计算相机参数 double cx1 = P1.at<double>(0, 2); double cy1 = P1.at<double>(1, 2); double f = P1.at<double>(0, 0); // 焦距 // 计算基线T(相机间距离) Mat P1_3x3 = P1.colRange(0, 3); Mat P2_3x3 = P2.colRange(0, 3); // 计算相机中心 Mat O1 = -P1_3x3.inv() * P1.col(3); Mat O2 = -P2_3x3.inv() * P2.col(3); double T = norm(O1 - O2); cout << "\n===== 相机参数 =====" << endl; cout << "焦距 f = " << f << endl; cout << "主点 cx = " << cx1 << ", cy = " << cy1 << endl; cout << "基线 T = " << T << " 单位" << endl; // 8. 计算深度图 const double minDisparity = 0.1; // 最小有效视差 Mat depthMap(dispAbs.size(), CV_32FC1, Scalar(0)); int validPoints = 0; for (int y = 0; y < dispAbs.rows; y++) { for (int x = 0; x < dispAbs.cols; x++) { float d = dispAbs.at<float>(y, x); if (d > minDisparity) { depthMap.at<float>(y, x) = (f * T) / d; validPoints++; } } } // 调试输出:深度图信息 cout << "\n===== 深度图信息 =====" << endl; cout << "有效点数量: " << validPoints << "/" << (dispAbs.rows * dispAbs.cols) << " (" << (100.0 * validPoints / (dispAbs.rows * dispAbs.cols)) << "%)" << endl; double minDepth, maxDepth; minMaxLoc(depthMap, &minDepth, &maxDepth, NULL, NULL, depthMap > 0); cout << "深度范围: " << minDepth << " - " << maxDepth << endl; // 9. 保存深度图 Mat depthVis; normalize(depthMap, depthVis, 0, 65535, NORM_MINMAX, CV_16U); imwrite("D:/data1/shuchu/depth_map.tif", depthVis); // 10. 读取左图像用于点云着色 Mat leftImg = imread("D:/data1/data1/017ER030.tif", IMREAD_COLOR); if (leftImg.empty()) { cerr << "错误:无法加载左图像!" << endl; return -1; } // 调整左图像尺寸以匹配视差图 Mat leftImgResized; resize(leftImg, leftImgResized, dispAbs.size()); // 11. 生成点云 string plyPath = "D:/data1/shuchu/point_cloud.ply"; cout << "\n===== 生成点云 =====" << endl; cout << "输出路径: " << plyPath << endl; ofstream plyFile(plyPath); if (!plyFile) { cerr << "错误:无法创建点云文件!" << endl; return -1; } // PLY文件头 plyFile << "ply\n"; plyFile << "format ascii 1.0\n"; plyFile << "element vertex " << validPoints << "\n"; plyFile << "property float x\n"; plyFile << "property float y\n"; plyFile << "property float z\n"; plyFile << "property uchar red\n"; plyFile << "property uchar green\n"; plyFile << "property uchar blue\n"; plyFile << "end_header\n"; // 生成点云数据 int count = 0; for (int y = 0; y < dispAbs.rows; y++) { for (int x = 0; x < dispAbs.cols; x++) { float depth = depthMap.at<float>(y, x); if (depth <= 0) continue; Vec3b color = leftImgResized.at<Vec3b>(y, x); // 计算3D坐标 float Z = depth; float X = (x - cx1) * Z / f; float Y = (y - cy1) * Z / f; // 写入点云数据 plyFile << X << " " << Y << " " << Z << " " << static_cast<int>(color[2]) << " " << static_cast<int>(color[1]) << " " << static_cast<int>(color[0]) << "\n"; count++; // 每处理10000个点输出进度 if (count % 10000 == 0) { cout << "已生成 " << count << "/" << validPoints << " 个点" << endl; } } } plyFile.close(); cout << "\n===== 点云生成完成 =====" << endl; cout << "共生成 " << count << " 个点" << endl; // ====== 显示结果 ====== Mat resultDisplay; Mat dispNormalized3ch; cvtColor(dispNormalized, dispNormalized3ch, COLOR_GRAY2BGR); hconcat(dispNormalized3ch, colorMap, resultDisplay); Mat depthDisplay; normalize(depthMap, depthDisplay, 0, 255, NORM_MINMAX, CV_8U); applyColorMap(depthDisplay, depthDisplay, COLORMAP_JET); imshow("Disparity Processing", resultDisplay); imshow("Depth Map", depthDisplay); waitKey(0); cout << "\n处理完成!请检查输出文件:" << endl; cout << "1. 视差图: D:/data1/shuchu/disparity_*.tif" << endl; cout << "2. 深度图: D:/data1/shuchu/depth_map.tif" << endl; cout << "3. 点云: " << plyPath << endl; return 0; }

#include <iostream> #include <fstream> #include <opencv2/opencv.hpp> #include "gdal/gdal_priv.h" #pragma comment(lib, "gdal_i.lib") #include <filesystem> #include<tuple> #include <gdal.h> #include <gdal_priv.h> #include <cpl_conv.h> #include <boost/filesystem.hpp> #include "gdal_priv.h" #include "cpl_conv.h" #include #include #include #include using namespace std; using namespace cv; // Function to read data from a txt file and store it in a matrix bool readDataFromFile(const string& filename, Mat& dataMat) { ifstream file(filename); if (!file.is_open()) { cout << "Error: Could not open the file " << filename << endl; return false; } dataMat.create(3, 4, CV_32FC1); for (int i = 0; i < dataMat.rows; ++i) { for (int j = 0; j < dataMat.cols; ++j) { float value; if (!(file >> value)) { cout << "Error: Could not read data properly from the file " << filename << endl; return false; } dataMat.at<float>(i, j) = value; } } file.close(); return true; } // Function to convert disparity map to depth map Mat disparityToDepth(cv::Mat disImg, float baselineLength, float focalLength) { int width = disImg.cols; int height = disImg.rows; std::cout << "distance:" << width << height << std::endl; Mat depthImage = Mat::zeros(height, width, CV_32FC1); std::cout << "断点" << " 6 " << std::endl; for (int row = 0; row < height; ++row) { // std::cout << "断点" << " 7 " << std::endl; for (int col = 0; col < width; ++col) { float distance = 0; distance = disImg.at<float>(row, col); // std::cout << "distance:" << distance << std::endl; if (distance != 0.0) { depthImage.at<float>(row, col) = (baselineLength * focalLength ) / distance; } else { continue; } } } return depthImage; // 返回深度图 } std::vector<Mat> readEplimg(const std::string& folderPath) { GDALAllRegister(); CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "NO"); //设置支持中文路径和文件名 std::vector<Mat> Eplimg; if (!boost::filesystem::exists(folderPath) || !boost::filesystem::is_directory(folderPath)) { std::cerr << "Error: " << folderPath << " is not a valid directory." << std::endl; return Eplimg; } // 遍历文件夹中的每个文件 boost::filesystem::directory_iterator end_itr; for (boost::filesystem::directory_iterator itr(folderPath); itr != end_itr; ++itr) { if (boost::filesystem::is_regular_file(itr->status()) && (itr->path().extension() == ".tiff" || itr->path().extension() == ".tif")) { std::string filePath = itr->path().string(); // 打开tiff文件 GDALDataset* poDataset = (GDALDataset*)GDALOpenShared(filePath.c_str(), GA_ReadOnly); if (poDataset == nullptr) { std::cerr << "Error opening image " << filePath << std::endl; continue; } // 获取图像宽度和高度 int width = poDataset->GetRasterXSize(); int height = poDataset->GetRasterYSize(); // 获取波段数量 int numBands = poDataset->GetRasterCount(); // 读取图像数据 cv::Mat image(height, width, CV_16U); //poDataset->RasterIO(GF_Read, 0, 0, width, height, image.data, width, height, GDT_UInt16, 0, 0); GDALRasterBand* poBand = poDataset->GetRasterBand(1); poBand->RasterIO(GF_Read, 0, 0, width, height, image.data, width, height, GDT_UInt16, 0, 0); // 关闭文件 GDALClose(poDataset); // 将图像添加到向量中 Eplimg.push_back(image); } } return Eplimg; } cv::Mat readDisparityImage(const std::string& filePath) { GDALAllRegister(); // 打开 TIFF 文件 GDALDataset *disparityDataset = (GDALDataset *)GDALOpen(filePath.c_str(), GA_ReadOnly); if (disparityDataset == NULL) { std::cerr << "无法打开图像文件!" << std::endl; return cv::Mat(); } // 获取图像宽度和高度 int width = disparityDataset->GetRasterXSize(); int height = disparityDataset->GetRasterYSize(); std::cout << "图像尺寸:" << width << " x " << height << std::endl; // 获取第一个波段 // GDALRasterBand *poBand = disparityDataset->GetRasterBand(1); // 获取波段数量 int numBands = disparityDataset->GetRasterCount(); // 读取图像数据 cv::Mat image(height, width, CV_32FC1); GDALRasterBand* poBand = disparityDataset->GetRasterBand(1); GDALDataType g_type = poBand->GetRasterDataType(); // std::cout << "断点" << width << " 1 " << height << std::endl; // float *data = new float [width * height]; // std::cout << "断点" << width << " 2 " << height << std::endl; // poBand->RasterIO(GF_Read, 0, 0, width, height, data, width, height, GDT_Float64, 0, 0); std::cout << "断点" << width << " 3 " << height << std::endl; // 将数据转换为 OpenCV 的 cv::Mat 格式 // cv::Mat img(height, width, CV_64F, data); disparityDataset->GetRasterBand(1)->RasterIO(GF_Read, 0, 0, width, height, image.data, width, height, g_type, 0, 0); poBand->RasterIO(GF_Read, 0, 0, width, height, image.data, width, height, g_type, 0,0); std::cout << "断点" << width << " 4 " << height << std::endl; // 释放内存 // delete[] data; GDALClose(disparityDataset); return image; } std::vector<cv::Mat> readColorImages(const std::string& folderPath) { GDALAllRegister(); CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "NO"); //设置支持中文路径和文件名 std::vector<cv::Mat> colorImg; if (!boost::filesystem::exists(folderPath) || !boost::filesystem::is_directory(folderPath)) { std::cerr << "Error: " << folderPath << " is not a valid directory." << std::endl; return colorImg; } boost::filesystem::directory_iterator end_itr; for (boost::filesystem::directory_iterator itr(folderPath); itr != end_itr; ++itr) { if (boost::filesystem::is_regular_file(itr->status()) && (itr->path().extension() == ".tiff" || itr->path().extension() == ".tif")) { std::string filePath = itr->path().string(); GDALDataset* poDataset = (GDALDataset*)GDALOpenShared(filePath.c_str(), GA_ReadOnly); if (poDataset == nullptr) { std::cerr << "Error opening image " << filePath << std::endl; continue; } int width = poDataset->GetRasterXSize(); int height = poDataset->GetRasterYSize(); int numBands = poDataset->GetRasterCount(); // 创建一个3通道的Mat矩阵 cv::Mat image(height, width, CV_8UC3); // 逐波段读取数据并存储到Mat矩阵中 for (int b = 1; b <= std::min(numBands, 3); ++b) { // 限制最多读取前3个波段 GDALRasterBand* poBand = poDataset->GetRasterBand(b); poBand->RasterIO(GF_Read, 0, 0, width, height, image.data + (b - 1), width, height, GDT_Byte, 3, width * 3); } // 关闭文件 GDALClose(poDataset); // 将图像添加到向量中 cv::cvtColor(image, image, cv::COLOR_RGB2BGR); // 转换为BGR格式 colorImg.push_back(image); } } return colorImg; } void saveDepthImageWithGDAL(const cv::Mat& depthImage, const std::string& outputPath) { // 初始化 GDAL 库 GDALAllRegister(); // 获取深度图像的尺寸信息 int width = depthImage.cols; int height = depthImage.rows; // 创建输出文件 GDALDriver* driver = GetGDALDriverManager()->GetDriverByName("GTiff"); if (driver == nullptr) { std::cerr << "Error: Could not get GDAL driver." << std::endl; return; } // 创建输出数据集 GDALDataset* dataset = driver->Create(outputPath.c_str(), width, height, 1, GDT_Float32, NULL); if (dataset == nullptr) { std::cerr << "Error: Could not create GDAL dataset." << std::endl; return; } // 将深度图像数据写入到数据集中 float* data = (float*)CPLMalloc(sizeof(float) * width * height); for (int i = 0; i < height; ++i) { for (int j = 0; j < width; ++j) { data[i * width + j] = depthImage.at<float>(i, j); } } GDALRasterBand* band = dataset->GetRasterBand(1); band->RasterIO(GF_Write, 0, 0, width, height, data, width, height, GDT_Float32, 0, 0); // 释放内存和关闭数据集 CPLFree(data); GDALClose(dataset); } void depthToCloudPoint(std::vector<Mat>colorImage,Mat depthImage ,float focalLength_x,float focalLength_y) { pcl::PointCloud::Ptr cloud(new pcl::PointCloud); std::cout << "size:" << depthImage.rows << "x" << depthImage.cols << std::endl; for (int y = 0; y < depthImage.rows; ++y) { for (int x = 0; x < depthImage.cols; ++x) { if (y >= 0 && y < depthImage.rows && x >= 0 && x < depthImage.cols) { // 获取深度值 float depth = depthImage.at <float>(y, x); // 如果深度值为0(无效值),跳过 if (depth == 0.0f) continue; // 计算点云位置 pcl::PointXYZRGB point; point.z = depth; point.x = (x - focalLength_x) * depth / focalLength_x; point.y = (y - focalLength_y) * depth / focalLength_y; std::cout << "size:" << "9" << std::endl; //std::cout << "color:" << colorImage << std::endl; // 获取相应位置的彩色像素值作为颜色 cv::Vec3b color = colorImage[0].at<cv::Vec3b>(y, x); std::cout << "color:" << color << std::endl; point.r = color[2]; point.g = color[1]; point.b = color[0]; std::cout << "color:" << color << std::endl; // 将点添加到点云中 cloud->push_back(point); } } } pcl::io::savePLYFile("pointcloud.ply", *cloud); pcl::io::savePCDFileBinary("point_cloud.pcd", *cloud); pcl::io::savePLYFileBinary("point_cloud.ply", *cloud); std::cout << "Point cloud saved to point_cloud.ply" << std::endl; } int main() { std::vector<Mat> Eplimg = readEplimg("/home/tl/3rdparty/homeworks/build/EpiImg"); std::vector<Mat> colorImage = readColorImages("/home/tl/3rdparty/homeworks/build/EpiImg"); cv::Mat disImg = readDisparityImage("/home/tl/3rdparty/homeworks/build/017ER030_017ER031_DISP_ET0.tif"); // 检查是否成功读取 if (disImg.empty()) { std::cerr << "图像读取失败!" << std::endl; } Mat dataMatleft, dataMatright; if (!readDataFromFile("017ER030_REC.txt", dataMatleft) || !readDataFromFile("017ER031_REC.txt", dataMatright)) { return -1; } Mat K1, R1, t1, K2, R2, t2; decomposeProjectionMatrix(dataMatleft, K1, R1, t1); decomposeProjectionMatrix(dataMatright, K2, R2, t2); Mat B = t1 - t2; float baseline_length = norm(B); float focalLength_x = K1.at<float>(0, 0); // 从相机内参矩阵K1中获取水平方向的焦距 cout << "基线长度: " << baseline_length << endl; cout << "焦距: " << focalLength_x << endl; std::cout << "断点" << " 5 " << std::endl; // 或者 float focalLength_y = K1.at<float>(1, 1); // 从相机内参矩阵K1中获取垂直方向的焦距 Mat depthImage = disparityToDepth(disImg, baseline_length, focalLength_x); // 调用 disparityToDepth 函数获取深度图 // 设置输出路径 std::string outputPath = "output_depth_image.tif"; // 将深度图像保存为图片文件 saveDepthImageWithGDAL(depthImage, outputPath); // 调用函数进行深度图像到点云的转换 depthToCloudPoint(colorImage, depthImage, focalLength_x, focalLength_y); cout << "基线长度: " << baseline_length << endl; cout << "相机内参矩阵 K:" << endl << K1 << endl; cout << "旋转矩阵 R:" << endl << R1 << endl; cout << "平移向量 t:" << endl << t1 << endl; cout << "Data matrix 1:" << endl << dataMatleft << endl; cout << "Data matrix 2:" << endl << dataMatright << endl; return 0; }把这个改为只用opencv库就能实现的代码

#include <opencv2/opencv.hpp> #include <iostream> #include <vector> #include <cmath> using namespace cv; using namespace std; // 归一化向量函数 Mat normalizeVec(const Mat& vec) { double x = vec.at<double>(0); double y = vec.at<double>(1); double z = vec.at<double>(2); double norm = sqrt(x * x + y * y + z * z); return (Mat_<double>(3, 1) << x / norm, y / norm, z / norm); } // 计算叉积 Mat crossProduct(const Mat& a, const Mat& b) { double ax = a.at<double>(0), ay = a.at<double>(1), az = a.at<double>(2); double bx = b.at<double>(0), by = b.at<double>(1), bz = b.at<double>(2); return (Mat_<double>(3, 1) << ay * bz - az * by, az * bx - ax * bz, ax * by - ay * bx); } // 确保变换后包含整个原始图像 Mat ensureFullImage(const Mat& H, const Mat& img, Size& new_size) { vector corners(4); corners[0] = Point2d(0, 0); corners[1] = Point2d(img.cols - 1, 0); corners[2] = Point2d(0, img.rows - 1); corners[3] = Point2d(img.cols - 1, img.rows - 1); vector transformed(4); perspectiveTransform(corners, transformed, H); double min_x = transformed[0].x; double min_y = transformed[0].y; double max_x = transformed[0].x; double max_y = transformed[0].y; for (int i = 1; i < 4; i++) { min_x = min(min_x, transformed[i].x); min_y = min(min_y, transformed[i].y); max_x = max(max_x, transformed[i].x); max_y = max(max_y, transformed[i].y); } double width = max_x - min_x; double height = max_y - min_y; // 设置最大尺寸限制 const int MAX_DIMENSION = 15000; if (width <= 0 || height <= 0 || width > MAX_DIMENSION || height > MAX_DIMENSION) { new_size = img.size(); return Mat::eye(3, 3, CV_64F); } // 添加30%边界 + 200像素固定边界 double border_x = max(width * 0.3, 200.0); double border_y = max(height * 0.3, 200.0); min_x -= border_x; max_x += border_x; min_y -= border_y; max_y += border_y; new_size = Size(ceil(max_x - min_x), ceil(max_y - min_y)); // 创建平移矩阵 Mat T = Mat::eye(3, 3, CV_64F); T.at<double>(0, 2) = -min_x; T.at<double>(1, 2) = -min_y; return T * H; } int main() { try { // 定义投影矩阵 (确保每个矩阵有12个元素) Mat P1 = (Mat_<double>(3, 4) << 5526.4864457012472, 6363.7183421283298, -4131.0482340017224, -24448406087.578186, 6172.8397894815880, -5588.8214670529014, -3384.5650572725663, 15591209748.279184, -0.0319353657001, 0.0213700694115, -0.9992614535500, -54202.4500385644710); Mat P2 = (Mat_<double>(3, 4) << 5544.3514690660313, 6327.0017140488953, -4163.3807394948353, -24333678727.601723, 6125.8241039199602, -5628.1100012630295, -3404.8221606458665, 15747662227.637783, -0.0362355312611, 0.0203282471373, -0.9991365015065, -48380.1370322157820); // 加载图像 Mat img_left = imread("C:\\Users\\86198\\Desktop\\1\\data1\\data1\\017ER030.tif"); Mat img_right = imread("C:\\Users\\86198\\Desktop\\1\\data1\\data1\\017ER031.tif"); if (img_left.empty() || img_right.empty()) { cerr << "Error loading images" << endl; return -1; } // 分解投影矩阵 Mat K1, K2, R1, R2, t1, t2; decomposeProjectionMatrix(P1, K1, R1, t1); decomposeProjectionMatrix(P2, K2, R2, t2); t1 = t1.rowRange(0, 3) / t1.at<double>(3); t2 = t2.rowRange(0, 3) / t2.at<double>(3); // 计算相机中心和基线 Mat R1_inv = R1.inv(DECOMP_SVD); Mat R2_inv = R2.inv(DECOMP_SVD); Mat C1 = -R1_inv * t1; Mat C2 = -R2_inv * t2; Mat b = C2 - C1; // 定义三个方向 vector<Mat> rops; rops.push_back((Mat_<double>(3, 1) << 0, 0, 1); // 水平 rops.push_back((Mat_<double>(3, 1) << 0, 1, 0); // 垂直 rops.push_back(normalizeVec(R1.row(2).t())); // 原始 vector<string> dir_names; dir_names.push_back("horizontal"); dir_names.push_back("vertical"); dir_names.push_back("original"); for (int i = 0; i < 3; i++) { // 计算坐标系 Mat z_axis = rops[i]; Mat x_axis, y_axis; // 处理基线与方向平行的情况 Mat cross_b_z = crossProduct(b, z_axis); double n = norm(cross_b_z); if (n < 1e-5) { Mat ref_vec = (Mat_<double>(3, 1) << 1, 0, 0); if (abs(z_axis.dot(ref_vec)) > 0.95) { ref_vec = (Mat_<double>(3, 1) << 0, 0, 1); } x_axis = normalizeVec(ref_vec - (ref_vec.dot(z_axis)) * z_axis); } else { x_axis = normalizeVec(cross_b_z); } y_axis = normalizeVec(crossProduct(z_axis, x_axis)); // 构造目标旋转矩阵 Mat R_target = (Mat_<double>(3, 3) << x_axis.at<double>(0), x_axis.at<double>(1), x_axis.at<double>(2), y_axis.at<double>(0), y_axis.at<double>(1), y_axis.at<double>(2), z_axis.at<double>(0), z_axis.at<double>(1), z_axis.at<double>(2)); R_target = R_target.t(); // 计算新的旋转矩阵和单应矩阵 Mat R1_new = R_target * R1.t(); Mat R2_new = R_target * R2.t(); Mat K1_temp = K1.clone(); Mat K2_temp = K2.clone(); K1_temp.at<double>(0, 2) = 0; K1_temp.at<double>(1, 2) = 0; K2_temp.at<double>(0, 2) = 0; K2_temp.at<double>(1, 2) = 0; double avg_focal1 = (K1.at<double>(0, 0) + K1.at<double>(1, 1)) / 2.0; double avg_focal2 = (K2.at<double>(0, 0) + K2.at<double>(1, 1)) / 2.0; K1_temp.at<double>(0, 0) = avg_focal1; K1_temp.at<double>(1, 1) = avg_focal1; K2_temp.at<double>(0, 0) = avg_focal2; K2_temp.at<double>(1, 1) = avg_focal2; Mat H1 = K1_temp * R1_new * K1.inv(); Mat H2 = K2_temp * R2_new * K2.inv(); // 调整单应矩阵确保包含整个图像 Size new_size1, new_size2; Mat H1_adj = ensureFullImage(H1, img_left, new_size1); Mat H2_adj = ensureFullImage(H2, img_right, new_size2); // 应用透视变换 Mat rect_left, rect_right; warpPerspective(img_left, rect_left, H1_adj, new_size1); warpPerspective(img_right, rect_right, H2_adj, new_size2); // 保存结果 imwrite("rectified_left_" + dir_names[i] + ".png", rect_left); imwrite("rectified_right_" + dir_names[i] + ".png", rect_right); } cout << "核线影像已生成并保存!" << endl; return 0; } catch (const Exception& e) { cerr << "OpenCV Exception: " << e.what() << endl; return -1; } catch (...) { cerr << "Unknown exception occurred!" << endl; return -1; } } 按照这个代码的思路综合我之前的要求重新给我写一份,要求不能和这个雷同

大家在看

recommend-type

《极品家丁(七改版)》(珍藏七改加料无雷精校全本)(1).zip

《极品家丁(七改版)》(珍藏七改加料无雷精校全本)(1).zip
recommend-type

密码::unlocked::sparkles::locked:创新,方便,安全的加密应用程序

隐身者 创新,方便,安全的加密应用程序。 加密无限位。 只记得一点。 Crypter是一款跨平台的加密应用程序,它使加密和解密变得很方便,同时仍然保持强大的安全性。 它解决了当今大多数安全系统中最弱的链接之一-弱密码。 它简化了安全密码的生成和管理,并且只需要记住一个位-MasterPass。 是一个加密应用程序,可以解密和加密包括文件和文件夹在内的任意数据。 该版本已发布,并针对macOS(OSX),Linux(适用于所有通过发行的发行版)和Windows(32和64位)进行了全面测试。 所有核心模块(提供核心功能的模块)都经过了全面测试。 会将MasterPass保存在操作系统的钥匙串中,因此您不必在每次打开应用程序时都输入它。 为了帮助加快开发速度,请发送PR剩下的内容做 如果您有任何建议,请打开一个问题,并通过PR进行改进! 还要签出 ( )一个分散的端到端加密消息传递应用程序。 链接到此自述文件: : 内容 安装 适用于所有主要平台的所有预构建二进制文件都可以在。 Crypter也适用于macOS的 。 因此,要安装它,只需在终端中运行以下命令:
recommend-type

HkAndroidSDK.zip

助于Android开发视频监控功能,根据ip地址可以远程操控,控制向左,向右,向下,向上以及转动摄像头,也可以放大和缩小
recommend-type

matlab的欧拉方法代码-BEM_flow_simulation:计算流体力学:使用边界元方法模拟障碍物周围/附近的流动

matlab的欧拉方法代码BEM_flow_simulation MATLAB上的计算流体力学: 目的是使用边界元素方法模拟任何障碍物附近或周围的任何形式的流动 使用BEM绕圆柱障碍物和接近均匀战争的潜在流动 非粘性势流的假设适用于导航斯托克斯方程(Euler方程),使用边界元方法,该代码模拟了在均匀垂直壁附近的尺寸稳定的圆柱障碍物周围的流动。 该系统不受其他方向的限制。 该代码是流体力学硕士1实习的主题,并且作为大型项目的第一块砖,该项目用于模拟复杂非均匀障碍物周围的粘性流动,因此可以自由继续。 类“ pot_flow_class”模拟垂直于垂直壁(两个障碍物之间的距离为H)附近圆柱2D障碍物(无量纲半径r = 1)附近的该势流。 流速为U = 1(无量纲)。 使用边界元素方法的第二层。 这样的流动的精确解决方案的代码允许验证无垂直壁模拟。
recommend-type

基于YOLO网络的行驶车辆目标检测matlab仿真+操作视频

1.领域:matlab,YOLO网络的行驶车辆目标检测算法 2.内容:基于YOLO网络的行驶车辆目标检测matlab仿真+操作视频 3.用处:用于YOLO网络的行驶车辆目标检测算法编程学习 4.指向人群:本硕博等教研学习使用 5.运行注意事项: 使用matlab2021a或者更高版本测试,运行里面的Runme_.m文件,不要直接运行子函数文件。运行时注意matlab左侧的当前文件夹窗口必须是当前工程所在路径。 具体可观看提供的操作录像视频跟着操作。

最新推荐

recommend-type

永磁同步电机全速域无传感器控制技术及其应用 加权切换法

内容概要:本文详细探讨了永磁同步电机(PMSM)在全速域范围内的无传感器控制技术。针对不同的速度区间,提出了三种主要的控制方法:零低速域采用高频脉振方波注入法,通过注入高频方波信号并处理产生的交互信号来估算转子位置;中高速域则使用改进的滑膜观测器,结合连续的sigmoid函数和PLL锁相环,实现对转子位置的精确估计;而在转速切换区域,则采用了加权切换法,动态调整不同控制方法的权重,确保平滑过渡。这些方法共同实现了电机在全速域内的高效、稳定运行,减少了对传感器的依赖,降低了系统复杂度和成本。 适合人群:从事电机控制系统设计、研发的技术人员,尤其是关注永磁同步电机无传感器控制领域的研究人员和技术爱好者。 使用场景及目标:适用于需要优化电机控制系统,减少硬件成本和提升系统可靠性的应用场景。目标是在不依赖额外传感器的情况下,实现电机在各种速度条件下的精准控制。 其他说明:文中引用了多篇相关文献,为每种控制方法提供了理论依据和实验验证的支持。
recommend-type

langchain4j-spring-boot-starter-0.29.1.jar中文文档.zip

1、压缩文件中包含: 中文文档、jar包下载地址、Maven依赖、Gradle依赖、源代码下载地址。 2、使用方法: 解压最外层zip,再解压其中的zip包,双击 【index.html】 文件,即可用浏览器打开、进行查看。 3、特殊说明: (1)本文档为人性化翻译,精心制作,请放心使用; (2)只翻译了该翻译的内容,如:注释、说明、描述、用法讲解 等; (3)不该翻译的内容保持原样,如:类名、方法名、包名、类型、关键字、代码 等。 4、温馨提示: (1)为了防止解压后路径太长导致浏览器无法打开,推荐在解压时选择“解压到当前文件夹”(放心,自带文件夹,文件不会散落一地); (2)有时,一套Java组件会有多个jar,所以在下载前,请仔细阅读本篇描述,以确保这就是你需要的文件。 5、本文件关键字: jar中文文档.zip,java,jar包,Maven,第三方jar包,组件,开源组件,第三方组件,Gradle,中文API文档,手册,开发手册,使用手册,参考手册。
recommend-type

4节点光储直流微网:基于多目标控制与多智能体一致性的光伏MPPT与储能双向DCDC优化

内容概要:本文介绍了一个15kW、400V级的四节点光储直流微网系统的设计与实现。该系统采用多目标控制、多智能体一致性及二次优化技术,旨在实现高效的能量管理和稳定的系统运行。具体而言,光伏MPPT采用粒子群算法以最大化太阳能利用率;储能系统的双向DCDC变换器则运用了多种控制策略,如电流内环的模型预测控制、电压环的分布式控制、初级控制的下垂策略以及二次控制的差异性和电压补偿策略。这些措施共同确保了直流母线电压的恢复和储能系统的SoC一致控制。 适合人群:从事电力电子、新能源技术和微网系统研究的专业人士,尤其是关注光储直流微网系统设计与优化的研究人员和技术人员。 使用场景及目标:适用于需要深入了解光储直流微网系统设计原理及其控制策略的应用场合,如科研机构、高校实验室、电力公司等。目标是为相关领域的研究人员提供理论依据和技术支持,促进微网技术的发展。 其他说明:文中详细讨论了各部分的具体实现方法和技术细节,对于希望深入理解光储直流微网系统运作机制的读者非常有帮助。
recommend-type

电动汽车BMS电池管理系统应用层软件模型:MBD方法、通信协议及AUTOSAR构建 MBD建模

基于模型开发(MBD)的BMS电池管理系统应用层软件模型。首先概述了BMS的核心任务,即确保电池的安全与高效运行,涉及充电、放电控制、实时监测和均衡管理。接着重点讨论了SUMlink电池管理系统策略模型,该模型通过收集和处理电池的数据(如电压、电流、温度),并运用多种算法(如SOC估算、SOH评估)来优化电池性能。文中还阐述了BMC CVS内部通讯协议DBC的作用,确保各模块间数据传输的准确性与效率。此外,文章介绍了采用AUTOSAR标准的底层Build工程,提高了系统的可维护性、可扩展性和可靠性。最后提到了INCA A2L标定文件的应用,用于配置和调整系统参数,以满足不同需求。通过代码分析与实践,进一步加深了对BMS的理解。 适合人群:从事电动汽车电池管理系统研究与开发的技术人员,尤其是对MBD方法、通信协议和AUTOSAR标准感兴趣的工程师。 使用场景及目标:适用于希望深入了解BMS系统的设计原理和技术细节的专业人士,旨在提高他们对该领域的理论认知和实际操作能力。 其他说明:文章不仅涵盖了理论知识,还包括具体的代码实现和实践指导,有助于读者全面掌握BMS的工作机制。
recommend-type

Webdiy.net新闻系统v1.0企业版发布:功能强大、易操作

标题中提到的"Webdiy.net新闻系统 v1.0 企业版"是一个针对企业级应用开发的新闻内容管理系统,是基于.NET框架构建的。从描述中我们可以提炼出以下知识点: 1. **系统特性**: - **易用性**:系统设计简单,方便企业用户快速上手和操作。 - **可定制性**:用户可以轻松修改网站的外观和基本信息,例如网页标题、页面颜色、页眉和页脚等,以符合企业的品牌形象。 2. **数据库支持**: - **Access数据库**:作为轻量级数据库,Access对于小型项目和需要快速部署的场景非常合适。 - **Sql Server数据库**:适用于需要强大数据处理能力和高并发支持的企业级应用。 3. **性能优化**: - 系统针对Access和Sql Server数据库进行了特定的性能优化,意味着它能够提供更为流畅的用户体验和更快的数据响应速度。 4. **编辑器功能**: - **所见即所得编辑器**:类似于Microsoft Word,允许用户进行图文混排编辑,这样的功能对于非技术人员来说非常友好,因为他们可以直观地编辑内容而无需深入了解HTML或CSS代码。 5. **图片管理**: - 新闻系统中包含在线图片上传、浏览和删除的功能,这对于新闻编辑来说是非常必要的,可以快速地为新闻内容添加相关图片,并且方便地进行管理和更新。 6. **内容发布流程**: - **审核机制**:后台发布新闻后,需经过审核才能显示到网站上,这样可以保证发布的内容质量,减少错误和不当信息的传播。 7. **内容排序与类别管理**: - 用户可以按照不同的显示字段对新闻内容进行排序,这样可以突出显示最新或最受欢迎的内容。 - 新闻类别的动态管理及自定义显示顺序,可以灵活地对新闻内容进行分类,方便用户浏览和查找。 8. **前端展示**: - 系统支持Javascript前端页面调用,这允许开发者将系统内容嵌入到其他网页或系统中。 - 支持iframe调用,通过这种HTML元素可以将系统内容嵌入到网页中,实现了内容的跨域展示。 9. **安全性**: - 提供了默认的管理账号和密码(webdiy / webdiy.net),对于企业应用来说,这些默认的凭证需要被替换,以保证系统的安全性。 10. **文件结构**: - 压缩包文件名称为"webdiynetnews",这可能是系统的根目录名称或主要安装文件。 11. **技术栈**: - 系统基于ASP.NET技术构建,这表明它使用.NET框架开发,并且可以利用.NET生态中的各种库和工具来实现功能的扩展和维护。 在实施和部署这样的系统时,企业可能还需要考虑以下方面: - **可扩展性**:随着业务的增长,系统应该能容易地扩展,以支持更多的用户和内容。 - **安全性**:除了更改为安全的管理员凭证外,还需考虑防止SQL注入、XSS攻击等网络安全问题。 - **备份和恢复**:定期备份数据库和内容是很重要的,以防数据丢失或需要恢复到先前的状态。 - **多用户和权限管理**:企业环境可能需要多级用户权限设置,以适应不同的团队和角色。 - **SEO优化**:系统应支持良好的搜索引擎优化实践,以便于内容在搜索引擎中的排名和发现。 - **移动适应性**:由于移动设备的广泛使用,系统应具备良好的响应式设计,以提供良好的移动用户体验。 根据描述,该系统似乎是一个成熟的解决方案,适用于需要快速搭建新闻网站的企业用户,但同时也应该注意定期的维护和更新,以确保系统的稳定性和安全性。
recommend-type

【Windows 11用户的福音】:一步到位解决GX Works2安装问题,让兼容性不再是问题!

# 1. GX Works2简介与Windows 11兼容性问题 ## 简介GX Works2 GX Works2是由三菱电机开发的一款针对其PLC(可编程逻辑控制器)产品的编程和调试软件。该软件以其直观的用户界面和强大的编程功能闻名于工业自动化领域,支持从简单的逻辑控制到复杂的系统集成项目。随着Windows操作系统的迭代升级,尤其是新推
recommend-type

电磁加热双边谐振和单边谐振的区别

<think>我们正在处理关于电磁加热技术中双边谐振与单边谐振的工作原理及区别的问题。 首先,需要明确用户意图是了解这两种谐振方式的区别以及它们的工作原理。 我们将通过以下步骤进行: 1. 调用网络搜索工具,检索关于电磁加热中双边谐振和单边谐振的信息。 2. 整合检索到的内容,按照要求生成回答,包括工作原理和区别,并组织成多个方法或步骤(但避免使用步骤词汇,用换行分隔)。 3. 在回答中,如果有公式或代码,按照指定格式处理。 4. 最后,添加相关问题部分。 注意:避免使用第一人称,避免步骤词汇,引用内容不集中末尾,而是融入回答中。 根据搜索,电磁加热中的谐振通常指的是感应加
recommend-type

EnvMan源代码压缩包内容及功能解析

根据给定文件信息,我们需要生成关于“EnvMan-source.zip”这一压缩包的知识点。首先,由于提供的信息有限,我们无法直接得知EnvMan-source.zip的具体内容和功能,但可以通过标题、描述和标签中的信息进行推断。文件名称列表只有一个“EnvMan”,这暗示了压缩包可能包含一个名为EnvMan的软件或项目源代码。以下是一些可能的知识点: ### EnvMan软件/项目概览 EnvMan可能是一个用于环境管理的工具或框架,其源代码被打包并以“EnvMan-source.zip”的形式进行分发。通常,环境管理相关的软件用于构建、配置、管理和维护应用程序的运行时环境,这可能包括各种操作系统、服务器、中间件、数据库等组件的安装、配置和版本控制。 ### 源代码文件说明 由于只有一个名称“EnvMan”出现在文件列表中,我们可以推测这个压缩包可能只包含一个与EnvMan相关的源代码文件夹。源代码文件夹可能包含以下几个部分: - **项目结构**:展示EnvMan项目的基本目录结构,通常包括源代码文件(.c, .cpp, .java等)、头文件(.h, .hpp等)、资源文件(图片、配置文件等)、文档(说明文件、开发者指南等)、构建脚本(Makefile, build.gradle等)。 - **开发文档**:可能包含README文件、开发者指南或者项目wiki,用于说明EnvMan的功能、安装、配置、使用方法以及可能的API说明或开发者贡献指南。 - **版本信息**:在描述中提到了版本号“-1101”,这表明我们所见的源代码包是EnvMan的1101版本。通常版本信息会详细记录在版本控制文件(如ChangeLog或RELEASE_NOTES)中,说明了本次更新包含的新特性、修复的问题、已知的问题等。 ### 压缩包的特点 - **命名规范**:标题、描述和标签中的一致性表明这是一个正式发布的软件包。通常,源代码包的命名会遵循一定的规范,如“项目名称-版本号-类型”,在这里类型是“source”。 - **分发形式**:以.zip格式的压缩包进行分发,是一种常见的软件源代码分发方式。虽然较现代的版本控制系统(如Git、Mercurial)通常支持直接从仓库克隆源代码,但打包成zip文件依然是一种便于存储和传输的手段。 ### 可能的应用场景 - **开发环境配置**:EnvMan可能是用于创建、配置和管理开发环境的工具,这种工具在开发人员设置新的开发机或新的项目环境时非常有用。 - **自动化部署**:EnvMan可能包含自动化部署环境的脚本或命令,使得部署流程变得快捷且高效。 - **监控与维护**:作为环境管理工具,EnvMan可能还支持对环境的监控功能,包括系统资源监控、服务状态检查等,以保证生产环境的稳定性。 ### 总结 尽管以上知识点是基于有限的信息进行的假设性推论,但EnvMan-source.zip包可能是一个用于环境管理的软件或项目的源代码包。该软件或项目可能包含构建和部署自动化环境的能力,以及对运行时环境的监控和维护。文件命名的一致性暗示这是一个正式的版本发布。如果要深入了解EnvMan的功能与用法,建议直接查看压缩包中的文档或源代码注释。同时,考虑到源代码的开发,我们还应该探究该项目所使用的技术栈、编程语言以及版本控制工具等,这将有助于进一步了解EnvMan的技术细节。
recommend-type

【Windows 11终极解决方案】:彻底攻克GX Works2安装中难缠的.Net Framework 3.5障碍!

# 1. Windows 11与GX Works2简介 ## 1.1 Windows 11操作系统概览 Windows 11,作为微软最新的操作系统,不仅仅提供了一种现代的用户体验,而且加强了在企业环境中的安全性与生产力工具。其引入了全新的界面设计、改进的多任务处理以及对Android应用的支持,使它成为IT专业人
recommend-type

贝叶斯gmm

<think>首先,用户的问题是关于贝叶斯高斯混合模型(Bayesian Gaussian Mixture Model, BGMM)的原理和应用。我需要根据系统指令来构建回答。 系统指令包括: - 所有行内数学表达式使用 `$...$` 格式。 - 独立公式使用 `$$...$$` 格式并单独成段。 - LaTeX语法正确。 - 使用中文回答。 - 生成相关问题。 - 在回答中引用的段落末尾自然地添加引用标识,如 `[^1]`。 - 回答结构清晰,帮助用户逐步解决问题。 - 保证回答真实可靠。 参考提供的引用: - 引用[1]:讨论了高斯混合模型在机器学习中的应用,包括其优点和挑战。 -