public PicSharpenWindow(BitmapSource bs) { InitializeComponent(); this.bs = bs; Content.DataContext = picSharpenControl; Sharpen.AddHandler(Slider.MouseLeftButtonUpEvent, new MouseButtonEventHandler(Slider_MouseLeftButtonUp), true); }
private void FiltroSharpen(Bitmap bmp) { IFilter Filtro = new Sharpen(); Bitmap XImage = Filtro.Apply(bmp); pictureCapchaE.Image = XImage; }
public static Bitmap Sharpen(Bitmap bmp) { Sharpen filter = new Sharpen(); filter.ApplyInPlace(bmp); return(bmp); }
public Bitmap ToSharpen(Bitmap Im) { AForge.Imaging.Filters.Sharpen Img = new Sharpen(); Bitmap bmImage = AForge.Imaging.Image.Clone(new Bitmap(Im), PixelFormat.Format24bppRgb); return(Img.Apply(bmImage)); }
public string decodeBitmap(Bitmap img) { /////////图像处理 //转为灰度图 Grayscale grayscaleFilter = new Grayscale(0.299, 0.587, 0.114); Bitmap bitmapGrayscale = grayscaleFilter.Apply(img); //二值化 Threshold thresholdFilter = new Threshold(128); Bitmap bitmapThreshold = thresholdFilter.Apply(bitmapGrayscale); ////////中值滤波 Median mediafil = new Median(); Bitmap medianBit = mediafil.Apply(bitmapThreshold); //锐化 Sharpen sharpPic = new Sharpen(); Bitmap sharpOut = sharpPic.Apply(medianBit); //统计点数 HorizontalIntensityStatistics his = new HorizontalIntensityStatistics(sharpOut); Histogram histogram = his.Gray; int[] dato = histogram.Values; /////分割图像 charCut(dato); shunfengdecoder decode = new shunfengdecoder(); string backcode = decode.Decoder(sharpOut, div); return(backcode); }
public _IVisitor4_29(OverlapMap _enclosing, ByRef prevSlot, Sharpen.Util.ISet overlaps ) { this._enclosing = _enclosing; this.prevSlot = prevSlot; this.overlaps = overlaps; }
public override System.IO.TextWriter AppendRange(Sharpen.CharSequence csq, int start , int end) { string str = csq.subSequence(start, end).ToString(); _buffer.append(str, 0, str.Length); return this; }
/// <exception cref="System.IO.IOException"></exception> public NetworkSocketBase(Sharpen.Net.Socket socket, string hostName) { _socket = socket; _hostName = hostName; _in = _socket.GetInputStream(); _out = _socket.GetOutputStream(); }
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { if (values.Length == 2) { Sharpen selectedSharpen = (Sharpen)values[1]; if (selectedSharpen == Sharpen.LapSharp) { BindingList <FilterTune> tunes = new BindingList <FilterTune>(); foreach (HBPresetTune tune in HandBrakeFilterHelpers.GetFilterTunes((int)hb_filter_ids.HB_FILTER_LAPSHARP)) { tunes.Add(new FilterTune(tune)); } return(tunes); } else if (selectedSharpen == Sharpen.UnSharp) { BindingList <FilterTune> tunes = new BindingList <FilterTune>(); foreach (HBPresetTune tune in HandBrakeFilterHelpers.GetFilterTunes((int)hb_filter_ids.HB_FILTER_UNSHARP)) { tunes.Add(new FilterTune(tune)); } return(tunes); } } return(new BindingList <HBPresetTune>()); }
private void FiltroSharpen(Bitmap bmp) { IFilter filtro = new Sharpen(); Bitmap xImage = filtro.Apply(bmp); peCaptcha.Image = xImage; }
private Bitmap ProcessSingleImage(Bitmap _src) { Sharpen sharpenFilter = new Sharpen(); sharpenFilter.ApplyInPlace(_src); return(_src); }
public static Bitmap Sharpen(Bitmap Imagem) { Sharpen filter = new Sharpen(); Imagem = Imagem.Clone(new Rectangle(0, 0, Imagem.Width, Imagem.Height), System.Drawing.Imaging.PixelFormat.Format24bppRgb); Imagem = filter.Apply(Imagem); return(Imagem); }
public CollectionHolder(string name, IDictionary theMap, Sharpen.Util.ISet theSet , IList theList) { this.name = name; map = theMap; set = theSet; list = theList; }
//sharpen the image private static Bitmap Sharpen(Bitmap image) { // create filter Sharpen filter = new Sharpen(); // apply the filter return(filter.Apply(image)); }
public MergedStream(com.fasterxml.jackson.core.io.IOContext ctxt, Sharpen.InputStream @in, byte[] buf, int start, int end) { _ctxt = ctxt; _in = @in; _b = buf; _ptr = start; _end = end; }
public static void ApplyMatrix(Bitmap image, int[,] matrix, int threshold = 1) { Sharpen sharpenFilter = new Sharpen() { Kernel = matrix, Threshold = threshold }; sharpenFilter.ApplyInPlace(image); }
public Form1() { InitializeComponent(); fic = new FilterInfoCollection(FilterCategory.VideoInputDevice); foreach (FilterInfo fi in fic) { comboBox1.Items.Add(fi.Name); } sh = new Sharpen(); sh.Threshold = 10; }
protected internal DataFormatMatcher(Sharpen.InputStream @in, byte[] buffered, int bufferedStart, int bufferedLength, com.fasterxml.jackson.core.JsonFactory match , com.fasterxml.jackson.core.format.MatchStrength strength) { _originalStream = @in; _bufferedData = buffered; _bufferedStart = bufferedStart; _bufferedLength = bufferedLength; _match = match; _matchStrength = strength; }
private void UpdateForSharpen(Vector3 wpos) { reticleSpherical.EnableRenderer(true); reticleSpherical.SetPositionAndSize(wpos, BrushSize); if (clicking && Terrain.OperationsManager.IsReadyToComputeAsync) { Terrain.OperationsManager .Add(Sharpen.CreateFromUnityWorld(Terrain, wpos, BrushSize, Math.Max(1.0, BrushSize / 3.0)), true) .PerformAll(asyncOperations); } }
private string CheckExt(Sharpen.IO.File file) { string name = file.GetName(); int pos = name.LastIndexOf("."); if (pos > 0) { i_ext = Sharpen.Runtime.Substring(name, pos); return Sharpen.Runtime.Substring(name, 0, pos); } i_ext = string.Empty; return name; }
public UTF8Writer(com.fasterxml.jackson.core.io.IOContext ctxt, Sharpen.OutputStream @out) { _context = ctxt; _out = @out; _outBuffer = ctxt.allocWriteEncodingBuffer(); /* Max. expansion for a single char (in unmodified UTF-8) is * 4 bytes (or 3 depending on how you view it -- 4 when recombining * surrogate pairs) */ _outBufferEnd = _outBuffer.Length - 4; _outPtr = 0; }
/// <summary> /// Constructor used when content to check is available via /// input stream and must be read. /// </summary> public Std(Sharpen.InputStream @in, byte[] buffer) { /* /********************************************************** /* Standard implementation /********************************************************** */ _in = @in; _buffer = buffer; _bufferedStart = 0; _ptr = 0; _bufferedEnd = 0; }
public static IDictionary TypesFor(LocalObjectContainer db, Sharpen.Util.ISet ids ) { IDictionary id2clazzes = new Hashtable(); ClassMetadataIterator iter = db.ClassCollection().Iterator(); while (iter.MoveNext()) { for (IEnumerator idIter = ids.GetEnumerator(); idIter.MoveNext(); ) { int id = ((int)idIter.Current); ClassMetadata clazz = iter.CurrentClass(); BTree btree = BTreeClassIndexStrategy.Btree(clazz); if (btree.Search(db.SystemTransaction(), id) != null) { Sharpen.Util.ISet clazzes = ((Sharpen.Util.ISet)id2clazzes[id]); if (clazzes == null) { clazzes = new HashSet(); id2clazzes[id] = clazzes; } clazzes.Add(clazz); } } } IDictionary id2clazz = new Hashtable(); for (IEnumerator idIter = id2clazzes.Keys.GetEnumerator(); idIter.MoveNext(); ) { int id = ((int)idIter.Current); Sharpen.Util.ISet clazzes = ((Sharpen.Util.ISet)id2clazzes[id]); ClassMetadata mostSpecific = null; for (IEnumerator curClazzIter = clazzes.GetEnumerator(); curClazzIter.MoveNext(); ) { ClassMetadata curClazz = ((ClassMetadata)curClazzIter.Current); for (IEnumerator cmpClazzIter = clazzes.GetEnumerator(); cmpClazzIter.MoveNext(); ) { ClassMetadata cmpClazz = ((ClassMetadata)cmpClazzIter.Current); if (curClazz.Equals(cmpClazz._ancestor)) { goto OUTER_continue; } } mostSpecific = curClazz; break; OUTER_continue: ; } OUTER_break: ; id2clazz[id] = mostSpecific; } return id2clazz; }
/// <summary> /// Initializes a new instance of the <see cref="TextProcessingSettings"/> class. /// </summary> /// <param name="size">The initial output size.</param> /// <param name="font">The initial font.</param> public TextProcessingSettings(Size size, Font font) { this.calculateCharacterSize = true; this.isBlackTextOnWhite = !Variables.Instance.InvertImage; this.isFixedWidth = true; this.IsGeneratedRamp = Variables.Instance.UseGeneratedRamp; this.ramp = "MMMMMMM@@@@@@@WWWWWWWWWBBBBBBBB000000008888888ZZZZZZZZZaZaaaaaa2222222SSSSSSSXXXXXXXXXXX7777777rrrrrrr;;;;;;;;iiiiiiiii:::::::,:,,,,,,......... "; this.sharpen = Variables.Instance.Sharpen; this.sharpenFilter = new Sharpen(); this.stretch = Variables.Instance.Stretch; this.stretchFilter = new Stretch(); this.unsharp = Variables.Instance.UnsharpMask; this.unsharpFilter = new UnsharpMask(3); this.filterChanged = true; if (Variables.Instance.CurrentSelectedValidCharacters > -1) { this.validCharacters = (string)Variables.Instance.DefaultValidCharacters[Variables.Instance.CurrentSelectedValidCharacters]; } else { this.validCharacters = Variables.Instance.CurrentCharacters; } this.Size = size; this.Font = font; // TODO: Move these to ResetVariables and set widgets from events this.brightness = Variables.Instance.DefaultTextBrightness; this.contrast = Variables.Instance.DefaultTextContrast; this.dithering = Variables.Instance.DefaultDitheringLevel; this.ditheringRandom = Variables.Instance.DefaultDitheringRandom; this.flipHorizontally = Variables.Instance.FlipHorizontally; this.flipVertically = Variables.Instance.FlipVertically; this.levels = new LevelsSettings(Variables.Instance.DefaultMinimumLevel, Variables.Instance.DefaultMedianLevel, Variables.Instance.DefaultMaximumLevel); }
private Bitmap ProcessSingleImage(Bitmap _src) { Bitmap img = (_src.PixelFormat == PixelFormat.Format24bppRgb) ? _src : CloneTo24bpp(_src); Sharpen sharpenFilter = new Sharpen(); sharpenFilter.ApplyInPlace(img); if (_src.PixelFormat != PixelFormat.Format24bppRgb) { Graphics g = Graphics.FromImage(_src); g.DrawImageUnscaled(img, 0, 0); img.Dispose(); } return(_src); }
public UTF32Reader(com.fasterxml.jackson.core.io.IOContext ctxt, Sharpen.InputStream @in, byte[] buf, int ptr, int len, bool isBigEndian) { /* /********************************************************** /* Life-cycle /********************************************************** */ _context = ctxt; _in = @in; _buffer = buf; _ptr = ptr; _length = len; _bigEndian = isBigEndian; _managedBuffers = (@in != null); }
void SharpenToolStripMenuItemClick(object sender, EventArgs e) { //jika gambar kosong/null maka akan mengembalikan nilai kosong/null if (gambar == null) { return; } //membuat filter dari inisiasi class Sharpen() pada objek sharpen Sharpen sharpen = new Sharpen( ); //clone variable gambar pada variable gambar2 gambar2 = (Bitmap)gambar.Clone(); //aplikasikan filter objek sharpen pada gambar2 sharpen.ApplyInPlace(gambar2); //tampilkan hasil gambar2 yang sudah diaplikasikan filter pada pictureBox2 pictureBox2.Image = gambar2; }
private void FiltersSharpeness_Click(object sender, EventArgs e) { _filtersState = true; LoadButton.Enabled = false; RenderButton.Enabled = false; SwitchFiltersState(); var result = new Bitmap(RenderPicture.Image); var filter = new Sharpen(new MyImage(_origin), new MyImage(result)); RenderPicture.Image = result; SwitchFiltersState(); FiltersSharpeness.Enabled = false; LoadButton.Enabled = true; if (_file != null) { RenderButton.Enabled = true; } }
public void onUnsafeSharpenFilter(bool f) { model.setImage(Sharpen.FilterSharpen3(model.getImage())); if (f) { view.showPictures(model.getImage(), null); model.push(model.getImage()); } else { Bitmap[] arr = new Bitmap[3]; arr[0] = Sharpen.FilterSharpen3(model.getChannels()[0]); arr[1] = Sharpen.FilterSharpen3(model.getChannels()[1]); arr[2] = Sharpen.FilterSharpen3(model.getChannels()[2]); model.setChannels(arr); view.showPictures(model.getImage(), model.getChannels()); } }
public UTF8StreamJsonParser(com.fasterxml.jackson.core.io.IOContext ctxt, int features , Sharpen.InputStream @in, com.fasterxml.jackson.core.ObjectCodec codec, com.fasterxml.jackson.core.sym.ByteQuadsCanonicalizer sym, byte[] inputBuffer, int start, int end, bool bufferRecyclable) : base(ctxt, features) { // This is the main input-code lookup table, fetched eagerly // Latin1 encoding is not supported, but we do use 8-bit subset for // pre-processing task, to simplify first pass, keep it fast. /* /********************************************************** /* Configuration /********************************************************** */ /* /********************************************************** /* Parsing state /********************************************************** */ /* /********************************************************** /* Input buffering (from former 'StreamBasedParserBase') /********************************************************** */ /* /********************************************************** /* Current input data /********************************************************** */ /* /********************************************************** /* Life-cycle /********************************************************** */ _inputStream = @in; _objectCodec = codec; _symbols = sym; _inputBuffer = inputBuffer; _inputPtr = start; _inputEnd = end; _currInputRowStart = start; // If we have offset, need to omit that from byte offset, so: _currInputProcessed = -start; _bufferRecyclable = bufferRecyclable; }
public void sharpenClickHandler(object sender, EventArgs e) { if (image != null) { Bitmap img = new Bitmap(path); Sharpen filter = new Sharpen(); img = filter.Apply(img); //ImageEView if (mov != null) { this.WorkItem.Workspaces[WorkspaceNames.TabWorkspace].Close(mov); } mov = this.WorkItem.SmartParts.AddNew <ImageEView>(); mov.panAndZoomPictureBox1.Image = img; SmartPartInfo spi = new SmartPartInfo("Sharpen", "MyOwnDescription"); this.WorkItem.Workspaces[WorkspaceNames.TabWorkspace].Show(mov, spi); } }
public static Bitmap Sharpen(this Bitmap source) { try { var sharpenFilter = new Sharpen() { Kernel = new int[, ] { { -1, -1, -1 }, { -1, 9, -1 }, { -1, -1, -1 } }, Threshold = 1 }; return(sharpenFilter.Apply(source)); } catch (Exception ex) { throw new Exception($"Could not sharpen the image. Message: {ex.Message}", ex); } }
// ProgressDialog dlg = null; private void Sharpen() { IFilter filter = new Sharpen(); Bitmap imgOri = this.ucEditImageCtrl.OriginalImage as Bitmap; if (imgOri != null) { try { Image img = filter.Apply(imgOri); this.ucEditImageCtrl.OriginalImage = m_CurImage = img; } catch (Exception ex) { // MyLog4Net.Container.Instance.Log.Error("Sharpen error: ", ex); //XtraMessageBox.Show("锐化出错!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); this.ucEditImageCtrl.OriginalImage = imgOri; } } }
//sharpen with 3x3, 5x5 and 7x7 public void onMatrixSharpen() { Bitmap tmp1, tmp2, tmp3; Bitmap[] arr = new Bitmap[3]; tmp1 = (Bitmap)model.getImage().Clone(); tmp2 = (Bitmap)model.getImage().Clone(); tmp3 = (Bitmap)model.getImage().Clone(); arr[0] = Sharpen.FilterSharpen3(tmp1); arr[1] = Sharpen.FilterSharpen5(tmp2); arr[2] = Sharpen.FilterSharpen7(tmp3); model.setChannels(arr); view.showPictures(model.getImage(), model.getChannels()); }
private void SharpenSmooth(object sender, DoWorkEventArgs e) { Bitmap raw_image = null; if (inRb.Checked) { raw_image = Accord.Imaging.Filters.Grayscale.CommonAlgorithms.BT709.Apply((Bitmap)input_PB.Image.Clone()); } else if (outRb.Checked) { raw_image = (Bitmap)outputImageBox.Image.Clone(); } if (sharpenRB.Checked) { var sharpen = new Sharpen(); sharpen.Threshold = (Byte)threshVal.Value; UnmanagedImage r_img = UnmanagedImage.FromManagedImage(raw_image); outputImageBox.Image.Dispose(); r_img = sharpen.Apply(r_img); outputImageBox.Image = r_img.ToManagedImage(); } else if (smoothingRB.Checked) { var Smoothing = new AdaptiveSmoothing(); Smoothing.Factor = (double)(threshVal.Value); UnmanagedImage r_img = UnmanagedImage.FromManagedImage(raw_image); outputImageBox.Image.Dispose(); r_img = Smoothing.Apply(r_img); outputImageBox.Image = r_img.ToManagedImage(); } else if (radioButton1.Checked) { var Invert = new Invert(); UnmanagedImage r_img = UnmanagedImage.FromManagedImage(raw_image); outputImageBox.Image.Dispose(); r_img = Invert.Apply(r_img); outputImageBox.Image = r_img.ToManagedImage(); } }
public ByteSourceJsonBootstrapper(com.fasterxml.jackson.core.io.IOContext ctxt, Sharpen.InputStream @in) { /* /********************************************************** /* Configuration /********************************************************** */ /* /********************************************************** /* Input buffering /********************************************************** */ /* /********************************************************** /* Input location /********************************************************** */ /* /********************************************************** /* Data gathered /********************************************************** */ // 0 means "dunno yet" /* /********************************************************** /* Life-cycle /********************************************************** */ _context = ctxt; _in = @in; _inputBuffer = ctxt.allocReadIOBuffer(); _inputEnd = _inputPtr = 0; _inputProcessed = 0; _bufferRecyclable = true; }
/// <summary>Creates an <code>XMPDateTime</code>-instance from a calendar.</summary> /// <param name="calendar">a <code>Calendar</code></param> public XMPDateTimeImpl(Sharpen.Calendar calendar) { // EMPTY // extract the date and timezone from the calendar provided DateTime date = calendar.GetTime(); TimeZoneInfo zone = calendar.GetTimeZone(); // put that date into a calendar the pretty much represents ISO8601 // I use US because it is close to the "locale" for the ISO8601 spec Sharpen.GregorianCalendar intCalendar = (Sharpen.GregorianCalendar)Sharpen.Calendar.GetInstance(CultureInfo.InvariantCulture); intCalendar.SetGregorianChange(Sharpen.Extensions.CreateDate(long.MinValue)); intCalendar.SetTimeZone(zone); intCalendar.SetTime(date); this.year = intCalendar.Get(Sharpen.CalendarEnum.Year); this.month = intCalendar.Get(Sharpen.CalendarEnum.Month) + 1; // cal is from 0..12 this.day = intCalendar.Get(Sharpen.CalendarEnum.DayOfMonth); this.hour = intCalendar.Get(Sharpen.CalendarEnum.HourOfDay); this.minute = intCalendar.Get(Sharpen.CalendarEnum.Minute); this.second = intCalendar.Get(Sharpen.CalendarEnum.Second); this.nanoSeconds = intCalendar.Get(Sharpen.CalendarEnum.Millisecond) * 1000000; this.timeZone = intCalendar.GetTimeZone(); // object contains all date components hasDate = hasTime = hasTimeZone = true; }
/// <summary>Handles the Click event of the Process button which crops the main image and applies the filter stack to generate the output image.</summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> private void cmdProcess_Click(object sender, EventArgs e) { if (!_placed) { return; } if (pcFullImage.Image == null) { return; } Bitmap b = new Bitmap(pbSource.Width, pbSource.Height); Graphics g = Graphics.FromImage(b); g.Clear(Color.White); g.DrawImage(pcFullImage.Image, new Rectangle(0, 0, pbSource.Width, pbSource.Height), _selection.X, _selection.Y, _selection.Width, _selection.Height, GraphicsUnit.Pixel); g.Dispose(); pbSource.Image = b; if (filterStack.Count != 0) { b = filterStack.Apply(b); } var sc = new SaturationCorrection(); if (sc.FormatTranslations.ContainsKey(b.PixelFormat)) { sc.AdjustValue = hsbSaturation.Value / 100.0f; // apply the filter sc.ApplyInPlace(b); } Bitmap greyb = null; if (AForge.Imaging.Filters.Grayscale.CommonAlgorithms.BT709.FormatTranslations.ContainsKey(b.PixelFormat)) { greyb = AForge.Imaging.Filters.Grayscale.CommonAlgorithms.BT709.Apply(b); } else { this.Text = "Cannot convert to greyscale"; greyb = b; } var bc = new BrightnessCorrection(); if (bc.FormatTranslations.ContainsKey(b.PixelFormat)) { bc.AdjustValue = hsbBrightness.Value; bc.ApplyInPlace(greyb); } var cc = new ContrastCorrection(); if (cc.FormatTranslations.ContainsKey(b.PixelFormat)) { cc.Factor = hsbContrast.Value; cc.ApplyInPlace(greyb); } if (filterStack.Count == 0) { var sharpen = new Sharpen(); if (sharpen.FormatTranslations.ContainsKey(b.PixelFormat)) { sharpen.ApplyInPlace(greyb); } } if (chkInvert.Checked) { var invert = new Invert(); invert.ApplyInPlace(greyb); } pbInt.Image = greyb; b = greyb; //BaseInPlacePartialFilter filter = new AForge.Imaging.Filters.FloydSteinbergDithering(); BaseInPlacePartialFilter filter = null; if (cmbAlgorithm.SelectedItem != null && cmbAlgorithm.SelectedItem is AForge.Imaging.Filters.BaseInPlacePartialFilter) { filter = cmbAlgorithm.SelectedItem as AForge.Imaging.Filters.BaseInPlacePartialFilter; } if (filter == null) { filter = new AForge.Imaging.Filters.SierraDithering(); } if (filter.FormatTranslations.ContainsKey(b.PixelFormat)) { var ditheredb = filter.Apply(b); pbDest.Image = ditheredb; this.Text = "Badger!"; } else { this.Text = "Cannot dither this image!"; } }
/// <exception cref="System.IO.IOException"></exception> public NetworkSocketBase(Sharpen.Net.Socket socket) : this(socket, null) { }
public static Bitmap FilterImage(Bitmap img, int filter) { Bitmap sourceImage = img; sourceImage = ImageUtil.convert(sourceImage, System.Drawing.Imaging.PixelFormat.Format32bppArgb); IFilter myFilter; Bitmap filteredImage = sourceImage; if (filter == Filters.filters["Greyscale"]) { sourceImage = Grayscale.CommonAlgorithms.RMY.Apply(sourceImage); filteredImage = sourceImage; } else if (filter == Filters.filters["Sepia"]) { myFilter = new Sepia(); filteredImage = myFilter.Apply(sourceImage); } else if (filter == Filters.filters["Invert"]) { sourceImage = ImageUtil.convert(sourceImage, System.Drawing.Imaging.PixelFormat.Format24bppRgb); myFilter = new Invert(); filteredImage = myFilter.Apply(sourceImage); } else if (filter == Filters.filters["RotateChannel"]) { myFilter = new RotateChannels(); filteredImage = myFilter.Apply(sourceImage); } else if (filter == Filters.filters["Threshold"]) { sourceImage = Grayscale.CommonAlgorithms.RMY.Apply(sourceImage); myFilter = new Threshold(); filteredImage = myFilter.Apply(sourceImage); } else if (filter == Filters.filters["FloydFilter"]) { FloydSteinbergColorDithering myReduction = new FloydSteinbergColorDithering(); filteredImage = myReduction.Apply(sourceImage); } else if (filter == Filters.filters["OrderedDithering"]) { sourceImage = Grayscale.CommonAlgorithms.RMY.Apply(sourceImage); myFilter = new OrderedDithering(); filteredImage = myFilter.Apply(sourceImage); } else if (filter == Filters.filters["Sharpen"]) { myFilter = new Sharpen(); filteredImage = myFilter.Apply(sourceImage); } else if (filter == Filters.filters["DifferenceEdgeDetector"]) { sourceImage = Grayscale.CommonAlgorithms.RMY.Apply(sourceImage); myFilter = new DifferenceEdgeDetector(); filteredImage = myFilter.Apply(sourceImage); } else if (filter == Filters.filters["HomogenityEdgeDetector"]) { sourceImage = Grayscale.CommonAlgorithms.RMY.Apply(sourceImage); myFilter = new HomogenityEdgeDetector(); filteredImage = myFilter.Apply(sourceImage); } else if (filter == Filters.filters["Sobel"]) { sourceImage = Grayscale.CommonAlgorithms.RMY.Apply(sourceImage); myFilter = new SobelEdgeDetector(); filteredImage = myFilter.Apply(sourceImage); } else if (filter == Filters.filters["Jitter"]) { myFilter = new Jitter(); //Needs Expand filteredImage = myFilter.Apply(sourceImage); } else if (filter == Filters.filters["OilPainting"]) { sourceImage = ImageUtil.convert(sourceImage, System.Drawing.Imaging.PixelFormat.Format24bppRgb); myFilter = new OilPainting(); //Needs Expand filteredImage = myFilter.Apply(sourceImage); } else if (filter == Filters.filters["TextureFiltering"]) { sourceImage = ImageUtil.convert(sourceImage, System.Drawing.Imaging.PixelFormat.Format24bppRgb); myFilter = new Texturer(new TextileTexture(), 1.0, 0.8); //Needs Expand filteredImage = myFilter.Apply(sourceImage); } else if (filter == Filters.filters["Median"]) { sourceImage = ImageUtil.convert(sourceImage, System.Drawing.Imaging.PixelFormat.Format24bppRgb); myFilter = new Median(); filteredImage = myFilter.Apply(sourceImage); } else if (filter == Filters.filters["Mean"]) { myFilter = new Mean(); filteredImage = myFilter.Apply(sourceImage); } else if (filter == Filters.filters["Blur"]) { myFilter = new GaussianBlur(); filteredImage = myFilter.Apply(sourceImage); } //Console.Write(filteredImage.PixelFormat.ToString()); //Console.Write(sourceImage.PixelFormat.ToString()); filteredImage = ImageUtil.convert(filteredImage, System.Drawing.Imaging.PixelFormat.Format32bppArgb); return(filteredImage); }
/// <exception cref="System.IO.IOException"/> public override int writeBinary(com.fasterxml.jackson.core.Base64Variant b64variant , Sharpen.InputStream data, int dataLength) { // Let's implement this as "unsupported" to make it easier to add new parser impls _reportUnsupportedOperation(); return 0; }
/// <seealso cref="Com.Adobe.Xmp.XMPMeta.SetPropertyCalendar(string, string, Sharpen.Calendar)"/> /// <exception cref="Com.Adobe.Xmp.XMPException"/> public virtual void SetPropertyCalendar(string schemaNS, string propName, Sharpen.Calendar propValue) { SetProperty(schemaNS, propName, propValue, null); }
private void sharpenToolStripMenuItem_Click(object sender, EventArgs e) { islem = new Sharpen().Apply(kaynak); islemBox.Image = islem; }
/// <summary> /// Sharpen algorithm. Here we create a new window from where we implement the algorithm. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void sharpen_Click(object sender, RoutedEventArgs e) { if (m_data.M_inputFilename == string.Empty || m_data.M_bitmap == null) { MessageBox.Show("Open image first!", "ArgumentsNull", MessageBoxButton.OK, MessageBoxImage.Error); return; } try { Sharpen sharpenWindow = new Sharpen(m_data, m_vm); sharpenWindow.Owner = this; sharpenWindow.Show(); } catch (FileNotFoundException ex) { MessageBox.Show(ex.Message, "FileNotFoundException", MessageBoxButton.OK, MessageBoxImage.Error); } catch (ArgumentException ex) { MessageBox.Show(ex.Message, "ArgumentException", MessageBoxButton.OK, MessageBoxImage.Error); } catch (InvalidOperationException ex) { MessageBox.Show(ex.Message, "InvalidOperationException", MessageBoxButton.OK, MessageBoxImage.Error); } catch (IndexOutOfRangeException ex) { MessageBox.Show(ex.Message, "IndexOutOfRangeException", MessageBoxButton.OK, MessageBoxImage.Error); } catch (Exception ex) { MessageBox.Show(ex.Message, "Exception", MessageBoxButton.OK, MessageBoxImage.Error); } }
public Db4oLibraryEnvironmentProvider(Sharpen.IO.File classPath) { _classPath = classPath; }
/// <exception cref="System.IO.IOException"/> public override int readBinaryValue(com.fasterxml.jackson.core.Base64Variant b64variant , Sharpen.OutputStream @out) { return delegate_.readBinaryValue(b64variant, @out); }
/// <exception cref="System.IO.IOException"/> protected internal virtual int _readBinary(com.fasterxml.jackson.core.Base64Variant b64variant, Sharpen.OutputStream @out, byte[] buffer) { int outputPtr = 0; int outputEnd = buffer.Length - 3; int outputCount = 0; while (true) { // first, we'll skip preceding white space, if any int ch; do { if (_inputPtr >= _inputEnd) { loadMoreGuaranteed(); } ch = (int)_inputBuffer[_inputPtr++] & unchecked((int)(0xFF)); } while (ch <= INT_SPACE); int bits = b64variant.decodeBase64Char(ch); if (bits < 0) { // reached the end, fair and square? if (ch == INT_QUOTE) { break; } bits = _decodeBase64Escape(b64variant, ch, 0); if (bits < 0) { // white space to skip continue; } } // enough room? If not, flush if (outputPtr > outputEnd) { outputCount += outputPtr; @out.write(buffer, 0, outputPtr); outputPtr = 0; } int decodedData = bits; // then second base64 char; can't get padding yet, nor ws if (_inputPtr >= _inputEnd) { loadMoreGuaranteed(); } ch = _inputBuffer[_inputPtr++] & unchecked((int)(0xFF)); bits = b64variant.decodeBase64Char(ch); if (bits < 0) { bits = _decodeBase64Escape(b64variant, ch, 1); } decodedData = (decodedData << 6) | bits; // third base64 char; can be padding, but not ws if (_inputPtr >= _inputEnd) { loadMoreGuaranteed(); } ch = _inputBuffer[_inputPtr++] & unchecked((int)(0xFF)); bits = b64variant.decodeBase64Char(ch); // First branch: can get padding (-> 1 byte) if (bits < 0) { if (bits != com.fasterxml.jackson.core.Base64Variant.BASE64_VALUE_PADDING) { // as per [JACKSON-631], could also just be 'missing' padding if (ch == '"' && !b64variant.usesPadding()) { decodedData >>= 4; buffer[outputPtr++] = unchecked((byte)decodedData); break; } bits = _decodeBase64Escape(b64variant, ch, 2); } if (bits == com.fasterxml.jackson.core.Base64Variant.BASE64_VALUE_PADDING) { // Ok, must get padding if (_inputPtr >= _inputEnd) { loadMoreGuaranteed(); } ch = _inputBuffer[_inputPtr++] & unchecked((int)(0xFF)); if (!b64variant.usesPaddingChar(ch)) { throw reportInvalidBase64Char(b64variant, ch, 3, "expected padding character '" + b64variant.getPaddingChar() + "'"); } // Got 12 bits, only need 8, need to shift decodedData >>= 4; buffer[outputPtr++] = unchecked((byte)decodedData); continue; } } // Nope, 2 or 3 bytes decodedData = (decodedData << 6) | bits; // fourth and last base64 char; can be padding, but not ws if (_inputPtr >= _inputEnd) { loadMoreGuaranteed(); } ch = _inputBuffer[_inputPtr++] & unchecked((int)(0xFF)); bits = b64variant.decodeBase64Char(ch); if (bits < 0) { if (bits != com.fasterxml.jackson.core.Base64Variant.BASE64_VALUE_PADDING) { // as per [JACKSON-631], could also just be 'missing' padding if (ch == '"' && !b64variant.usesPadding()) { decodedData >>= 2; buffer[outputPtr++] = unchecked((byte)(decodedData >> 8)); buffer[outputPtr++] = unchecked((byte)decodedData); break; } bits = _decodeBase64Escape(b64variant, ch, 3); } if (bits == com.fasterxml.jackson.core.Base64Variant.BASE64_VALUE_PADDING) { /* With padding we only get 2 bytes; but we have * to shift it a bit so it is identical to triplet * case with partial output. * 3 chars gives 3x6 == 18 bits, of which 2 are * dummies, need to discard: */ decodedData >>= 2; buffer[outputPtr++] = unchecked((byte)(decodedData >> 8)); buffer[outputPtr++] = unchecked((byte)decodedData); continue; } } // otherwise, our triplet is now complete decodedData = (decodedData << 6) | bits; buffer[outputPtr++] = unchecked((byte)(decodedData >> 16)); buffer[outputPtr++] = unchecked((byte)(decodedData >> 8)); buffer[outputPtr++] = unchecked((byte)decodedData); } _tokenIncomplete = false; if (outputPtr > 0) { outputCount += outputPtr; @out.write(buffer, 0, outputPtr); } return outputCount; }
/* /********************************************************** /* Overrides for life-cycle /********************************************************** */ /// <exception cref="System.IO.IOException"/> public override int releaseBuffered(Sharpen.OutputStream @out) { int count = _inputEnd - _inputPtr; if (count < 1) { return 0; } // let's just advance ptr to end int origPtr = _inputPtr; @out.write(_inputBuffer, origPtr, count); return count; }
/// <exception cref="System.IO.IOException"/> public override int readBinaryValue(com.fasterxml.jackson.core.Base64Variant b64variant , Sharpen.OutputStream @out) { // if we have already read the token, just use whatever we may have if (!_tokenIncomplete || _currToken != com.fasterxml.jackson.core.JsonToken.VALUE_STRING) { byte[] b = getBinaryValue(b64variant); @out.write(b); return b.Length; } // otherwise do "real" incremental parsing... byte[] buf = _ioContext.allocBase64Buffer(); try { return _readBinary(b64variant, @out, buf); } finally { _ioContext.releaseBase64Buffer(buf); } }
protected virtual IOperation CreateOperationFromEditor(Vector3 worldPosition, TerrainToolEditor editor) { return(Sharpen.CreateFromUnityWorld(editor.Terrain, worldPosition, Radius, Math.Max(1.0, Radius / SamplingAccuracy))); }
/// <seealso cref="Com.Adobe.Xmp.XMPMeta.SetPropertyCalendar(string, string, Sharpen.Calendar, Com.Adobe.Xmp.Options.PropertyOptions)"/> /// <exception cref="Com.Adobe.Xmp.XMPException"/> public virtual void SetPropertyCalendar(string schemaNS, string propName, Sharpen.Calendar propValue, PropertyOptions options) { SetProperty(schemaNS, propName, propValue, options); }
// EMPTY /// <summary>Creates an <code>XMPDateTime</code> from a <code>Calendar</code>-object.</summary> /// <param name="calendar">a <code>Calendar</code>-object.</param> /// <returns>An <code>XMPDateTime</code>-object.</returns> public static XMPDateTime CreateFromCalendar(Sharpen.Calendar calendar) { return new XMPDateTimeImpl(calendar); }
public static Bitmap Sharpen(Bitmap sourceImage) { var filter = new Sharpen(); return(filter.Apply(sourceImage)); }
/// <exception cref="System.IO.IOException"></exception> public NetworkSocket(Sharpen.Net.Socket socket) : base(socket) { }
/// <exception cref="System.IO.IOException"/> public override int writeBinary(com.fasterxml.jackson.core.Base64Variant b64variant , Sharpen.InputStream data, int dataLength) { return delegate_.writeBinary(b64variant, data, dataLength); }
public virtual void Set(Sharpen.Util.ISet set) { this.set = set; }
internal virtual void SetThread(Sharpen.Thread thread) { this.thread = thread; this.reply = -1; }
/// <summary> /// This is the method that actually does the work. /// </summary> /// <param name="DA">The DA object can be used to retrieve data from input parameters and /// to store data in output parameters.</param> protected override void SolveInstance(IGH_DataAccess DA) { Bitmap sourceImage = null; DA.GetData(0, ref sourceImage); string filter = ""; DA.GetData(1, ref filter); sourceImage = ImageUtilities.convert(sourceImage, System.Drawing.Imaging.PixelFormat.Format32bppArgb); IFilter myFilter; Bitmap filteredImage = sourceImage; //Grayscale.CommonAlgorithms.Y.Apply switch (filter) { case "Greyscale": Console.Write("Applying: " + filter); sourceImage = Grayscale.CommonAlgorithms.RMY.Apply(sourceImage); filteredImage = sourceImage; break; case "Sepia": Console.Write("Applying: " + filter); myFilter = new Sepia(); filteredImage = myFilter.Apply(sourceImage); break; case "Invert": Console.Write("Applying: " + filter); sourceImage = ImageUtilities.convert(sourceImage, System.Drawing.Imaging.PixelFormat.Format24bppRgb); myFilter = new Invert(); filteredImage = myFilter.Apply(sourceImage); break; case "RotateChannel": Console.Write("Applying: " + filter); myFilter = new RotateChannels(); filteredImage = myFilter.Apply(sourceImage); break; case "Threshold": //Need Extended Version Console.Write("Applying: " + filter); sourceImage = Grayscale.CommonAlgorithms.RMY.Apply(sourceImage); myFilter = new Threshold(); filteredImage = myFilter.Apply(sourceImage); break; case "FloydFilter": Console.Write("Applying: " + filter); //sourceImage = Grayscale.CommonAlgorithms.RMY.Apply(sourceImage); //myFilter = new FloydSteinbergColorDithering(); FloydSteinbergColorDithering myReduction = new FloydSteinbergColorDithering(); filteredImage = myReduction.Apply(sourceImage); //filteredImage = myFilter.Apply(sourceImage); break; case "OrderedDithering": Console.Write("Applying: " + filter); sourceImage = Grayscale.CommonAlgorithms.RMY.Apply(sourceImage); myFilter = new OrderedDithering(); filteredImage = myFilter.Apply(sourceImage); break; case "Sharpen": Console.Write("Applying: " + filter); myFilter = new Sharpen(); filteredImage = myFilter.Apply(sourceImage); break; case "DifferenceEdgeDetector": Console.Write("Applying: " + filter); sourceImage = Grayscale.CommonAlgorithms.RMY.Apply(sourceImage); myFilter = new DifferenceEdgeDetector(); filteredImage = myFilter.Apply(sourceImage); break; case "HomogenityEdgeDetector": Console.Write("Applying: " + filter); sourceImage = Grayscale.CommonAlgorithms.RMY.Apply(sourceImage); myFilter = new HomogenityEdgeDetector(); filteredImage = myFilter.Apply(sourceImage); break; case "Sobel": Console.Write("Applying: " + filter); sourceImage = Grayscale.CommonAlgorithms.RMY.Apply(sourceImage); myFilter = new SobelEdgeDetector(); filteredImage = myFilter.Apply(sourceImage); break; case "Jitter": Console.Write("Applying: " + filter); myFilter = new Jitter(); //Needs Expand filteredImage = myFilter.Apply(sourceImage); break; case "OilPainting": Console.Write("Applying: " + filter); myFilter = new OilPainting(); //Needs Expand filteredImage = myFilter.Apply(sourceImage); break; case "TextureFiltering": Console.Write("Applying: " + filter); sourceImage = ImageUtilities.convert(sourceImage, System.Drawing.Imaging.PixelFormat.Format24bppRgb); myFilter = new Texturer(new TextileTexture(), 1.0, 0.8); //Needs Expand filteredImage = myFilter.Apply(sourceImage); break; case "Median": Console.Write("Applying: " + filter); myFilter = new Median(); filteredImage = myFilter.Apply(sourceImage); break; case "Mean": Console.Write("Applying: " + filter); myFilter = new Mean(); filteredImage = myFilter.Apply(sourceImage); break; case "Blur": //Need Extended Version Console.Write("Applying: " + filter); myFilter = new GaussianBlur(); filteredImage = myFilter.Apply(sourceImage); break; default: Console.Write("No Filter"); break; } Console.Write(filteredImage.PixelFormat.ToString()); Console.Write(sourceImage.PixelFormat.ToString()); filteredImage = ImageUtilities.convert(filteredImage, System.Drawing.Imaging.PixelFormat.Format32bppArgb); DA.SetData(0, filteredImage); }
public static bool IsConnected(Sharpen.Net.Socket socket) { if (socket == null) { return false; } return socket.IsConnected(); }
public mSharpenSimple() { BitmapType = BitmapTypes.None; filter = new Sharpen(); }