示例#1
0
 // Apply filter on the image
 private static void ApplyFilter(IFilter filter, ref Bitmap image)
 {
     if (filter is IFilterInformation)
     {
         IFilterInformation filterInfo = (IFilterInformation)filter;
         if (!filterInfo.FormatTransalations.ContainsKey(image.PixelFormat))
         {
             if (filterInfo.FormatTransalations.ContainsKey(PixelFormat.Format24bppRgb))
             {
                 MessageBox.Show("The selected image processing routine may be applied to color image only.",
                                 "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             else
             {
                 MessageBox.Show(
                     "The selected image processing routine may be applied to grayscale or binary image only.\n\nUse grayscale (and threshold filter if required) before.",
                     "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             return;
         }
     }
     try
     {
         // apply filter to the image
         image = filter.Apply(image);
     }
     catch
     {
         MessageBox.Show("Error occured applying selected filter to the image", "Error", MessageBoxButtons.OK,
                         MessageBoxIcon.Error);
     }
 }
        private void ApplyFilter(IFilter filter)
        {
            try
            {
                // set wait cursor
                this.Cursor = Cursors.WaitCursor;

                // apply filter to the image
                Bitmap newImage = filter.Apply((Bitmap)this.Image.Image);

                if (backup == null)
                {
                    backup = this.Image.Image;
                }

                this.Image.Image = newImage;

            }
            catch (ArgumentException)
            {
                MessageBox.Show("Selected filter can not be applied to the image", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
示例#3
0
 // Apply filter to the source image and show the filtered image
 private void ApplyFilter(IFilter filter)
 {
     ClearCurrentImage( );
     // apply filter
     filteredImage = filter.Apply(sourceImage);
     // display filtered image
     pictureBox.Image = filteredImage;
 }
        // Process new frame
        public void ProcessFrame(ref Bitmap image)
        {
            if (backgroundFrame == null)
            {
                // create initial backgroung image
                backgroundFrame = grayscaleFilter.Apply(image);

                // just return for the first time
                return;
            }

            Bitmap tmpImage;

            // apply the the grayscale file
            tmpImage = grayscaleFilter.Apply(image);


            if (++counter == 2)
            {
                counter = 0;

                // move background towards current frame
                moveTowardsFilter.OverlayImage = tmpImage;
                Bitmap tmp = moveTowardsFilter.Apply(backgroundFrame);

                // dispose old background
                backgroundFrame.Dispose();
                backgroundFrame = tmp;
            }

            // set backgroud frame as an overlay for difference filter
            differenceFilter.OverlayImage = backgroundFrame;

            // apply the the filters sequence
            Bitmap tmpImage2 = processingFilter.Apply(tmpImage);

            tmpImage.Dispose();

            // extract red channel from the original image
            Bitmap redChannel = extrachChannel.Apply(image);

            //  merge red channel with moving object borders
            mergeFilter.OverlayImage = tmpImage2;
            Bitmap tmpImage3 = mergeFilter.Apply(redChannel);

            redChannel.Dispose();
            tmpImage2.Dispose();

            // replace red channel in the original image
            replaceChannel.ChannelImage = tmpImage3;
            Bitmap tmpImage4 = replaceChannel.Apply(image);

            tmpImage3.Dispose();

            image.Dispose();
            image = tmpImage4;
        }
示例#5
0
        public async Task <object> Render()
        {
            _filter.Apply();

            var pagger = await GetPagger();

            var query = GetSqlGrid(pagger);

            var rows = await _connection.QueryAsync <TResult>(query, _optionsFilter);

            var result = rows.Select(CreateRowResult).ToList();

            return(new
            {
                Pager = pagger,
                Rows = result
            });
        }
        /// <summary>
        /// Generate a binary BitmapImage
        /// </summary>
        /// <param name="bitmapImage"></param>
        /// <param name="thresholdLevel"></param>
        /// <returns></returns>
        public static BitmapImage Binary(this BitmapImage bitmapImage, int thresholdLevel)
        {
            Bitmap    bitmap    = bitmapImage.BitmapImage2Bitmap();
            Threshold threshold = new Threshold(thresholdLevel);
            IFilter   filter    = Grayscale.CommonAlgorithms.BT709;

            bitmap = filter.Apply(bitmap);
            return(threshold.Apply(bitmap).ToBitmapImage());
        }
示例#7
0
        // Apply filter
        public Bitmap Apply(Bitmap srcImg)
        {
            Bitmap tmpImg = dilatation.Apply(srcImg);
            Bitmap dstImg = errosion.Apply(tmpImg);

            tmpImg.Dispose();

            return(dstImg);
        }
示例#8
0
        private void grayscale()
        // Apply Grayscale filter
        {
            // Declare image
            Bitmap  bmp    = new Bitmap(pictureBox1.Image);
            IFilter filter = Grayscale.CommonAlgorithms.BT709;

            bmp = filter.Apply(bmp);
            pictureBox1.Image = bmp;
        }
        // Apply filter to the source image and show the filtered image
        void ApplyFilter(IFilter filter)
        {
#if !UNITY_WEBPLAYER
            ClearCurrentImage();
            // apply filter
            filteredImage = filter.Apply(sourceImage);
            // display filtered image
            pictureBox.Image = filteredImage;
#endif
        }
示例#10
0
        public static Image <Pixel8> ApplyFilter(this Image <Pixel8> image, IFilter filter)
        {
            Pixel8 pixelFilterOperator(Pixel8[] neighbourhood, Pixel8 currentPixel)
            {
                var value = filter.Apply(GetComponentFromNeighbourhood(neighbourhood, p => p.Value));

                return(new Pixel8(value));
            };
            return(image.ApplyFilter(pixelFilterOperator, filter));
        }
示例#11
0
 private void buttonMirror_Click(object sender, EventArgs e)
 {
     if (pictureBoxAffineIn.Image == null)
     {
         return;
     }
     pictureBoxAffineOut.SizeMode = PictureBoxSizeMode.StretchImage;
     filter = new Mirror(false, true);
     pictureBoxAffineOut.Image = filter.Apply(AForge.Imaging.Image.Clone((Bitmap)pictureBoxAffineIn.Image, PixelFormat.Format24bppRgb));
 }
示例#12
0
 private void buttonScale_Click(object sender, EventArgs e)
 {
     if (pictureBoxAffineIn.Image == null)
     {
         return;
     }
     pictureBoxAffineOut.SizeMode = PictureBoxSizeMode.CenterImage;
     filter = new ResizeBicubic(trackBarHalf.Value, trackBarWidth.Value);
     pictureBoxAffineOut.Image = filter.Apply(AForge.Imaging.Image.Clone((Bitmap)pictureBoxAffineIn.Image, PixelFormat.Format24bppRgb));
 }
示例#13
0
        public Bitmap Apply(BitmapData imageData)
        {
            Bitmap bitmap = baseFilter.Apply(imageData);

            for (int i = 1; i < iterations; i++)
            {
                Bitmap bitmap2 = bitmap;
                bitmap = baseFilter.Apply(bitmap2);
                bitmap2.Dispose();
            }
            return(bitmap);
        }
示例#14
0
        public T Apply(T input)
        {
            var val = Process(input);

            if (_next != null)
            {
                val = _next.Apply(val);
            }
            return(val);
        }
示例#15
0
 // 过滤器
 private void ApplyFilter(IFilter filter)
 {
     //ClearCurrentImage();
     // apply filter
     Bitmap sourceimage   = new Bitmap(System.Windows.Forms.Application.StartupPath + "\\test.jpg");
     Bitmap filteredImage = filter.Apply(sourceimage);
     //canvas.Source =BitmapToBitmapImage(filteredImage);
     // display filtered image
     //pictureBox.Image = filteredImage;
 }
示例#16
0
 public IEnumerable <Tag> Apply(IEnumerable <Tag> tags)
 {
     foreach (var tag in tags)
     {
         if (filter.Apply(new[] { tag }).Count() == 0)
         {
             yield return(tag);
         }
     }
 }
示例#17
0
        public static IBitmap ApplyFilter(IBitmap iBitmap, FilterImplementations filterImplementation)
        {
            IFilter filter = GetFilter(filterImplementation);

            if (filter != null && iBitmap != null)
            {
                return(filter.Apply(iBitmap));
            }

            return(iBitmap);
        }
示例#18
0
        // Apply filter using mask
        public Bitmap Apply(Bitmap srcImg)
        {
            if (baseFilter == null)
            {
                throw new NullReferenceException("Base filter is not set");
            }

            // initial iteration
            Bitmap dstImg = baseFilter.Apply(srcImg);
            Bitmap tmpImg;

            // continue iterate
            for (int i = 1; i < iterations; i++)
            {
                tmpImg = dstImg;
                dstImg = baseFilter.Apply(tmpImg);
                tmpImg.Dispose();
            }

            return(dstImg);
        }
示例#19
0
        public async Task MakeAllFollowingsFollowersFollowRequestAsync(int top = 1000, IFilter <UserInfo> filter = null)
        {
            List <UserInfo> currentUserFollowingList = await instaService.GetCurrentUserFollowings();

            List <UserInfo> requestList = new List <UserInfo>();
            RandomGenerator random      = new RandomGenerator(currentUserFollowingList.Count);

            for (int i = 0; i < currentUserFollowingList.Count; i++)
            {
                int index     = random.Different();
                var following = currentUserFollowingList[index];
                logger.Write($"Random UserName : {following.UserName}, Index Order {i}");
                List <UserInfo> userInfoList = await instaService.GetUserFollowers(following.UserName, 10);

                filter = filter ?? FollowerFilter.DefaultFilter();


                var filtered = filter.Apply(userInfoList);
                filtered.RemoveAll(u => currentUserFollowingList.Exists(c => c.Id == u.Id));
                if (filtered != null && filtered.Count > 0)
                {
                    requestList.AddRange(filtered);
                }

                if (requestList.Count >= top)
                {
                    requestList = requestList.Take(top).ToList();
                    break;
                }
            }

            int requestIndex = 0;

            try
            {
                for (requestIndex = 0; requestIndex < requestList.Count; requestIndex++)
                {
                    logger.Write($"Requested UserName : {requestList[requestIndex].UserName}, Remaining User {requestList.Count - requestIndex - 1}");
                    await Retry.DoAsync(() => instaService.FollowUserAsync(requestList[requestIndex].Id), TimeSpan.FromSeconds(3));
                }
            }
            catch (Exception ex)
            {
                logger.Write(ex.ToString());
            }
            finally
            {
                if (requestIndex > 0)
                {
                    FileUtils.WriteAllToRequestedFile(requestList.Take(requestIndex).ToList());
                }
            }
        }
示例#20
0
        private Bitmap ProcessCurrentFrame()
        {
            Bitmap bmp;

            //curr_gs = pixelFilter.Apply(curr_gs);

            if (first)
            {
                back  = (Bitmap)curr_gs.Clone();
                first = false;
            }

            /* Detection */

            diffFilter.OverlayImage = back;
            bmp = diffFilter.Apply(curr_gs);
            bmp = thresholdFilter.Apply(bmp);
            bmp = blobFilter.Apply(bmp);
            //bmp = erosionFilter.Apply(bmp);
            //bmp = openFilter.Apply(bmp);
            //bmp = edgeFilter.Apply(bmp);

            try
            {
                //blobCount.Text = blobGrabber.Apply(bmp).Size.ToString();
            }
            catch (Exception)
            {
            }


            /* Transcribe to original image */

            // extract red channel from the original image
            //IFilter extrachChannel = new ExtractChannel(RGB.R);
            //Bitmap redChannel = extrachChannel.Apply(curr_c);
            //  merge red channel with motion regions
            //Merge mergeFilter = new Merge();
            //mergeFilter.OverlayImage = bmp;
            //Bitmap tmp4 = mergeFilter.Apply(redChannel);
            // replace red channel in the original image
            //ReplaceChannel replaceChannel = new ReplaceChannel(RGB.R,tmp4);
            //curr_c = replaceChannel.Apply(curr_c);

            /* Background Update */
            //towardsFilter.OverlayImage = curr_gs;
            //back = towardsFilter.Apply(back);
            morphFilter.OverlayImage = curr_gs;
            back = morphFilter.Apply(back);


            return(bmp);
        }
示例#21
0
        private void ApplyFilter(IFilter filter)
        {
            pictureBox2.Image = null;

            pictureBox2.SizeMode = PictureBoxSizeMode.StretchImage;

            // apply filter
            Bitmap filteredImage = filter.Apply(sourceImage);

            // display filtered image
            pictureBox2.Image = filteredImage;
            pictureBox2.Image.Save(@"e:\BTWork\MachineL\machine_vision\Test\图片处理\12.jpg");
        }
示例#22
0
        private void ActualizarFiltro()
        {
            ColorFiltering filtroColor = new ColorFiltering();

            filtroColor.Red   = red;
            filtroColor.Green = green;
            filtroColor.Blue  = blue;
            IFilter filtro = filtroColor;
            Bitmap  bmp    = new Bitmap(peCaptcha.Image);
            Bitmap  xImage = filtro.Apply(bmp);

            peCaptcha.Image = xImage;
        }
示例#23
0
 private void ApplyFilter(IFilter filter)
 {
     Bitmap sourceImage = (Bitmap)ImagePanel.Image;
     // apply filter
     Bitmap filteredImage = null;
     if (sourceImage != null)
     {
         filteredImage = filter.Apply(sourceImage);
         // display filtered image
     }
     else { MessageBox.Show("No image was loaded.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
     ImagePanel.Image = filteredImage;
 }
        private void ActualizarFiltro()
        {
            ColorFiltering FiltroColor = new ColorFiltering();

            FiltroColor.Red   = red;
            FiltroColor.Green = green;
            FiltroColor.Blue  = blue;
            IFilter Filtro = FiltroColor;
            Bitmap  bmp    = new Bitmap(pictureCapchaE.Image);
            Bitmap  XImage = Filtro.Apply(bmp);

            pictureCapchaE.Image = XImage;
        }
        public async Task <IEnumerable <WorkOrder> > GetWorkOrders(IFilter <WorkOrder> filter, bool includeHistorical)
        {
            IQueryable <WorkOrder> workOrders = _repairsContext.WorkOrders.RestrictContractor(_currentUserService)
                                                .Include(wo => wo.AssignedToPrimary);

            workOrders = filter.Apply(workOrders);

            if (!includeHistorical)
            {
                workOrders = workOrders.Where(w => w.Id > 10000000);
            }

            return(await workOrders.ToListAsync());
        }
示例#26
0
 public void applyfilter1(IFilter filter)
 {
     try
     {
         Grayscale g = new Grayscale(0.2125, 0.7154, 0.0721);
         image = g.Apply(image);
         Bitmap newImage = filter.Apply(image);
         pictureBox2.Image = newImage;
     }
     catch (ArgumentException)
     {
         MessageBox.Show("Selected filter can not be applied to the image", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#27
0
        public void Filter(IFilter <TDmn, TPermissions> filter)
        {
            filter.ValidateNotNullParameter(nameof(filter));

            HttpStatusCode filterPermissions = filter.HasPermissions(this.permissions);

            if (filterPermissions != HttpStatusCode.OK)
            {
                throw new RestfulException(filterPermissions);
            }

            this.isGetAll      = false;
            this.internalQuery = filter.Apply(this.internalQuery);
        }
示例#28
0
        /// <summary>
        /// Apply filter to an image.
        /// </summary>
        ///
        /// <param name="imageData">Source image to apply filter to.</param>
        ///
        /// <returns>Returns filter's result obtained by applying the filter to
        /// the source image.</returns>
        ///
        /// <remarks>The filter accepts bitmap data as input and returns the result
        /// of image processing filter as new image. The source image data are kept
        /// unchanged.</remarks>
        ///
        public Bitmap Apply(BitmapData imageData)
        {
            // initial iteration
            Bitmap dstImg = baseFilter.Apply(imageData);
            Bitmap tmpImg;

            // continue to iterate
            for (int i = 1; i < iterations; i++)
            {
                tmpImg = dstImg;
                dstImg = baseFilter.Apply(tmpImg);
                tmpImg.Dispose( );
            }

            return(dstImg);
        }
示例#29
0
        private static Bitmap ApplyFilter(IFilter filter, Bitmap image)
        {
            IFilterInformation filterInformation = filter as IFilterInformation;

            if (filterInformation != null && !filterInformation.FormatTranslations.ContainsKey(image.PixelFormat))
            {
                if (filterInformation.FormatTranslations.ContainsKey(PixelFormat.Format24bppRgb))
                {
                    return(null);
                }

                return(null);
            }
            return(filter.Apply(image));
        }
示例#30
0
        private void trackBar_Scroll(object sender, EventArgs e)
        {
            if (pictureBoxAffineIn.Image == null)
            {
                return;
            }
            pictureBoxAffineOut.SizeMode = PictureBoxSizeMode.StretchImage;
            if (label2.Text == "Height")
            {
                return;
            }

            filter = new RotateBilinear(trackBarHalf.Value, true);
            pictureBoxAffineOut.Image = filter.Apply(AForge.Imaging.Image.Clone((Bitmap)pictureBoxAffineIn.Image, PixelFormat.Format24bppRgb));
        }
示例#31
0
        public static bool RotateTest32bpp(IFilter filter, Bitmap input, Bitmap output)
        {
            var itm = new ImageToMatrix();

            // Test directly
            Color[,] actual;
            itm.Convert(filter.Apply(input), out actual);

            Color[,] expected;
            itm.Convert(output, out expected);

            if (!actual.IsEqual(expected))
                return false;

            // Rotate and re-test
            var rotate = new RotateNearestNeighbor(90, false);
            input = rotate.Apply(input);
            output = rotate.Apply(output);

            itm.Convert(filter.Apply(input), out actual);
            itm.Convert(output, out expected);

            return actual.IsEqual(expected);
        }
示例#32
0
        private void ApplyFilter(IFilter filter)
        {
            Bitmap sourceImage = (Bitmap)ImagePanel.Image;
            // apply filter
            Bitmap filteredImage = null;

            if (sourceImage != null)
            {
                filteredImage = filter.Apply(sourceImage);
                // display filtered image
            }
            else
            {
                MessageBox.Show("No image was loaded.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            ImagePanel.Image = filteredImage;
        }
示例#33
0
        private void apply()
        {
            if (dataGridView2.CurrentRow != null)
            {
                IFilter filter = (dataGridView2.CurrentRow.DataBoundItem as FilterDescriptor).Filter;
                propertyGrid1.SelectedObject = filter;

                if (filter == null)
                {
                    dataGridView1.DataSource = sourceTable;
                }
                else
                {
                    dataGridView1.DataSource = filter.Apply(dataGridView1.DataSource as DataTable);
                }
            }
        }
示例#34
0
        private void ApplyFilter(IFilter filter)
        {
            this.Cursor = Cursors.WaitCursor;

            Bitmap newImage = filter.Apply(image);

            if (backup != null)
            {
                backup.Dispose();
            }

            backup = image;
            image  = newImage;

            UpdateNewImage();

            this.Cursor = Cursors.Default;
        }
        private void ApplyFilter(IFilter filter)
        {
            ClearCurrentImage();
            Bitmap filteredImage = null;

            try
            {
                filteredImage = filter.Apply(image.SourceImage);
            }
            catch (Exception exc) {
                MessageBox.Show(exc.ToString());
                return;
            }

            if (isFilterSet || isContrastBarSetValue || isBrightnesstBarSetValue)
            {
                pictureBox1.Image = image.SourceImage = filteredImage;
                painter.setContext(image.Context);
                isFilterSet = isContrastBarSetValue = isBrightnesstBarSetValue = false;
            }
            else
                pictureBox1.Image = filteredImage;
        }
示例#36
0
 private Bitmap ApplyFilter(IFilter filter)
 {
     filteredImage = filter.Apply(sourceImage);
     return filteredImage;
 }
示例#37
0
 public void ApplyFilter(IFilter filter)
 {
     filter.Apply(this._bitmap);
 }
示例#38
0
 public static Bitmap Apply(this Bitmap bitmap, IFilter filter)
 {
     return filter.Apply(bitmap);
 }
示例#39
0
        // Apply filter on the image
        private void ApplyFilter(IFilter filter)
        {
            try
            {
                // set wait cursor
                this.Cursor = Cursors.WaitCursor;

                // apply filter to the image
                Bitmap newImage = filter.Apply(image);

                if (host.CreateNewDocumentOnChange)
                {
                    // open new image in new document
                    host.NewDocument(newImage);
                }
                else
                {
                    if (host.RememberOnChange)
                    {
                        // backup current image
                        if (backup != null)
                            backup.Dispose();

                        backup = image;
                    }
                    else
                    {
                        // release current image
                        image.Dispose();
                    }

                    image = newImage;

                    // update
                    UpdateNewImage();
                }
            }
            catch (ArgumentException)
            {
                MessageBox.Show("Selected filter can not be applied to the image", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                // restore cursor
                this.Cursor = Cursors.Default;
            }
        }
示例#40
0
        public void ApplyFilter(IFilter filter)
        {
            try
            {
                this.Cursor = Cursors.WaitCursor;

                SetUndo();

                Bitmap newBitmap = filter.Apply(bitmap);
                if (cropped)
                    newBitmap = filter.Apply(zoomBitmap);

                if (toGrayscale)
                {
                    Bitmap tempBitmap = ColorToGrayscale(newBitmap);
                    bitmap = (Bitmap)tempBitmap.Clone();
                    tempBitmap.Dispose();
                    toGrayscale = false;
                }
                else
                {
                    bitmap = new Bitmap(newBitmap.Size.Width, newBitmap.Size.Height, PixelFormat.Format24bppRgb);
                    Graphics g = Graphics.FromImage(bitmap);
                    g.DrawImage(newBitmap, new Point(0, 0));
                    g.Dispose();
                }
                newBitmap.Dispose();
                MenuItemUndo.Enabled = true;
                toolStripButtonUndo.Enabled = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "SPixel", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
            this.imageDisplay.Invalidate();
        }
示例#41
0
 // Apply filter to the source image and show the filtered image
 private void ApplyFilter( IFilter filter )
 {
     ClearCurrentImage( );
     // apply filter
     filteredImage = filter.Apply( sourceImage );
     // display filtered image
     pictureBox.Image = filteredImage;
 }
示例#42
0
        // Apply filter on the image
        private void ApplyFilter( IFilter filter )
        {
            if ( filter is IFilterInformation )
            {
                IFilterInformation filterInfo = (IFilterInformation) filter;

                if ( !filterInfo.FormatTransalations.ContainsKey( image.PixelFormat ) )
                {
                    if ( filterInfo.FormatTransalations.ContainsKey( PixelFormat.Format24bppRgb ) )
                    {
                        MessageBox.Show( "The selected image processing routine may be applied to color image only.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error );
                    }
                    else
                    {
                        MessageBox.Show( "The selected image processing routine may be applied to grayscale or binary image only.\n\nUse grayscale (and threshold filter if required) before.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error );
                    }
                    return;
                }
            }

            try
            {
                // set wait cursor
                this.Cursor = Cursors.WaitCursor;

                // apply filter to the image
                Bitmap newImage = filter.Apply( image );

                if ( host.CreateNewDocumentOnChange )
                {
                    // open new image in new document
                    host.NewDocument( newImage );
                }
                else
                {
                    if ( host.RememberOnChange )
                    {
                        // backup current image
                        if ( backup != null )
                            backup.Dispose( );

                        backup = image;
                    }
                    else
                    {
                        // release current image
                        image.Dispose( );
                    }

                    image = newImage;

                    // update
                    UpdateNewImage( );
                }
            }
            catch
            {
                MessageBox.Show( "Error occured applying selected filter to the image", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error );
            }
            finally
            {
                // restore cursor
                this.Cursor = Cursors.Default;
            }
        }
示例#43
0
 public static HtmlDocument ApplyFilter(this HtmlDocument doc, IFilter filter)
 {
     filter.Apply(doc);
     return doc;
 }