Example #1
0
 /// <summary>
 /// Create AKAZE using the specific values
 /// </summary>
 /// <param name="descriptorType">Type of the extracted descriptor</param>
 /// <param name="descriptorSize">Size of the descriptor in bits. 0 -> Full size</param>
 /// <param name="descriptorChannels">Number of channels in the descriptor (1, 2, 3)</param>
 /// <param name="threshold">Detector response threshold to accept point</param>
 /// <param name="nOctaveLayers"> Default number of sublevels per scale level</param>
 /// <param name="nOctaves">Maximum octave evolution of the image</param>
 /// <param name="diffusivity">Diffusivity type</param>
 public AKAZE(DescriptorType descriptorType = DescriptorType.Mldb, int descriptorSize = 0, int descriptorChannels = 3,
    float threshold = 0.001f, int nOctaves = 4, int nOctaveLayers = 4, KAZE.Diffusivity diffusivity = KAZE.Diffusivity.PmG2)
 {
    _ptr = CvInvoke.cveAKAZEDetectorCreate(
       descriptorType, descriptorSize, descriptorChannels, 
       threshold, nOctaves, nOctaveLayers, diffusivity,
       ref _feature2D);
 }
 public HighlightDescriptor(string token, string closeToken, Color color, Font font, DescriptorType descriptorType, DescriptorRecognition dr, bool useForAutoComplete)
 {
     Color = color;
     Font = font;
     Token = token;
     DescriptorType = descriptorType;
     CloseToken = closeToken;
     DescriptorRecognition = dr;
     UseForAutoComplete = useForAutoComplete;
 }
 public HighlightDescriptor(string token, Color color, Font font, DescriptorType descriptorType, DescriptorRecognition dr)
 {
     if (descriptorType == DescriptorType.ToCloseToken)
     {
         throw new ArgumentException("You may not choose ToCloseToken DescriptorType without specifing an end token.");
     }
     Color = color;
     Font = font;
     Token = token;
     DescriptorType = descriptorType;
     DescriptorRecognition = dr;
     CloseToken = null;
 }
 public void OnGUI()
 {
     EditorGUILayout.BeginHorizontal();
     {
         foreach (DescriptorType t in Enum.GetValues(typeof(DescriptorType))) {
             if (GUILayout.Button("Show " + t.ToString() + " Operators")) {
                 this.displayedOperators = t;
             }
         }
     }
     EditorGUILayout.EndHorizontal();
     ShowOptions();
 }
 public HighlightDescriptor(string token, Color color, Font font, DescriptorType descriptorType, DescriptorRecognition dr, bool useForAutoComplete)
 {
     if (descriptorType ==  UseCaseMakerControls.DescriptorType.ToCloseToken)
     {
         throw new ArgumentException("You may not choose ToCloseToken DescriptorType without specifing an end token.");
     }
     Color = color;
     Font = font;
     Token = token;
     DescriptorType = descriptorType;
     DescriptorRecognition = dr;
     CloseToken = null;
     UseForAutoComplete = useForAutoComplete;
 }
Example #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Descriptor"/> class.
        /// </summary>
        /// <param name="objectName">The object name of the contents of the new descriptor.</param>
        /// <param name="descriptorType">The type of the new descriptor.</param>
        /// <param name="name">The name of the new descriptor.</param>
        public Descriptor(string objectName, DescriptorType descriptorType, string name)
        {
            if (string.IsNullOrEmpty(objectName))
            {
                throw new ArgumentNullException("objectName");
            }

            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }

            this.objectName = objectName;
            this.descriptorType = descriptorType;
            this.name = name;
        }
        /// <summary>
        /// Hello
        /// </summary>
        /// <param name="operatorName">Display name of operator</param>
        /// <param name="type">The descriptor type, or operator type</param>
        /// <param name="acceptChildren">Does the described model use children? -1 says infinite, 0 = 0 etc etc</param>
        /// <param name="executorType">The ExecutionTask type on which to look for data fields</param>
        public ModelDataDescriptorAttribute(string operatorName, DescriptorType type, int numChildren, Type executorType)
        {
            this.operatorName = operatorName;
            this.descriptorType = type;
            this.numChildren = numChildren;
            // because we cannot pass nested attributes in c#, we'll just reflect the stuff to get hold of relevant context information.
            // Maybe it's for the better, I don't know ...
            var contextRelevantFields = executorType.FieldsWith(Flags.InstanceAnyVisibility, typeof(FieldDefinitionAttribute));
            var knownNames = new List<string>(contextRelevantFields.Count);

            this.dataContextDescription = new Dictionary<string, FieldDefinitionAttribute>(contextRelevantFields.Count);

            for (int i = 0; i < contextRelevantFields.Count; ++i) {
                var attr = contextRelevantFields[i].Attribute<FieldDefinitionAttribute>();
                if (knownNames.Contains(attr.DisplayName)) {
                    throw new ModelDataDescriptorException(string.Format(
                        "Execution Task for operator {0} has at least one double field label defined: {1} mapping to field {2}",
                        operatorName, attr.DisplayName, contextRelevantFields[i].Name));
                }
                dataContextDescription.Add(contextRelevantFields[i].Name, attr);
                knownNames.Add(attr.DisplayName);
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="HighlightDescriptor"/> class.
 /// </summary>
 /// <param name="token">The token.</param>
 /// <param name="closeToken">The close token.</param>
 /// <param name="descriptorType">Type of the descriptor.</param>
 /// <param name="dr">The dr.</param>
 /// <param name="color">The color.</param>
 /// <param name="font">The font.</param>
 /// <param name="useForAutoComplete">if set to <c>true</c> [use for auto complete].</param>
 public HighlightDescriptor(string token, string closeToken, DescriptorType descriptorType, DescriptorRecognition dr, Color color, Font font, bool useForAutoComplete)
 {
     if (dr == DescriptorRecognition.RegEx)
     {
         throw new ArgumentException("You may not choose RegEx DescriptorType with an end token.");
     }
     Color = color;
     Font = font;
     Token = token;
     DescriptorType = descriptorType;
     CloseToken = closeToken;
     DescriptorRecognition = dr;
     UseForAutoComplete = useForAutoComplete;
 }
 /// <summary>
 /// For DescriptorProccessModes.ProcsessLineForDescriptor use this constructor
 /// </summary>
 /// <param name="token"></param>
 /// <param name="tokenLeftCondition"></param>
 /// <param name="tokenRightCondition"></param>
 /// <param name="color"></param>
 /// <param name="font"></param>
 public HighlightDescriptor(string token, string tokenLeftCondition, string tokenRightCondition, Color color, Font font)
 {
     Color = color;
     Font = font;
     Token = token;
     TokenLeftCondition = tokenLeftCondition;
     TokenRightCondition = tokenRightCondition;
     // default values, not in use for DescriptorProccessModes.ProcsessLineForDescriptor
     DescriptorType = DescriptorType.Word;
     DescriptorRecognition = DescriptorRecognition.Contains;
     CloseToken = null;
 }
Example #10
0
 public static SetupPacket MakeGetDescriptor(RequestInternalType type, RequestRecipient recipient, DescriptorType descriptorType, ushort index, ushort size, ushort otherIndex = 0)
 {
     return(new SetupPacket()
     {
         bmRequestType = new RequestType(RequestDirection.DeviceToHost, type, recipient),
         bRequest = (byte)StandardRequestCode.GetDescriptor,
         wValue = descriptorType.WithIndex(index),
         wIndex = otherIndex,
         wLength = size
     });
 }
 public HighlightDescriptor(string token, string closeToken, Color color, Font font, DescriptorType descriptorType, DescriptorRecognition dr)
 {
     Color = color;
     Font = font;
     Token = token;
     DescriptorType = descriptorType;
     CloseToken = closeToken;
     DescriptorRecognition = dr;
 }
Example #12
0
 protected Descriptor(
     DescriptorType descriptorType,
     Type type,
     string header,
     GetGolumnsDelegate getColumns,
     CreateEditorDelegate createEditor,
     DocumentTypeEnum? documentType = null,
     RefBookTypeEnum? refBookType = null,
     ReportTypeEnum? reportType = null)
 {
     this.descriptorType = descriptorType;
     this.type = type;
     this.header = header;
     this.getColumns = getColumns;
     this.createEditor = createEditor;
     if (documentType.HasValue)
     {
         this.documentType = documentType.Value;
     }
     if (refBookType.HasValue)
     {
         this.refBookType = refBookType.Value;
     }
     if (reportType.HasValue)
     {
         this.reportType = reportType.Value;
     }
 }
Example #13
0
        private static CompositeFilterDescriptor ConvertDescriptor(CompositeFilterDescriptor compositeFilter, DescriptorType type)
        {
            if (compositeFilter == null)
            {
                throw new ArgumentNullException("compositeFilter");
            }

            if (type == DescriptorType.Unknown)
            {
                throw new InvalidOperationException("You cannot convert the filter descriptor to unknown type.");
            }

            CompositeFilterDescriptor result = compositeFilter.Clone() as CompositeFilterDescriptor;

            while (result.FilterDescriptors.Count > 2)
            {
                int lastIndex = result.FilterDescriptors.Count - 1;
                result.FilterDescriptors.RemoveAt(lastIndex);
            }

            while (result.FilterDescriptors.Count < 2)
            {
                result.FilterDescriptors.Add(new FilterDescriptor());
            }

            if (type == DescriptorType.Between || type == DescriptorType.NotBetween)
            {
                result.LogicalOperator = FilterLogicalOperator.And;

                FilterDescriptor firstFilterDescriptor = result.FilterDescriptors[0];
                firstFilterDescriptor.PropertyName = result.PropertyName;
                firstFilterDescriptor.Operator     = FilterOperator.IsGreaterThanOrEqualTo;

                FilterDescriptor secondFilterDescriptor = result.FilterDescriptors[1];
                secondFilterDescriptor.PropertyName = result.PropertyName;
                secondFilterDescriptor.Operator     = FilterOperator.IsLessThanOrEqualTo;

                result.NotOperator = type == DescriptorType.NotBetween;
            }

            return(result);
        }
Example #14
0
        /// <summary>
        /// Write the contents of a descriptor set object.
        /// </summary>
        /// <param name="destinationSet">
        /// The destination descriptor set to update.
        /// </param>
        /// <param name="destinationBinding">
        /// The descriptor binding within the set.
        /// </param>
        /// <param name="destinationArrayElement">
        /// The starting element in the binding array.
        /// </param>
        /// <param name="descriptorType">
        /// A DescriptorType specifying the type of each descriptor in
        /// texelBufferViews.
        /// It must be the same type as that specified in
        /// DescriptorSetLayoutBinding for destinationSet at
        /// destinationBinding. The type of the descriptor also controls which
        /// array the descriptors are taken from.
        /// </param>
        /// <param name="texelBufferViews">
        /// An array of BufferViews.
        /// </param>
        public unsafe void WriteDescriptorSet(DescriptorSet destinationSet, uint destinationBinding, uint destinationArrayElement, DescriptorType descriptorType, ArrayProxy <BufferView>?texelBufferViews)
        {
            int bufferInfosLength = texelBufferViews?.Length ?? 0;
            var marshalledViews   = (Interop.BufferView *)Interop.HeapUtil.Allocate <Interop.BufferView>(bufferInfosLength);

            for (int index = 0; index < bufferInfosLength; index++)
            {
                marshalledViews[index] = texelBufferViews.Value[index].handle;
            }

            Interop.WriteDescriptorSet info = new Interop.WriteDescriptorSet
            {
                SType                   = StructureType.WriteDescriptorSet,
                TexelBufferView         = marshalledViews,
                DestinationSet          = destinationSet.handle,
                DestinationBinding      = destinationBinding,
                DestinationArrayElement = destinationArrayElement,
                DescriptorCount         = (uint)bufferInfosLength,
                DescriptorType          = descriptorType
            };

            var commandDelegate = commandCache.GetCommandDelegate <Interop.VkDeviceUpdateDescriptorSetsDelegate>("vkUpdateDescriptorSets", "");

            commandDelegate(this.handle, 1, &info, 0, null);
        }
Example #15
0
 public static Error libusb_get_string_descriptor(IntPtr deviceHandle, DescriptorType type, byte index, ushort languageID, byte[] data, ushort wLength)
 {
     return libusb_get_descriptor_core(deviceHandle,
                                       DescriptorType.String, index,
                                       data, wLength, languageID);
 }
Example #16
0
        public byte[] GetDescriptor(DescriptorType descriptorType, byte descriptorIndex, ushort length = 1024)
        {
            UInt16 value = (UInt16)(descriptorIndex | ((byte)descriptorType) << 8);

            return(ControlTransferIn(ControlTypeStandard | ControlRecipientDevice, (byte)UsbStandardRequestCode.GetDescriptor, value, 0, length));
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="buffer"></param>
        /// <param name="offset"></param>
        /// <param name="size"></param>
        public CapacityDescriptor(IntPtr buffer, int offset, int size)
            : base(buffer, size)
        {
            byte b;

            NumberOfBlocks = Get32(offset);

            b = Get8(offset + 4);
            DescType = (DescriptorType)(b & 0x03);
            FormatType = (byte)(b >> 2);

            BlockLength = Get24(offset + 5);
        }
 public void SetupDescriptor(string txt, string tooltip, DescriptorType descriptorType = DescriptorType.Effect)
 {
     text        = txt;
     tooltipText = tooltip;
     type        = descriptorType;
 }
Example #19
0
 public static ushort WithIndex(this DescriptorType descriptorType, int index) =>
 (ushort)(((ushort)descriptorType << 8) | index);
Example #20
0
 public HighlightDescriptor(string token, string closeToken, Color color, Font font, DescriptorType descriptorType, DescriptorRecognition dr, bool useForAutoComplete)
 {
     Color                 = color;
     Font                  = font;
     Token                 = token;
     DescriptorType        = descriptorType;
     CloseToken            = closeToken;
     DescriptorRecognition = dr;
     UseForAutoComplete    = useForAutoComplete;
 }
 /// <summary>
 /// Adds the highlight descriptor.
 /// </summary>
 /// <param name="dr">The dr.</param>
 /// <param name="token">The token.</param>
 /// <param name="descriptorType">Type of the descriptor.</param>
 /// <param name="closeToken">The close token.</param>
 /// <param name="color">The color.</param>
 /// <param name="font">The font.</param>
 /// <param name="useForAutoComplete">if set to <c>true</c> [use for auto complete].</param>
 public void AddHighlightDescriptor(DescriptorRecognition dr, string token, DescriptorType descriptorType, string closeToken, Color color, Font font, bool useForAutoComplete)
 {
     this.HighlightDescriptors.Add(new HighlightDescriptor(token, closeToken, descriptorType, dr, color, font, useForAutoComplete));
 }
 public BaseVolumeDescriptor(byte[] b)
 {
     VolumeDescriptorType = (DescriptorType)b[0];
     StandardIdentifier   = Encoding.ASCII.GetString(b, 1, 5).Trim();
     Version = b[6];
 }
Example #23
0
        /// <summary>
        /// Write the contents of a descriptor set object.
        /// </summary>
        /// <param name="destinationSet">
        /// The destination descriptor set to update.
        /// </param>
        /// <param name="destinationBinding">
        /// The descriptor binding within the set.
        /// </param>
        /// <param name="destinationArrayElement">
        /// The starting element in the binding array.
        /// </param>
        /// <param name="descriptorType">
        /// A DescriptorType specifying the type of each descriptor in
        /// imageInfos.
        /// It must be the same type as that specified in
        /// DescriptorSetLayoutBinding for destinationSet at
        /// destinationBinding. The type of the descriptor also controls which
        /// array the descriptors are taken from.
        /// </param>
        /// <param name="imageInfos">
        /// An array of DescriptorImageInfo structures.
        /// </param>
        public unsafe void WriteDescriptorSet(DescriptorSet destinationSet, uint destinationBinding, uint destinationArrayElement, DescriptorType descriptorType, ArrayProxy <DescriptorImageInfo>?imageInfos)
        {
            int bufferInfosLength = imageInfos?.Length ?? 0;
            var marshalledInfos   = (Interop.DescriptorImageInfo *)Interop.HeapUtil.Allocate <Interop.DescriptorImageInfo>(bufferInfosLength);

            for (int index = 0; index < bufferInfosLength; index++)
            {
                imageInfos.Value[index].MarshalTo(&marshalledInfos[index]);
            }

            Interop.WriteDescriptorSet info = new Interop.WriteDescriptorSet
            {
                SType                   = StructureType.WriteDescriptorSet,
                ImageInfo               = marshalledInfos,
                DestinationSet          = destinationSet.handle,
                DestinationBinding      = destinationBinding,
                DestinationArrayElement = destinationArrayElement,
                DescriptorCount         = (uint)bufferInfosLength,
                DescriptorType          = descriptorType
            };

            var commandDelegate = commandCache.GetCommandDelegate <Interop.VkDeviceUpdateDescriptorSetsDelegate>("vkUpdateDescriptorSets", "");

            commandDelegate(this.handle, 1, &info, 0, null);
        }
Example #24
0
 public static Error libusb_get_descriptor(IntPtr deviceHandle, DescriptorType type, byte index, byte[] data, ushort wLength)
 {
     return(libusb_get_descriptor_core(deviceHandle,
                                       type, index, data, wLength, 0));
 }
Example #25
0
 public static Error libusb_get_string_descriptor(IntPtr deviceHandle, DescriptorType type, byte index, ushort languageID, byte[] data, ushort wLength)
 {
     return(libusb_get_descriptor_core(deviceHandle,
                                       DescriptorType.String, index,
                                       data, wLength, languageID));
 }
Example #26
0
 public static Error libusb_get_descriptor(IntPtr deviceHandle, DescriptorType type, byte index, byte[] data, ushort wLength)
 {
     return libusb_get_descriptor_core(deviceHandle,
                                       type, index, data, wLength, 0);
 }
Example #27
0
 public DescriptorNode(DescriptorType descriptorType)
 {
     Type    = descriptorType;
     RawType = (byte)Type;
     Data    = new byte[0];
 }
Example #28
0
 static Error libusb_get_descriptor_core(IntPtr deviceHandle, DescriptorType type, byte index, byte[] data, ushort wLength, ushort wIndex)
 {
     return libusb_control_transfer(deviceHandle,
                                    (byte)EndpointDirection.In, (byte)Request.GetDescriptor,
                                    (ushort)((byte)DescriptorType.String << 8 | index),
                                    wIndex, data, wLength, 1000);
 }
        private Type findInAssemblies(String typeName, DescriptorType descriptorType)
        {
            Type assignableFromType;
            switch (descriptorType)
            {
                case DescriptorType.Combinator:
                    assignableFromType = typeof (CombinatorBase);
                    break;
                case DescriptorType.Selector:
                    assignableFromType = typeof (SelectorBase);
                    break;
                case DescriptorType.ModifierSelector:
                    assignableFromType = typeof (ModifierBase);
                    break;
                default:
                    throw new NotSupportedException(String.Format("Not supported descriptor type: {0}", descriptorType));
            }

            var assemblyTypes = assemblies.SelectMany(assembly => assembly.GetTypes());
            var descriptorTypes = assemblyTypes.Where(type => type != assignableFromType && assignableFromType.IsAssignableFrom(type));
            var matchedTypes = descriptorTypes.Where(type => type.FullName == typeName || type.Name == typeName);

            if (!matchedTypes.Any())
                throw new Exception(String.Format("Not found descriptor type: {0}.", typeName));

            var result = matchedTypes.SingleOrDefault();

            if (result == null)
                throw new Exception("Ambiguation between descriptor types.");

            return result;
        }