Files
kinect/tracker-native/src/win_camera.h
T
kinect-bot b30deb7cc5
ci / Linux C++ core (cmake + ctest) (push) Canceled after 0s
ci / Python root tests (pytest, no tracker deps) (push) Canceled after 0s
ci / Python tracker (pytest, tracker/.venv) (push) Canceled after 0s
fix(tracker-native): stride-aware RGB32 capture (handle bottom-up + padding)
Media Foundation commonly delivers RGB32 bottom-up (negative MF_MT_DEFAULT_STRIDE);
a flat top-down memcpy would make the preview and published feed upside-down.
read_frame now copies row by row honoring the signed stride (flip when negative,
handle padded strides), producing a top-down BGRA frame per the MS Image Stride
spec. Orientation is logged at open.
2026-11-25 19:14:07 -05:00

45 lines
886 B
C++

#ifndef TRACKER_NATIVE_WIN_CAMERA_H
#define TRACKER_NATIVE_WIN_CAMERA_H
#include <cstdint>
#include <string>
#include <vector>
namespace kinect_tracker {
struct CameraDevice {
std::wstring symbolic_link;
std::string name;
};
struct CameraResolution {
int width;
int height;
};
std::vector<CameraDevice> enumerate_cameras();
std::vector<CameraResolution> enumerate_resolutions(const std::wstring& symbolic_link);
class Camera {
public:
Camera() = default;
~Camera();
Camera(const Camera&) = delete;
Camera& operator=(const Camera&) = delete;
bool open(const std::wstring& symbolic_link, int width, int height);
bool read_frame(std::vector<uint8_t>& bgra, int& width, int& height);
void close();
bool is_open() const { return reader_ != nullptr; }
private:
void* reader_ = nullptr;
int width_ = 0;
int height_ = 0;
int stride_ = 0;
};
}
#endif