コード例 #1
0
        public Sample ConvertRawBmpAsSample(Bitmap RawBmp, short VertDpi = 700, short HorDpi = 700)
        {
            VariantConverter VConverter;

            Enroller = new DPFP.Processing.Enrollment();
            RawBmp   = EncodeBitmap(RawBmp, VertDpi, HorDpi);
            try
            {
                // converts raw image to dpSample using DFC 2.0---------------------------------------
                // encode the bmp variable using the bitmap Loader
                BitmapLoader BmpLoader = new BitmapLoader(RawBmp, (int)RawBmp.HorizontalResolution, (int)RawBmp.VerticalResolution);
                BmpLoader.ProcessBitmap();
                // return the required result
                inputData = BmpLoader.RawData;
                inpRaw    = BmpLoader.DPInputParam;
                // dispose the object
                BmpLoader.Dispose();

                // start the conversion process
                VConverter = new VariantConverter(VariantConverter.OutputType.dp_sample, DataType.RawSample, inpRaw, inputData, false);
                MemoryStream DStream = new MemoryStream(VConverter.Convert());
                DPsample = new DPFP.Sample(DStream);
                return(DPsample);
            }
            catch (Exception ex)
            {
                return(null /* TODO Change to default(_) if this is not a reference type */);
            }
        }
コード例 #2
0
        public DPFP.Template ConvertRawBmpAsTemplate(Bitmap RawBmp, DataPurpose ProcessPurpose = DataPurpose.Enrollment, short VertDpi = 700, short HorDpi = 700)
        {
            VariantConverter VConverter;

            Enroller = new DPFP.Processing.Enrollment();
            RawBmp   = EncodeBitmap(RawBmp, VertDpi, HorDpi);
            try
            {
                // converts raw image to dpSample using DFC 2.0---------------------------------------
                // encode the bmp variable using the bitmap Loader
                BitmapLoader BmpLoader = new BitmapLoader(RawBmp, (int)RawBmp.HorizontalResolution, (int)RawBmp.VerticalResolution);
                BmpLoader.ProcessBitmap();
                // return the required result
                inputData = BmpLoader.RawData;
                inpRaw    = BmpLoader.DPInputParam;
                // dispose the object
                BmpLoader.Dispose();

                // start the conversion process
                VConverter = new VariantConverter(VariantConverter.OutputType.dp_sample, DataType.RawSample, inpRaw, inputData, false);
                MemoryStream DStream = new MemoryStream(VConverter.Convert());
                DPsample = new DPFP.Sample(DStream);
                // DPsample = DirectCast(VConverter.Convert(), DPFP.Sample)

                // converts dpSample to DPFeatures using the OTW'''''''''''''''''''''''''''''''''''''''
                DPFeatures = ExtractFeatures(DPsample, ProcessPurpose);
                // convert DPfeatures to ISO FMD using the DFC 2.0'''''''''''''''''''''''''''''''''''''''
                byte[] SerializedFeatures = null;
                DPFeatures.Serialize(ref SerializedFeatures); // serialized features into the array of bytes
                ISOFMD = DigitalPersona.Standards.Converter.Convert(SerializedFeatures, DigitalPersona.Standards.DataType.DPFeatureSet, DataType.ISOFeatureSet);

                // convert ISO FMD to DPTemplate using DFC 2.0'''''''''''''''''''''''''''''''''''''''
                byte[] DPTemplateData = DigitalPersona.Standards.Converter.Convert(ISOFMD, DigitalPersona.Standards.DataType.ISOTemplate, DataType.DPTemplate);
                // deserialize data to Template
                DPTemplate = new DPFP.Template();
                DPTemplate.DeSerialize(DPTemplateData); // required for database purpose
                                                        // ============================================================================
                DStream.Close();
                return(DPTemplate);
            }
            catch (Exception ex)
            {
                return(null /* TODO Change to default(_) if this is not a reference type */);
            }
        }