跳至內容
測試伺服器
開發伺服器

Center X and Center Y (dart E)#

透過 Center X and Center Y camera feature,您可以將 image ROI 在水平方向、垂直方向或同時置中。

使用此功能#

使用 Center X#

若要將影像水平置中,請執行 BslCenterX 命令。

相機會調整 OffsetX 參數值,以便將 影像 ROI 水平置中。這是一次性操作。當您變更 影像 ROI的寬度時,必須重新執行該命令。

使用 Center Y#

若要將影像垂直置中,請執行 BslCenterY 命令。

相機會調整 OffsetY 參數值,以便將 影像 ROI 垂直置中。這是一次性操作。當您變更 影像 ROI的寬度時,必須重新執行該命令。

範例程式碼#

// Center the image ROI
camera.BslCenterX.Execute();
camera.BslCenterY.Execute();
INodeMap& nodemap = camera.GetNodeMap();
// Center the image ROI
CCommandParameter(nodemap, "BslCenterX").Execute();
CCommandParameter(nodemap, "BslCenterY").Execute();
// Center the image ROI
camera.Parameters[PLCamera.BslCenterX].Execute();
camera.Parameters[PLCamera.BslCenterY].Execute();
/* Macro to check for errors */
#define CHECK(errc) if (GENAPI_E_OK != errc) printErrorAndExit(errc)
GENAPIC_RESULT errRes = GENAPI_E_OK;  /* Return value of pylon methods */
/* Center the image ROI */
errRes = PylonDeviceExecuteCommandFeature(hdev, "BslCenterX");
CHECK(errRes);
errRes = PylonDeviceExecuteCommandFeature(hdev, "BslCenterY");
CHECK(errRes);
# Center the image ROI
camera.BslCenterX.Execute()
camera.BslCenterY.Execute()
/* Macro to check for errors */
#define CHECK(errc) if (GENAPI_E_OK != errc) printErrorAndExit(errc)
GENAPIC_RESULT errRes = GENAPI_E_OK;  /* Return value of pylon methods */
/* Center the image ROI */
errRes = PylonDeviceExecuteCommandFeature(hdev, "BslCenterX");
CHECK(errRes);
errRes = PylonDeviceExecuteCommandFeature(hdev, "BslCenterY");
CHECK(errRes);

您也可以使用 pylon Viewer 輕鬆設定參數。