public void LoadHeightMap() { int x, y; string FilePath = Path.Combine(Folder, "offset.png"); if (File.Exists(FilePath)) { using (Bitmap Map = new Bitmap(FilePath)) { HeightMapOffset = new System.Drawing.Color[Map.Width, Map.Height]; for (x = 0; x < Map.Width; ++x) { for (y = 0; y < Map.Height; ++y) { HeightMapOffset[x, y] = Map.GetPixel(x, y); } } } FilePath = Path.Combine(Folder, "terrain.png"); using (Bitmap Map = new Bitmap(FilePath)) { HeightMapTerrain = new System.Drawing.Color[Map.Width, Map.Height]; for (x = 0; x < Map.Width; ++x) { for (y = 0; y < Map.Height; ++y) { HeightMapTerrain[x, y] = Map.GetPixel(x, y); } } } } }
private void button1_Click(object sender, EventArgs e) { dropDown(); setActivation(); n = new NeuralNetwork((int)Math.Sqrt(100), 10, 0.1, act); if (openFileDialog1.ShowDialog() == DialogResult.OK) { path = openFileDialog1.FileName; } n.ReadDataFromFile(path); bcVisualization.Matrix = null; n.Normalize = true; n.StartLearning(); System.Drawing.Color[,] colorMatrix = null; colorMatrix = n.ColorSOFM(); bcVisualization.Matrix = colorMatrix; bcVisualization.Invalidate(); AddLegend(); n.Normalize = true; length = n.Patterns.Count; }
/// <summary> /// 타일 리스트 세팅 /// </summary> public void SetTileList(string sResourcePath) { // sResourcePath = @"C:\Users\wjkim\Source\Repos\Serenade\Serenade\Resource\Residential.png"; SplitImage splitImage = new SplitImage(); Bitmap resource = new Bitmap(sResourcePath); System.Drawing.Color[,] color = splitImage.GetBitmapPixel(resource); List <Bitmap> resourceSplit = splitImage.GetDivisionBitmap(color, 16, 16); WrapPanel wpTileGroup = new WrapPanel(); wpTileGroup.Orientation = Orientation.Horizontal; wpTileGroup.Width = color.GetLength(0); wpTileGroup.Height = color.GetLength(1); wpTileGroup.Margin = new Thickness(5); for (int i = 0; i < resourceSplit.Count; i++) { //// 임시 전체 색상 적용 //Color testColor = Color.FromRgb(0, 100, byte.Parse(20.ToString())); //UcTile ucTile = new UcTile(); //ucTile.LbName = testColor.ToString(); //ucTile.ColorTileImage = testColor; //ucTile.IsTileType = false; //wpTileList.Children.Add(ucTile); UcTile ucTile = new UcTile(); ucTile.BitmapTileImage = resourceSplit[i]; wpTileGroup.Children.Add(ucTile); } wpTileList.Children.Add(wpTileGroup); }
public void CreateWorld() { level = LoadLevel(); for (int x = 0; x < tiles.GetLength(0); x++) { for (int y = 0; y < tiles.GetLength(1); y++) { Tile newTile = Tiles.GetTile(level[x, y]); newTile.position.X = x; newTile.position.Y = y; tiles[x, y] = newTile; } } character = new Entity(Tiles.GetTile(2).spriteLocation, new Vector2(), 0, tiles[1, 1]); character1 = new Entity(Tiles.GetTile(2).spriteLocation, new Vector2(), 0, tiles[1, 10]); character2 = new Entity(Tiles.GetTile(2).spriteLocation, new Vector2(), 0, tiles[24, 4]); character3 = new Entity(Tiles.GetTile(2).spriteLocation, new Vector2(), 0, tiles[6, 6]); character4 = new Entity(Tiles.GetTile(2).spriteLocation, new Vector2(), 0, tiles[10, 10]); character.destinationTile = tiles[51, 3]; character1.destinationTile = tiles[51, 3]; character2.destinationTile = tiles[51, 3]; character3.destinationTile = tiles[51, 3]; character4.destinationTile = tiles[51, 3]; buttonBuild = GUIButtons.GetButton(0); buttonBuild.X = 0; buttonBuild.Y = 0; }
/// <summary> /// 입력받은 Color Array에서 지정된 넓이, 높이, 위치 만큼 가로로 분할하여 비트맵을 반환한다. /// </summary> public List <Bitmap> GetDivisionBitmap(System.Drawing.Color[,] pixel, int width, int height) { List <Bitmap> arrBitmap = new List <Bitmap>(); // 세로 타일 수 for (int j = 0; j < pixel.GetLength(1) / height; j++) { // 가로 타일 수 for (int i = 0; i < pixel.GetLength(0) / width; i++) { Bitmap bitmap = new Bitmap(width, height); // 타일 하나 만들기 for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { int left = x + width * i; int top = y + height * j; bitmap.SetPixel(x, y, pixel[left, top]); } } // 만든거 담기 arrBitmap.Add(bitmap); } } return(arrBitmap); }
private System.Drawing.Color[,] GetColors(Color32[] colors, int width, int height) { System.Drawing.Color[,] res = null; if (colors != null && colors.Length == width * height) { res = new System.Drawing.Color[width, height]; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { Color32 color32 = colors[i + width * j]; res[i, height - j - 1] = System.Drawing.Color.FromArgb(color32.a, color32.r, color32.g, color32.b); } } } else { Debug.LogError("Colors input wrong"); } return(res); }
private static void WriteImage(DefineBitsLossless2Tag image, string path) { if (File.Exists(path)) { return; } System.Drawing.Color[,] table = image.GetARGBMap(); int width = table.GetLength(0); int height = table.GetLength(1); using (var payload = new Image <Rgba32>(width, height)) { for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { System.Drawing.Color pixel = table[x, y]; payload[x, y] = new Rgba32(pixel.R, pixel.G, pixel.B, pixel.A); } } using (var output = new StreamWriter(path)) { payload.SaveAsPng(output.BaseStream); } } }
private void InitTexture() { textureArray = new System.Drawing.Color[imgWidth, imgHeight]; for (int i = 0; i < imgWidth; i++) { for (int j = 0; j < imgHeight; j++) { textureArray[i, j] = texture.GetPixel(i, j); } } }
private void predictButton_Click(object sender, EventArgs e) { dropDown(); setActivation(); string sourceFile = "", destinationFile = @"D:\Adrian-Andrin\Documents\School\Intelligent System 2\SOFM\SelfOrganizingMap\sampletest.txt"; if (path != null) { try { File.Copy(path, destinationFile, true); } catch (IOException iox) { Console.WriteLine(iox.Message); } path = destinationFile; string testfile = ""; MessageBox.Show("Load Test Data"); if (openFileDialog1.ShowDialog() == DialogResult.OK) { openFileDialog1.Title = "Load Test Data"; testfile = openFileDialog1.FileName; } string contents = File.ReadAllText(testfile); File.AppendAllText(path, contents + "Un-Identified"); n.ExistentClasses.Clear(); n = new NeuralNetwork((int)Math.Sqrt(100), 10, 0.1, act); n.ReadDataFromFile(path); bcVisualization.Matrix = null; n.Normalize = true; n.StartLearning(); System.Drawing.Color[,] colorMatrix = null; colorMatrix = n.ColorSOFM(); bcVisualization.Matrix = colorMatrix; bcVisualization.Invalidate(); AddLegend(); n.Normalize = true; length = n.Patterns.Count; //File.Delete(destinationFile); } else { MessageBox.Show("LOAD DATA SET FIRST"); } }
public static Bitmap FromColorsMatrix(System.Drawing.Color[,] colors) { var bitmap = new Bitmap(colors.GetLength(1), colors.GetLength(0)); for (int y = 0; y < bitmap.Height; y++) { for (int x = 0; x < bitmap.Width; x++) { bitmap.SetPixel(x, y, colors[y, x]); } } return(bitmap); }
// The constructor uses SixLabors ImageSharp to read the image file. // The Image< Rgba32 > acts like an array of pixels indexed by column and row. // Each pixel is stored in an Rgba32 object. // Representation is a 2D array of pixels indexed by row and column. // Each pixel is stored in a Color object. public Retina(string path) { using Image <Rgba32> img6L = Image.Load <Rgba32>(path); Pixels = new SD.Color[img6L.Height, img6L.Width]; for (int row = 0; row < Pixels.GetLength(0); row++) { for (int col = 0; col < Pixels.GetLength(1); col++) { int x = col; int y = row; Rgba32 p = img6L[x, y]; SD.Color c = SD.Color.FromArgb(p.A, p.R, p.G, p.B); Pixels[row, col] = c; } } }
public BitmapHelper(string path) { Bitmap bitmap; try { bitmap = (Bitmap)Image.FromFile(path); } catch (Exception) { bitmap = new Bitmap(10, 10); for (int i = 0; i < 10; i++) { for (int w = 0; w < 10; w++) { bitmap.SetPixel(i, w, System.Drawing.Color.White); } } } var bmpData = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); IntPtr ptr = bmpData.Scan0; int bytes = Math.Abs(bmpData.Stride) * bitmap.Height; byte[] rgbValues = new byte[bytes]; System.Runtime.InteropServices.Marshal.Copy(ptr, rgbValues, 0, bytes); colors = new System.Drawing.Color[bitmap.Width, bitmap.Height]; for (int counter = 0; counter < rgbValues.Length; counter += 4) { int i_am = counter / 4; colors[i_am % bitmap.Width, i_am / bitmap.Width] = System.Drawing.Color.FromArgb( rgbValues[counter + 3], rgbValues[counter + 2], rgbValues[counter + 1], rgbValues[counter + 0]); } bitmap.UnlockBits(bmpData); bitmap.Dispose(); }
private void RayTracerForm_Load(object sender, EventArgs e) { this.Show(); Stopwatch sw = Stopwatch.StartNew(); System.Drawing.Color[,] pixels = FixedTracer.RayTracer.RenderDefaultScene(width, height, 16); //System.Drawing.Color[,] pixels = DoubleTracer.RayTracer.RenderDefaultScene(width, height); sw.Stop(); Console.WriteLine("Elapsed: {0:0.00}s", sw.Elapsed.TotalSeconds); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { bitmap.SetPixel(x, y, pixels[x, y]); } } pictureBox.Refresh(); pictureBox.Invalidate(); }
private void init(Bitmap bitmap) { var bmpData = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb); IntPtr ptr = bmpData.Scan0; int bytes = Math.Abs(bmpData.Stride) * bitmap.Height; byte[] rgbValues = new byte[bytes]; System.Runtime.InteropServices.Marshal.Copy(ptr, rgbValues, 0, bytes); colors = new System.Drawing.Color[bitmap.Width, bitmap.Height]; for (int counter = 0; counter < rgbValues.Length; counter += 4) { int i_am = counter / 4; colors[i_am % bitmap.Width, i_am / bitmap.Width] = System.Drawing.Color.FromArgb( rgbValues[counter + 3], rgbValues[counter + 2], rgbValues[counter + 1], rgbValues[counter + 0]); } bitmap.UnlockBits(bmpData); bitmap.Dispose(); }
private void OnGUI() { if (!_initDone) { return; } GUILayout.BeginVertical(); _camId = GUILayout.TextField(_camId); if (GUILayout.Button("打开摄像头")) { int camId = 0; int.TryParse(_camId, out camId); _camera = JMCameraManager.Instance.GetCamera(camId); _img.texture = _camera.CameraTexture; if (_camera != null) { _camera.Open((int)_img.rectTransform.rect.width, (int)_img.rectTransform.rect.height); Debug.Log(_camera); } } if (GUILayout.Button("关闭摄像头")) { if (_camera != null) { _camera.Close(); } } if (GUILayout.Button("重连摄像头")) { if (_camera != null) { _camera.ReConnect((int)_img.rectTransform.rect.width, (int)_img.rectTransform.rect.height); } } if (GUILayout.Button("拍照")) { if (_camera != null) { _camera.Snapshot((Color32[] colors) => { System.Drawing.Color[,] resColors = GetColors(colors, (int)_img.rectTransform.rect.width, (int)_img.rectTransform.rect.height); System.Threading.ThreadPool.QueueUserWorkItem((state) => { System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); JMColorsHandler handler = new JMColorsHandler(resColors); handler.Effect(JMImageEffect.Relief, System.Drawing.Imaging.ImageFormat.Png, (datas) => { Loom.QueueOnMainThread(() => { SetTexture(datas); }); }); sw.Stop(); Debug.Log(sw.ElapsedMilliseconds); }); }); } } GUILayout.EndVertical(); }
public IEnumerable <int> Xeq(RunTime context) { this.context = context; //if (mode == 1) // appear one row @ a time - left to right //{ // int intr = (EndPoint.X - StartPoint.X) / 20; // for (int row = 0; row < 9; row++) // { // for (int col = 0; col < 11; col++) // context[bgnndx[row, col]] = bmi.Colors[bmi.Indices[row, col]]; // yield return StartPoint.X + intr * (row + 1); // } //} //else if (mode == 2 || mode == 4) // 2 = slide in from right and then out to left, 4 - slide in from right & stop //{ // for (int lup = 0; lup < 11; lup+=2) // { // for (int col = 0; col <= lup; col++) // copycol(col, 10 - lup + col); // yield return context.CurTime + 4; // } // if (mode == 2) // { // for (int lup = 2; lup <= 12; lup += 2) // { // int col; // for (col = lup; col < 11 && col - lup < 11; col++) // copycol(col, col - lup); // for (col = 11 - lup; col < 11; col++) // if (col >= 0) // restorecol(col); // yield return context.CurTime + 4; // }; // } // yield break; //} //else if (mode == 3) //{ // int thrds = (EndPoint.X - StartPoint.X) / 3; // int intr = thrds / 10; // for (int row = 0; row < 9; row++) // { // for (int col = 0; col < 11; col++) // context[bgnndx[row, col]] = bmi.Colors[bmi.Indices[row, col]]; // yield return context.CurTime + intr; // } // yield return StartPoint.X + thrds; // int pre = 0; // int nxt = 11; // int starttime = context.CurTime; // int endtime = context.CurTime + thrds; // while (context.CurTime < endtime) // { // float fraction = 2 * (context.CurTime - starttime) / (float)thrds; // if (fraction > 1) break; // for (int row = 0; row < 9; row++) // { // for (int col = 0; col < 11; col++) // context[bgnndx[row, col]] = factor(bmi.Colors[bmi.Indices[row, col + pre]], bmi.Colors[bmi.Indices[row, col + nxt]], fraction); // } // yield return context.CurTime + 4; // } // yield return endtime; // pre = 11; // nxt = 22; // starttime = context.CurTime; // endtime = EndPoint.X; // while (context.CurTime < endtime) // { // float fraction = 2 * (context.CurTime - starttime) / (float)thrds; // if (fraction > 1) break; // for (int row = 0; row < 9; row++) // { // for (int col = 0; col < 11; col++) // context[bgnndx[row, col]] = factor(bmi.Colors[bmi.Indices[row, col + pre]], bmi.Colors[bmi.Indices[row, col + nxt]], fraction); // } // yield return context.CurTime + 4; // } //} bool first = true; foreach (var tran in Transition.Transitions) { if (tran is StepTransition_Position) { if (first) { first = false; bgnndx = new int[9, 11]; int ndx = 0; foreach (var itm in Global.Instance.LitDict.Values.OfType <Lit>() .Where(v => regex.IsMatch(v.Name)) .OrderByDescending(v => v.Row).ThenBy(v => v.Column)) { bgnndx[(ndx / 11), (ndx++ % 11)] = itm.GlobalIndex; } before = new SD.Color[9, 11]; for (int row = 0; row < 9; row++) { for (int col = 0; col < 11; col++) { before[row, col] = context[bgnndx[row, col]]; } } } var poser = (StepTransition_Position)tran; int x = poser.X; int y = poser.Y; int steps = 0; do { for (int col = 0; col < 11; col++) { restorecol(col); } for (int row = 0, srcrow = row - y; row < 9; row++, srcrow++) { if ((srcrow >= 0) && (srcrow < 9)) { for (int col = 0, srccol = col - x; col < 11; col++, srccol++) { if ((srccol >= 0) && (srccol < 11)) { context[bgnndx[row, col]] = bmi.Pixels.Pixels[bmi.Indices[srcrow, srccol]]; } } } } x += poser.XStep; y += poser.YStep; steps++; yield return(context.CurTime + 4); } while (steps <= poser.Steps); } else if (tran is StepTransition_Fade) { var fader = (StepTransition_Fade)tran; switch (fader.Fade) { case 10: { //var fader = (StepTransition_Fade)tran; bgnColor[] initClr = Global.Instance.LitDict.Values.OfType <Lit>() .Where(v => regex.IsMatch(v.Name)) .Select(l => new bgnColor() { clr = context.Colors[l.GlobalIndex], Ndx = l.GlobalIndex }) .ToArray(); float start = this.startTimeMark.Time; float endTime = this.endTimeMark.Time; int fade = 0; do { float fraction; if (start >= endTime) { fraction = 1; } else { fraction = Math.Min((context.CurTime - start) / (endTime - start), 1); } int ndx = 0; foreach (var bgn in initClr) { context[bgn.Ndx] = factor(bgn.clr, this.palet[ndx++], fraction); } fade++; yield return(context.CurTime + 4); } while (context.CurTime < endTime); } break; case 0: { var litx = Global.Instance.LitDict.Values.OfType <Lit>() .Where(v => regex.IsMatch(v.Name)); if (selector != null) { litx = litx.Where(lit => selector(lit)); } if (orderby != null) { litx = litx.OrderBy(lit => orderby(lit)); } bgnColor[] initClr = litx .Select(l => new bgnColor() { clr = context[l.GlobalIndex], Ndx = l.GlobalIndex }) .ToArray(); int ndx = 0; foreach (var bgn in initClr) { context[bgn.Ndx] = this.palet[ndx++]; } } break; case 1: { bgnColor[] initClr = Global.Instance.LitDict.Values.OfType <Lit>() .Where(v => regex.IsMatch(v.Name)) .Select(l => new bgnColor() { clr = context[(int)l.GlobalIndex], Ndx = (int)l.GlobalIndex }) .ToArray(); int ndx = 0; foreach (var bgn in initClr) { context[bgn.Ndx] = this.palet[ndx++]; } yield return(context.CurTime + 4); foreach (var bgn in initClr) { context[bgn.Ndx] = bgn.clr; } } break; } } else if (tran is StepTransition_Linear) { var linear = (StepTransition_Linear)tran; var litx = Global.Instance.LitDict.Values.OfType <Lit>() .Where(v => regex.IsMatch(v.Name)); if (selector != null) { litx = litx.Where(lit => selector(lit)); } if (orderby != null) { litx = litx.OrderBy(lit => orderby(lit)); } int[][] lits; if (groupby != null) { lits = litx.GroupBy(lit => groupby(lit), (key, grp) => grp.Select(lit => lit.GlobalIndex).ToArray()).ToArray(); } else { lits = litx.Select(lit => new int[] { lit.GlobalIndex }).ToArray(); } float start = this.startTimeMark.Time; float endTime = this.endTimeMark.Time; var fade = linear.Fade; var backward = (mode & 1) > 0; var climb = (mode & 2) > 0; var rotate = (mode & 4) > 0; int ndx = 0; int indx = 0; if (rotate) { do { for (ndx = 0; ndx < lits.Count(); ndx++) { foreach (var indy in lits[backward ? lits.Count() - 1 - ndx : ndx]) { context[indy] = this.palet[ndx + indx]; } } indx += (backward) ? lits.Length - 1 : 1; yield return(context.CurTime + 4 * 4); } while (context.CurTime < endTime); } else if (!climb) { do { float fraction; if (start >= endTime) { fraction = 1; } else { fraction = Math.Min((context.CurTime - start) / (endTime - start), 1); } int newptr = (int)Math.Ceiling(lits.Count() * fraction); for (; ndx < newptr; ndx++) { foreach (var indy in lits[backward ? lits.Count() - 1 - ndx : ndx]) { context[indy] = this.palet[indx]; } indx++; } yield return(context.CurTime + 4); } while (context.CurTime < endTime); for (; ndx < lits.Count(); ndx++) { foreach (var indy in lits[backward ? lits.Count() - 1 - ndx : ndx]) { context[indy] = this.palet[indx]; } indx++; } } else { do { float fraction; if (start >= endTime) { fraction = 1; } else { fraction = Math.Min((context.CurTime - start) / (endTime - start), 1); } int newptr = (int)Math.Ceiling((lits.Count() - 1) * fraction); indx = 0; try { for (ndx = newptr; ndx >= 0; ndx--) { foreach (var indy in lits[backward ? lits.Count() - 1 - ndx : ndx]) { context[indy] = this.palet[indx]; } indx++; } } catch (Exception e) { } yield return(context.CurTime + 4); } while (context.CurTime < endTime); indx = 0; for (ndx = lits.Length - 1; ndx >= 0; ndx--) { foreach (var indy in lits[backward ? lits.Count() - 1 - ndx : ndx]) { context[indy] = this.palet[indx]; } indx++; } } } } //yield return EndPoint.X; //for (int row = 0; row < 9; row++) // for (int col = 0; col < 11; col++) // context[bgnndx[row, col]] = System.Drawing.Color.Black; }
public void LoadHeightMap() { int x, y; string FilePath = Path.Combine(Folder, "offset.png"); if (File.Exists(FilePath)) { using (Bitmap Map = new Bitmap(FilePath)) { HeightMapOffset = new System.Drawing.Color[Map.Width, Map.Height]; for (x = 0; x < Map.Width; ++x) { for (y = 0; y < Map.Height; ++y) { HeightMapOffset[x, y] = Map.GetPixel(x, y); } } } FilePath = Path.Combine(Folder, "terrain.png"); using (Bitmap Map = new Bitmap(FilePath)) { HeightMapTerrain = new System.Drawing.Color[Map.Width, Map.Height]; for (x = 0; x < Map.Width; ++x) { for (y = 0; y < Map.Height; ++y) { HeightMapTerrain[x, y] = Map.GetPixel(x, y); } } } } }
public void DetectObjects() { if (ProcessImage == null) { return; // Hasn't applied any filters yet } if (OutputImage != null) { OutputImage.Dispose(); // Reset output image OutputImage = new Bitmap(ProcessImage.Size.Width, ProcessImage.Size.Height); } else { OutputImage = new Bitmap(ProcessImage.Size.Width, ProcessImage.Size.Height); } IsBusy = true; System.Drawing.Color[,] OriginalColors = new System.Drawing.Color[ProcessImage.Size.Width, ProcessImage.Size.Height]; System.Drawing.Color[,] InputColors = new System.Drawing.Color[ProcessImage.Size.Width, ProcessImage.Size.Height]; System.Drawing.Color[,] OutputColors = null; for (int x = 0; x < ProcessImage.Size.Width; x++) { for (int y = 0; y < ProcessImage.Size.Height; y++) { InputColors[x, y] = ProcessImage.GetPixel(x, y); } } for (int x = 0; x < InputImage.Size.Width; x++) { for (int y = 0; y < InputImage.Size.Height; y++) { OriginalColors[x, y] = InputImage.GetPixel(x, y); } } ThreadPool.QueueUserWorkItem(o => { DetectObjects dobj = new DetectObjects(); dobj.detectObjects(InputColors); var listIObj = dobj.getDetectedObjects(); foreach (var iObj in listIObj) { InputColors = iObj.FillObject(InputColors); } dobj = new DetectObjects(); dobj.detectRugbyBalls(InputColors); listIObj = dobj.getDetectedBalls(); OutputColors = dobj.ColorTheBalls(OriginalColors); string message = String.Format("We detected {0} object{1} which consisted of {2} rugby ball{3}", dobj.getDetectedObjects().Count, dobj.getDetectedObjects().Count != 1 ? "s" : "", dobj.getDetectedBalls().Count, dobj.getDetectedBalls().Count != 1 ? "s" : ""); if (dobj.getDetectedBalls().Count > 0) { message += "\nDetected balls can be seen with a red outline."; } MessageBox.Show(message, "Detect rugby balls", MessageBoxButton.OK); /*foreach (var iObj in listIObj) // Should be only balls * { * if (OutputColors == null) * OutputColors = iObj.ColorizeVectors(InputColors); * else * OutputColors = iObj.ColorizeVectors(OutputColors); * }*/ Application.Current.Dispatcher.BeginInvoke(new Action(() => { for (int x = 0; x < InputImage.Size.Width; x++) { for (int y = 0; y < InputImage.Size.Height; y++) { OutputImage.SetPixel(x, y, OutputColors[x, y]); } } NewImage = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap( // Display output image OutputImage.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, BitmapSizeOptions.FromWidthAndHeight(ProcessImage.Size.Width, ProcessImage.Size.Height)); IsBusy = false; })); }); }