private static SubsamplingMode clampRange(SubsamplingMode value, SubsamplingMode supported) { if ((value & supported) == value) { return(value); } return(SubsamplingMode.Disable); }
public void SetSubsampling(string subsamplingX, string subsamplingY) { SubsamplingMode modeX = (SubsamplingMode)Enum.Parse(typeof(SubsamplingMode), subsamplingX); SubsamplingMode modeY = (SubsamplingMode)Enum.Parse(typeof(SubsamplingMode), subsamplingY); if (IsOpen) { currentSubsamplingX = clampRange(modeX, supportedSubsampling); currentSubsamplingY = clampRange(modeY, supportedSubsampling); camStatus = cam.Size.Subsampling.Set(currentSubsamplingX | currentSubsamplingY); configureOutput(); } }
private void queryFeatures(int instanceId) { if (FProcessor[instanceId].IsOpen) { #region binning/subsampling FOutBinningXModes[instanceId].SliceCount = 0; FOutBinningYModes[instanceId].SliceCount = 0; FOutSubsamplingXModes[instanceId].SliceCount = 0; FOutSubsamplingYModes[instanceId].SliceCount = 0; int numsupported = Enum.GetValues(typeof(BinningXMode)).Length; // it's the same for all 4 enums Array bxModes = Enum.GetValues(typeof(BinningXMode)); Array byModes = Enum.GetValues(typeof(BinningYMode)); Array sxModes = Enum.GetValues(typeof(SubsamplingXMode)); Array syModes = Enum.GetValues(typeof(SubsamplingYMode)); for (int i = 0; i < numsupported; i++) { BinningXMode bx = (BinningXMode)bxModes.GetValue(i); BinningMode bmodeX = (BinningMode)Enum.Parse(typeof(BinningMode), bx.ToString()); if ((bmodeX & FProcessor[instanceId].supportedBinning) == bmodeX) { FOutBinningXModes[instanceId].Add <string>(bmodeX.ToString()); } BinningYMode by = (BinningYMode)byModes.GetValue(i); BinningMode bmodeY = (BinningMode)Enum.Parse(typeof(BinningMode), by.ToString()); if ((bmodeY & FProcessor[instanceId].supportedBinning) == bmodeY) { FOutBinningYModes[instanceId].Add <string>(bmodeY.ToString()); } SubsamplingXMode sx = (SubsamplingXMode)sxModes.GetValue(i); SubsamplingMode smodeX = (SubsamplingMode)Enum.Parse(typeof(SubsamplingMode), sx.ToString()); if ((smodeX & FProcessor[instanceId].supportedSubsampling) == smodeX) { FOutSubsamplingXModes[instanceId].Add <string>(smodeX.ToString()); } SubsamplingYMode sy = (SubsamplingYMode)syModes.GetValue(i); SubsamplingMode smodeY = (SubsamplingMode)Enum.Parse(typeof(SubsamplingMode), sy.ToString()); if ((smodeY & FProcessor[instanceId].supportedSubsampling) == smodeY) { FOutSubsamplingYModes[instanceId].Add <string>(smodeY.ToString()); } } #endregion binning/subsampling FOutgainAutoSupported[instanceId] = FProcessor[instanceId].gainAutoSupported; FOutgainBoostSupported[instanceId] = FProcessor[instanceId].gainBoostSupported; FOutWhitebalance[instanceId] = FProcessor[instanceId].whitebalanceSupported; queryRequest = false; } }