#include <astra/astra.hpp>
#include <cstdio>
#include <iostream>
#include <key_handler.h>
{
private:
using buffer_ptr = std::unique_ptr<astra::RgbPixel []>;
buffer_ptr buffer_;
unsigned int lastWidth_;
unsigned int lastHeight_;
public:
{
{
print_color(colorFrame);
}
}
{
{
int width = colorFrame.
width();
int height = colorFrame.
height();
if (width != lastWidth_ || height != lastHeight_){
lastWidth_ = width;
lastHeight_ = height;
}
size_t index = ((width * (height / 2.0f)) + (width / 2.0f));
std::cout << "color frameIndex: " << frameIndex
<<
" r: " <<
static_cast<int>(middle.
r)
<<
" g: " <<
static_cast<int>(middle.
g)
<<
" b: " <<
static_cast<int>(middle.
b)
<< std::endl;
}
}
};
int main(int argc, char** argv)
{
set_key_handler();
SampleFrameListener listener;
std::cout << "colorStream -- hFov: "
<< " vFov: "
<< std::endl;
do
{
astra_update();
} while (shouldContinue);
}
color frame of rgb format
Definition: Color.hpp:60
A color stream
Definition: Color.hpp:39
Frame class
Definition: Frame.hpp:32
Frame Listener class
Definition: FrameListener.hpp:31
const int height() const
get height
Definition: Image.hpp:444
void copy_to(TDataType *buffer) const
copy to buffer
Definition: Image.hpp:507
const astra_frame_index_t frame_index() const
get frame index
Definition: Image.hpp:465
const size_t length() const
get length
Definition: Image.hpp:500
const int width() const
get width
Definition: Image.hpp:437
const bool is_valid() const
get is vaild
Definition: Image.hpp:430
Stream Reader class
Definition: StreamReader.hpp:39
void add_listener(FrameListener &listener)
add listener
Definition: StreamReader.hpp:87
void remove_listener(FrameListener &listener)
remove listener
Definition: StreamReader.hpp:101
Stream Set Class
Definition: StreamSet.hpp:36
astra_status_t terminate()
Terminate the library, destroying all its streams.
Definition: astra_core.hpp:45
astra_status_t initialize()
Initializes the library.
Definition: astra_core.hpp:35
rgb pixel struct
Definition: Image.hpp:40