sim: camera ve bang GPU (lib tuy chon vslam_sim_gl, EGL + GLES3 + assimp) -- anh IR co texture that + depth khop tung pixel, vslam_node --sim-gl, tool vslam_render_preview
This commit is contained in:
51
libs/vslam_sim/include/vslam/sim_camera_renderer.h
Normal file
51
libs/vslam_sim/include/vslam/sim_camera_renderer.h
Normal file
@@ -0,0 +1,51 @@
|
||||
#ifndef VSLAM_SIM_CAMERA_RENDERER_H
|
||||
#define VSLAM_SIM_CAMERA_RENDERER_H
|
||||
|
||||
// Ve anh camera cho bo mo phong.
|
||||
//
|
||||
// Interface nay KHONG phu thuoc do hoa: vslam_sim chi biet no, con cai dat GPU
|
||||
// (EGL + OpenGL ES, texture that cua model) nam o lib TUY CHON vslam_sim_gl.
|
||||
// Nho vay bo mo phong van build va chay tren Jetson / CI khong co GPU -- khi
|
||||
// khong co renderer thi camera mo phong ve depth bang raycast CPU nhu cu va
|
||||
// khong co anh IR.
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace vslam {
|
||||
|
||||
// Tu the va noi suy cua MOT khung anh.
|
||||
//
|
||||
// Frame QUANG HOC theo quy uoc anh (giong RealSense va depth cua sim): +X
|
||||
// phai, +Y xuong, +Z toi truoc. Pixel (u, v) co TAM tai toa do nguyen, kieu
|
||||
// OpenCV: tia qua pixel u di theo ((u - cx) / fx, (v - cy) / fy, 1).
|
||||
struct SimCameraView {
|
||||
// Hang-chinh. Cot j la truc j cua frame quang hoc, viet trong world.
|
||||
double R_wc[9] = {1, 0, 0, 0, 1, 0, 0, 0, 1};
|
||||
double t_wc[3] = {0, 0, 0}; // tam camera trong world, m
|
||||
double fx = 0, fy = 0, cx = 0, cy = 0;
|
||||
int width = 0, height = 0;
|
||||
double near_m = 0.05, far_m = 30.0;
|
||||
};
|
||||
|
||||
class SimCameraRenderer {
|
||||
public:
|
||||
virtual ~SimCameraRenderer() = default;
|
||||
|
||||
// Ve mot khung. `ir`: width*height byte, anh xam, HANG TREN CUNG TRUOC.
|
||||
// `depth_z`: width*height float, Z-DEPTH (hinh chieu len truc quang) theo
|
||||
// met; 0 = tia khong trung gi. Tra false neu khong ve duoc.
|
||||
//
|
||||
// ⚠️ Context GPU gan voi LUONG tao ra no: moi lan goi phai tren CUNG mot
|
||||
// luong (luong vong mo phong).
|
||||
virtual bool Render(const SimCameraView& view, std::vector<uint8_t>* ir,
|
||||
std::vector<float>* depth_z) = 0;
|
||||
|
||||
// Mo ta ngan cho log, vd "NVIDIA GeForce RTX 4060 (EGL, GLES 3.2)".
|
||||
virtual std::string Describe() const = 0;
|
||||
};
|
||||
|
||||
} // namespace vslam
|
||||
|
||||
#endif // VSLAM_SIM_CAMERA_RENDERER_H
|
||||
Reference in New Issue
Block a user