本文整理汇总了C++中IFrameDescription::get_DiagonalFieldOfView方法的典型用法代码示例。如果您正苦于以下问题:C++ IFrameDescription::get_DiagonalFieldOfView方法的具体用法?C++ IFrameDescription::get_DiagonalFieldOfView怎么用?C++ IFrameDescription::get_DiagonalFieldOfView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFrameDescription
的用法示例。
在下文中一共展示了IFrameDescription::get_DiagonalFieldOfView方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
//----------
void Color::update(IColorFrame * frame) {
this->isFrameNewFlag = true;
IFrameDescription * frameDescription = NULL;
try {
//allocate pixels and texture if we need to
if (FAILED(frame->get_FrameDescription(&frameDescription))) {
throw Exception("Failed to get frame description");
}
int width, height;
if (FAILED(frameDescription->get_Width(&width)) || FAILED(frameDescription->get_Height(&height))) {
throw Exception("Failed to get width and height of frame");
}
if (width != this->pixels.getWidth() || height != this->texture.getHeight()) {
this->pixels.allocate(width, height, OF_IMAGE_COLOR_ALPHA);
this->texture.allocate(this->pixels);
}
//update local rgba image
if (FAILED(frame->CopyConvertedFrameDataToArray(this->pixels.size(), this->pixels.getPixels(), ColorImageFormat_Rgba))) {
throw Exception("Couldn't pull pixel buffer");
}
if (this->useTexture) {
this->texture.loadData(this->pixels);
}
//update yuv
if (this->yuvPixelsEnabled) {
if (width != this->yuvPixels.getWidth() || height != this->yuvPixels.getHeight()) {
this->yuvPixels.allocate(width, height, OF_PIXELS_YUY2);
}
if (FAILED(frame->CopyRawFrameDataToArray(this->yuvPixels.size(), this->yuvPixels.getPixels()))) {
throw Exception("Couldn't pull raw YUV pixel buffer");
}
}
//update field of view
if (FAILED(frameDescription->get_HorizontalFieldOfView(&this->horizontalFieldOfView))) {
throw Exception("Failed to get horizonal field of view");
}
if (FAILED(frameDescription->get_VerticalFieldOfView(&this->verticalFieldOfView))) {
throw Exception("Failed to get vertical field of view");
}
if (FAILED(frameDescription->get_DiagonalFieldOfView(&this->diagonalFieldOfView))) {
throw Exception("Failed to get diagonal field of view");
}
IColorCameraSettings * cameraSettings;
if (FAILED(frame->get_ColorCameraSettings(&cameraSettings))) {
throw Exception("Failed to get color camera settings");
}
cameraSettings->get_ExposureTime(&this->exposure);
cameraSettings->get_FrameInterval(&this->frameInterval);
cameraSettings->get_Gain(&this->gain);
cameraSettings->get_Gamma(&this->gamma);
} catch (std::exception & e) {
OFXKINECTFORWINDOWS2_ERROR << e.what();
}
SafeRelease(frameDescription);
}
示例2: update
//----------
void Color::update() {
CHECK_OPEN
IColorFrame * frame = NULL;
IFrameDescription * frameDescription = NULL;
try {
//acquire frame
if (FAILED(this->reader->AcquireLatestFrame(&frame))) {
return; // we often throw here when no new frame is available
}
//allocate pixels and texture if we need to
if (FAILED(frame->get_FrameDescription(&frameDescription))) {
throw Exception("Failed to get frame description");
}
int width, height;
if (FAILED(frameDescription->get_Width(&width)) || FAILED(frameDescription->get_Height(&height))) {
throw Exception("Failed to get width and height of frame");
}
if (width != this->pixels.getWidth() || height != this->texture.getHeight()) {
this->pixels.allocate(width, height, OF_IMAGE_COLOR_ALPHA);
this->texture.allocate(this->pixels);
}
//update local assets
if (FAILED(frame->CopyConvertedFrameDataToArray(this->pixels.size(), this->pixels.getPixels(), ColorImageFormat_Rgba))) {
throw Exception("Couldn't pull pixel buffer");
}
if (this->useTexture) {
this->texture.loadData(this->pixels);
}
//update field of view
if (FAILED(frameDescription->get_HorizontalFieldOfView(&this->horizontalFieldOfView))) {
throw Exception("Failed to get horizonal field of view");
}
if (FAILED(frameDescription->get_VerticalFieldOfView(&this->verticalFieldOfView))) {
throw Exception("Failed to get vertical field of view");
}
if (FAILED(frameDescription->get_DiagonalFieldOfView(&this->diagonalFieldOfView))) {
throw Exception("Failed to get diagonal field of view");
}
IColorCameraSettings * cameraSettings;
if (FAILED(frame->get_ColorCameraSettings(&cameraSettings))) {
throw Exception("Failed to get color camera settings");
}
cameraSettings->get_ExposureTime(&this->exposure);
cameraSettings->get_FrameInterval(&this->frameInterval);
cameraSettings->get_Gain(&this->gain);
cameraSettings->get_Gamma(&this->gamma);
} catch (std::exception & e) {
OFXKINECTFORWINDOWS2_ERROR << e.what();
}
SafeRelease(frameDescription);
SafeRelease(frame);
}
示例3: readFrame
bool BodyIndexStream::readFrame(IMultiSourceFrame *multiFrame)
{
bool isSuccess = false;
if (!m_StreamHandle.depthFrameReader) {
ofLogWarning("ofxKinect2::BodyIndexStream") << "Stream is not open.";
return isSuccess;
}
Stream::readFrame(multiFrame);
IBodyIndexFrame *bodyIndexFrame = nullptr;
HRESULT hr = E_FAIL;
if (!multiFrame) {
hr = m_StreamHandle.bodyIndexFrameReader->AcquireLatestFrame(&bodyIndexFrame);
}
else {
IBodyIndexFrameReference *frameReference = nullptr;
hr = multiFrame->get_BodyIndexFrameReference(&frameReference);
if (SUCCEEDED(hr)) {
hr = frameReference->AcquireFrame(&bodyIndexFrame);
}
safeRelease(frameReference);
}
if (SUCCEEDED(hr)) {
IFrameDescription *frameDescription = nullptr;
hr = bodyIndexFrame->get_RelativeTime((INT64 *)&m_Frame.timestamp);
if (SUCCEEDED(hr)) {
hr = bodyIndexFrame->get_FrameDescription(&frameDescription);
}
if (SUCCEEDED(hr)) {
hr = frameDescription->get_Width(&m_Frame.width);
}
if (SUCCEEDED(hr)) {
hr = frameDescription->get_Height(&m_Frame.height);
}
if (SUCCEEDED(hr)) {
hr = frameDescription->get_HorizontalFieldOfView(&m_Frame.horizontalFieldOfView);
}
if (SUCCEEDED(hr)) {
hr = frameDescription->get_VerticalFieldOfView(&m_Frame.verticalFieldOfView);
}
if (SUCCEEDED(hr)) {
hr = frameDescription->get_DiagonalFieldOfView(&m_Frame.diagonalFieldOfView);
}
if (SUCCEEDED(hr)) {
hr = bodyIndexFrame->AccessUnderlyingBuffer((UINT *)&m_Frame.dataSize, reinterpret_cast<BYTE **>(&m_Frame.data));
}
if (SUCCEEDED(hr)) {
isSuccess = true;
setPixels(m_Frame);
}
safeRelease(frameDescription);
}
safeRelease(bodyIndexFrame);
return isSuccess;
}
示例4: update
//.........这里部分代码省略.........
}
if ( mDeviceOptions.isBodyIndexEnabled() ) {
if ( SUCCEEDED( hr ) ) {
hr = bodyIndexFrame->get_RelativeTime( &bodyIndexTime );
}
if ( SUCCEEDED( hr ) ) {
hr = bodyIndexFrame->get_FrameDescription( &bodyIndexFrameDescription );
}
if ( SUCCEEDED( hr ) ) {
hr = bodyIndexFrameDescription->get_Width( &bodyIndexWidth );
}
if ( SUCCEEDED( hr ) ) {
hr = bodyIndexFrameDescription->get_Height( &bodyIndexHeight );
}
if ( SUCCEEDED( hr ) ) {
hr = bodyIndexFrame->AccessUnderlyingBuffer( &bodyIndexBufferSize, &bodyIndexBuffer );
}
if ( SUCCEEDED( hr ) ) {
bodyIndexChannel = Channel8u( bodyIndexWidth, bodyIndexHeight );
memcpy( bodyIndexChannel.getData(), bodyIndexBuffer, bodyIndexWidth * bodyIndexHeight * sizeof( uint8_t ) );
}
}
if ( mDeviceOptions.isColorEnabled() ) {
if ( SUCCEEDED( hr ) ) {
hr = colorFrame->get_FrameDescription( &colorFrameDescription );
if ( SUCCEEDED( hr ) ) {
float vFov = 0.0f;
float hFov = 0.0f;
float dFov = 0.0f;
colorFrameDescription->get_VerticalFieldOfView( &vFov );
colorFrameDescription->get_HorizontalFieldOfView( &hFov );
colorFrameDescription->get_DiagonalFieldOfView( &dFov );
}
}
if ( SUCCEEDED( hr ) ) {
hr = colorFrameDescription->get_Width( &colorWidth );
}
if ( SUCCEEDED( hr ) ) {
hr = colorFrameDescription->get_Height( &colorHeight );
}
if ( SUCCEEDED( hr ) ) {
hr = colorFrame->get_RawColorImageFormat( &colorImageFormat );
}
if ( SUCCEEDED( hr ) ) {
colorBufferSize = colorWidth * colorHeight * sizeof( uint8_t ) * 4;
colorBuffer = new uint8_t[ colorBufferSize ];
hr = colorFrame->CopyConvertedFrameDataToArray( colorBufferSize, reinterpret_cast<uint8_t*>( colorBuffer ), ColorImageFormat_Rgba );
if ( SUCCEEDED( hr ) ) {
colorSurface = Surface8u( colorWidth, colorHeight, false, SurfaceChannelOrder::RGBA );
memcpy( colorSurface.getData(), colorBuffer, colorWidth * colorHeight * sizeof( uint8_t ) * 4 );
}
delete [] colorBuffer;
colorBuffer = 0;
}
}
if ( mDeviceOptions.isDepthEnabled() ) {
if ( SUCCEEDED( hr ) ) {
hr = depthFrame->get_FrameDescription( &depthFrameDescription );
}
if ( SUCCEEDED( hr ) ) {
hr = depthFrameDescription->get_Width( &depthWidth );