Skip to content

Commit

Permalink
[fix]: k4aviewer adapt to mega-i resolution display
Browse files Browse the repository at this point in the history
  • Loading branch information
daiyin committed Aug 9, 2024
1 parent 45b992f commit 9d57613
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions tools/k4aviewer/k4adevicedockcontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@

using namespace k4aviewer;

#define ORBBEC_MEGA_PID 0x0669
#define ORBBEC_BOLT_PID 0x066B
#define ORBBEC_MEGA_I_PID 0x06C0

namespace
{
constexpr std::chrono::milliseconds CameraPollingTimeout(3000);
Expand Down Expand Up @@ -442,6 +446,12 @@ K4ADockControlStatus K4ADeviceDockControl::Show()
bool colorResolutionUpdated = colorEnableStateChanged;
if (ImGui::TreeNode("Color Configuration"))
{
bool isMegaI = false;
int pid = m_device.get_pid();
if(pid == ORBBEC_MEGA_I_PID){
isMegaI = true;
}

const bool colorSettingsEditable = !deviceIsStarted && m_config.EnableColorCamera;

bool colorFormatUpdated = false;
Expand All @@ -455,10 +465,10 @@ K4ADockControlStatus K4ADeviceDockControl::Show()
ImGui::SameLine();
colorFormatUpdated |=
ImGuiExtensions::K4ARadioButton("NV12", pColorFormat, K4A_IMAGE_FORMAT_COLOR_NV12,
colorSettingsEditable);
colorSettingsEditable && !isMegaI);
ImGui::SameLine();
colorFormatUpdated |=
ImGuiExtensions::K4ARadioButton("YUY2", pColorFormat, K4A_IMAGE_FORMAT_COLOR_YUY2, colorSettingsEditable);
ImGuiExtensions::K4ARadioButton("YUY2", pColorFormat, K4A_IMAGE_FORMAT_COLOR_YUY2, colorSettingsEditable && !isMegaI);

// Uncompressed formats are only supported at 720p.
//
Expand Down Expand Up @@ -498,14 +508,14 @@ K4ADockControlStatus K4ADeviceDockControl::Show()
pColorResolution,
K4A_COLOR_RESOLUTION_1440P,
colorSettingsEditable &&
imageFormatSupportsHighResolution&&!(m_config.ColorFormat == K4A_IMAGE_FORMAT_COLOR_YUY2));
imageFormatSupportsHighResolution&&!(m_config.ColorFormat == K4A_IMAGE_FORMAT_COLOR_YUY2) &&!isMegaI);
ImGuiExtensions::K4AShowTooltip(imageFormatHelpMessage, !imageFormatSupportsHighResolution);
ImGui::SameLine();
colorResolutionUpdated |= ImGuiExtensions::K4ARadioButton("2160p",
pColorResolution,
K4A_COLOR_RESOLUTION_2160P,
colorSettingsEditable &&
imageFormatSupportsHighResolution&&!(m_config.ColorFormat == K4A_IMAGE_FORMAT_COLOR_YUY2));
imageFormatSupportsHighResolution&&!(m_config.ColorFormat == K4A_IMAGE_FORMAT_COLOR_YUY2) &&!isMegaI);
ImGuiExtensions::K4AShowTooltip(imageFormatHelpMessage, !imageFormatSupportsHighResolution);
ImGui::Unindent();
ImGui::Text("4:3");
Expand Down

0 comments on commit 9d57613

Please sign in to comment.