public static void Show(ref Image<Bgr, byte> image, string name) { if (!Suppressed) if (viewerDict.ContainsKey(name)) viewerDict[name].Image = image.Resize(2d, Emgu.CV.CvEnum.INTER.CV_INTER_LINEAR); else { viewerDict.Add(name, new ImageViewer(image.Resize(2d, Emgu.CV.CvEnum.INTER.CV_INTER_LINEAR))); viewerDict[name].Show(); } }
static int predict(Image<Gray, Byte> inputImage) { try { int imageSize = 64; Image<Gray, byte> testImage = inputImage.Resize(imageSize, imageSize, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC); testImage._EqualizeHist(); FaceRecognizer.PredictionResult result = faceRecognizer.Predict(testImage); return result.Label; } catch (Exception e) { Console.WriteLine(e.Message); } return -1; }
public async Task<IList<IdScore>> IdentifyAsync(Image<Bgr, Byte> image) { var reducedImage = image.Resize(_settings.IdentifierImageSize, _settings.IdentifierImageSize, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC); var encoded = Convert.ToBase64String(reducedImage.Bytes); encoded = WebUtility.UrlEncode(encoded); var data = "img=" + encoded; using (var wc = new HttpClient()) { try { var json = await wc.PostAsync(_settings.IdentifierUrl, new StringContent(data, new UTF8Encoding(), "application/x-www-form-urlencoded")); var result = JsonConvert.DeserializeObject<List<IdentifyResult>>(await json.Content.ReadAsStringAsync()); return result.Select(ir => new IdScore{Id = ir.result, Score = ir.p}).ToList(); } catch (Exception ex) { Log.Error("Exception calling identifier: ", ex); } } return null; }
private static void Resize(string filePath, Image image, Size newSize) { var dir = Path.GetDirectoryName(filePath); if (dir == null) throw new DirectoryNotFoundException(); var file = Path.GetFileNameWithoutExtension(filePath); var extension = Path.GetExtension(filePath); var newFileName = $"{file}-{newSize.Width:D4}{extension}"; var newPath = Path.Combine(dir, newFileName); if (File.Exists(newPath)) return; Console.WriteLine(newFileName); var resized = image.Resize(newSize.Width, newSize.Height); using (var output = File.OpenWrite(newPath)) { resized.CurrentImageFormat.Encoder.Quality = 256; resized.Save(output); } }
public static async Task<AddedFaceData> InsertFace(Image<Bgr, byte> original, Image<Gray, byte> grayframe, string username) { var size = Properties.Settings.Default.RecognitionImageSize; original = original.Resize(size, size, Inter.Cubic); grayframe = grayframe.Resize(size, size, Inter.Cubic); var userId = await DatabaseHandler.InsertAsync("INSERT INTO users (username) VALUES (@username)", new SQLiteParameter("@username", username)); var faceId = await DatabaseHandler.InsertAsync("INSERT INTO faces (original, grayframe, userID, width, height) VALUES (@original, @grayframe, @userId, @width, @height)", new SQLiteParameter("@original", DbType.Binary) { Value = original.Bytes }, new SQLiteParameter("@grayframe", DbType.Binary) { Value = grayframe.Bytes }, new SQLiteParameter("@userId", userId), new SQLiteParameter("@width", original.Width), new SQLiteParameter("@height", original.Height) ); AllFaces.Add(new Face(original, grayframe, (int)faceId, username, (int)userId)); AllUsers.Add(new User((int)userId, username)); return new AddedFaceData(userId, faceId); }
public async Task Invoke(HttpContext context) { if (!IsImageRequest(context)) { // move to the next request here? await _next.Invoke(context); return; } try { var sb = new StringBuilder(); sb.AppendLine("====================================================================================================="); sb.AppendLine("Date/Time: " + DateTime.UtcNow.ToString("M/d/yyyy hh:mm tt")); int width = 0; int.TryParse(context.Request.Query["width"], out width); int height = 0; int.TryParse(context.Request.Query["height"], out height); var inputPath = _appEnvironment.ApplicationBasePath + "/wwwroot" + context.Request.Path; using (var inputStream = File.OpenRead(inputPath)) { sb.AppendLine("Input Path: " + inputPath); sb.AppendLine("Querystring Dimensions: " + width.ToString() + "x" + height.ToString()); var sw = new Stopwatch(); sw.Start(); var image = new Image(inputStream); if (image.Width > image.Height && width != 0) height = (125 * image.Height) / image.Width; if (image.Height > image.Width && height != 0) width = (125 * image.Width) / image.Height; sw.Stop(); sb.AppendLine("Original Dimensions: " + image.Width.ToString() + "x" + image.Height.ToString()); sb.AppendLine("Output Dimensions: " + width.ToString() + "x" + height.ToString()); sb.AppendLine("Image Read Time in Seconds: " + sw.Elapsed.TotalSeconds.ToString()); // write directly to the body output stream using (var outputStream = new MemoryStream()) { sw.Restart(); image.Resize(width, height) .Save(outputStream); var bytes = outputStream.ToArray(); sw.Stop(); sb.AppendLine("Image Processing Time in Seconds: " + sw.Elapsed.TotalSeconds.ToString()); //context.Response.Body.Write(bytes, 0, bytes.Length); await context.Response.Body.WriteAsync(bytes, 0, bytes.Length); } //// the following approach will write to disk then serve the image ////var inputPath = _appEnvironment.ApplicationBasePath + "/wwwroot" + context.Request.Path; //var outputPath = _appEnvironment.ApplicationBasePath + "/Uploads/" + Path.GetFileName(context.Request.Path); //using (var outputStream = File.OpenWrite(outputPath)) //{ // image.Resize(width, height) // .Save(outputStream); //} //var bytes = File.ReadAllBytes(outputPath); //await context.Response.Body.WriteAsync(bytes, 0, bytes.Length); } //var logFilePath = _appEnvironment.ApplicationBasePath + "/Logs/ThumbnailLog-" + DateTime.UtcNow.ToString("yyyy-MM-dd-hh-mm-ss") + ".txt"; var logFilePath = _appEnvironment.ApplicationBasePath + "/Logs/ThumbnailLog.txt"; var logWriter = new LogWriter(logFilePath); logWriter.Write(sb.ToString()); } catch (Exception ex) { var logFilePath = _appEnvironment.ApplicationBasePath + "/Logs/Exceptions.txt"; var logWriter = new LogWriter(logFilePath); logWriter.WriteLine("====================================================================================================="); logWriter.WriteLine(ex.ToString()); } //await _next.Invoke(context); }
private void btnStudent_Click(object sender, RoutedEventArgs e) { try { //Trained face counter ContTrain = ContTrain + 1; //Get a gray frame from capture device gray = grabber.QueryGrayFrame().Resize(320, 240, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC); //Face Detector MCvAvgComp[][] facesDetected = gray.DetectHaarCascade( face, 1.2, 10, Emgu.CV.CvEnum.HAAR_DETECTION_TYPE.DO_CANNY_PRUNING, new System.Drawing.Size(20, 20)); if (facesDetected == null || facesDetected.Length <= 0) { MessageBox.Show("Not able detect any face, try again"); dispatcherTimer.Start(); } //Action for each element detected foreach (MCvAvgComp f in facesDetected[0]) { t = t + 1; result = currentFrame.Copy(f.rect).Convert<Gray, byte>().Resize(100, 100, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC); //draw the face detected in the 0th (gray) channel with blue color currentFrame.Draw(f.rect, new Bgr(System.Drawing.Color.Red), 2); dispatcherTimer.Stop(); break; } TrainedFace = result.Resize(100, 100, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC); trainingImages.Add(TrainedFace); //labels.Add(textBox1.Text); ImageSourceConverter c = new ImageSourceConverter(); ImageSource srcImage = c.ConvertFrom(TrainedFace.ToBitmap()) as ImageSource; //Show face added in gray scale imageBox1.Source = srcImage; var startupPath = Environment.CurrentDirectory; //Write the number of triained faces in a file text for further load File.WriteAllText(startupPath + "/TrainedFaces/TrainedLabels.txt", trainingImages.ToArray().Length.ToString() + "%"); //Write the labels of triained faces in a file text for further load for (int i = 1; i < trainingImages.ToArray().Length + 1; i++) { trainingImages.ToArray()[i - 1].Save(startupPath + "/TrainedFaces/face" + i + ".bmp"); File.AppendAllText(startupPath + "/TrainedFaces/TrainedLabels.txt", labels.ToArray()[i - 1] + "%"); } // MessageBox.Show(textBox1.Text + "´s face detected and added :)", "Training OK", MessageBoxButton.OK, MessageBoxImage.Information); } catch { MessageBox.Show("Enable the face detection first", "Training Fail", MessageBoxButton.OK, MessageBoxImage.Exclamation); } }
void UIUpdate(bool flag) { try { LeftEyeCoord = "(" + leftEyeCenter.X.ToString() + " , " + leftEyeCenter.Y.ToString() + ")"; RightEyeCoord = "(" + rightEyeCenter.X.ToString() + " , " + rightEyeCenter.Y.ToString() + ")"; LeftRelocationCoord = "(" + leftRelocation.X.ToString() + " , " + leftRelocation.Y.ToString() + ")"; RightRelocationCoord = "(" + rightRelocation.X.ToString() + " , " + rightRelocation.Y.ToString() + ")"; //记录一条新的实验数据 EyeData.EyeExpName = (ExperimentType)Enum.Parse(typeof(ExperimentType), ExpType[CurrentExpIndex]); EyeData.Time = DateTime.Now; EyeData.MilliSecond = DateTime.Now.Millisecond; EyeData.LeftEyeCoordX = leftEyeCenter.X; EyeData.LeftEyeCoordY = leftEyeCenter.Y; EyeData.RightEyeCoordX = rightEyeCenter.X; EyeData.RightEyeCoordY = rightEyeCenter.Y; EyeData.LeftRelocationCoordX = leftRelocation.X; EyeData.LeftRelocationCoordY = leftRelocation.Y; EyeData.RightRelocationCoordX = rightRelocation.X; EyeData.RightRelocationCoordY = rightRelocation.Y; if (flag == false) EyeData.Valid = 0; else EyeData.Valid = 1; //计算帧率 time_span = EyeData.Time - time_pre; time_pre = EyeData.Time; Fps = (Convert.ToInt32(1000 / time_span.TotalMilliseconds)).ToString() + "/s"; EyeQueue.Enqueue(EyeData); //SaveThread.Suspend(); } catch (System.Exception ex) { LeftEyeCoord = "0"; RightEyeCoord = "0"; LeftRelocationCoord = "0"; RightRelocationCoord = "0"; Fps = "0"; } if (ShowImage) { Dispatcher.BeginInvoke(new Action(() => { imagePtr = GetResultImage(); result_image = IplImagePointerConverter.ToEmgucvImage<Bgr, Byte>(imagePtr); result_image2 = result_image.Resize(320, 240, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC); ResultImageSource = BitmapSourceConverter.ToBitmapSource(result_image2); OnPropertyChanged("ResultImageSource"); }), null); } }
public void Shrink(string filename, string outfile, int width) { FileStream fs = File.OpenRead(R.Server.MapPath(filename)); Image image = new Image(fs); //int h = height; if (image.PixelWidth > width) { //if(h <= 0) { h = (image.PixelHeight / (image.PixelWidth / width)); } image = image.Resize(width); } Save(outfile, image); fs.Dispose(); }
void UIUpdate(bool flag) { try { LeftEyeCoord = "(" + leftEyeCenter.X.ToString() + " , " + leftEyeCenter.Y.ToString() + ")"; RightEyeCoord = "(" + rightEyeCenter.X.ToString() + " , " + rightEyeCenter.Y.ToString() + ")"; LeftRelocationCoord = "(" + leftRelocation.X.ToString() + " , " + leftRelocation.Y.ToString() + ")"; RightRelocationCoord = "(" + rightRelocation.X.ToString() + " , " + rightRelocation.Y.ToString() + ")"; //记录一条新的实验数据 EyeData.EyeExpName = (ExperimentType)Enum.Parse(typeof(ExperimentType), ExpType[CurrentExpIndex]); EyeData.Time = DateTime.Now; EyeData.MilliSecond = DateTime.Now.Millisecond; EyeData.LeftEyeCoordX = leftEyeCenter.X; EyeData.LeftEyeCoordY = leftEyeCenter.Y; EyeData.RightEyeCoordX = rightEyeCenter.X; EyeData.RightEyeCoordY = rightEyeCenter.Y; EyeData.LeftRelocationCoordX = leftRelocation.X; EyeData.LeftRelocationCoordY = leftRelocation.Y; EyeData.RightRelocationCoordX = rightRelocation.X; EyeData.RightRelocationCoordY = rightRelocation.Y; if (flag == false) EyeData.Valid = 0; else EyeData.Valid = 1; //计算帧率 time_span = EyeData.Time - time_pre; time_pre = EyeData.Time; Fps = (Convert.ToInt32(1000 / time_span.TotalMilliseconds)).ToString() + "/s"; EyeQueue.Enqueue(EyeData); //SaveThread.Suspend(); } catch (System.Exception ex) { LeftEyeCoord = "0"; RightEyeCoord = "0"; LeftRelocationCoord = "0"; RightRelocationCoord = "0"; Fps = "0"; } //SaveThread.Resume(); // 写入数据库,由于速度太慢,不再使用这种方法 //time1 = DateTime.Now; /* try { if (DatabaseHelper.SaveEyeExperimentData(EyeExperimentName, EyeData)) { /* this.TrialEvent(this, new TrialEventArgs(TrialState.Running, TrialCount)); // 状态5:实验过渡 State = 5; TrialTimer.Stop(); TrialTimer.Interval = 500; TrialTimer.Start(); } else { // 实验数据未写入数据库 DatabaseMessage.ShowDatabaseFailure(""); // Pause(); } } catch (System.Exception ex) { DatabaseMessage.ShowDatabaseFailure(ex.Message); } */ // use_time1 = (int)(DateTime.Now - time1).TotalMilliseconds; if (ShowImage) { Dispatcher.BeginInvoke(new Action(() => { imagePtr = GetResultImage(); result_image = IplImagePointerConverter.ToEmgucvImage<Bgr, Byte>(imagePtr); result_image2 = result_image.Resize(320, 240, Emgu.CV.CvEnum.INTER.CV_INTER_CUBIC); ResultImageSource = BitmapSourceConverter.ToBitmapSource(result_image2); OnPropertyChanged("ResultImageSource"); }), null); } /* if (ShowLocus) { Dispatcher.BeginInvoke(new Action(() => { whiteimagePtr = GetWhiteImage(); result_whiteimage = IplImagePointerConverter.ToEmgucvImage<Bgr, Byte>(whiteimagePtr); ResultLocusSource = BitmapSourceConverter.ToBitmapSource(result_whiteimage); OnPropertyChanged("ResultLocusSource"); }), null); }*/ }
public void Run() { double totaltime = 0; int s = 100, r = 5; string[] templatefiles = Directory.GetFiles(@"D:\Play Data\train_data\sc\", "*.sc") .Take(100).ToArray(); #region 打开模板 string templatepath = @"D:\Play Data\template\"; int templatecount = templatefiles.Length; Debug("打开{0}个模板--------------------------------------------", templatecount); double[][,] templates = new double[templatecount][,]; int[] templatenums = new int[templatecount]; timer.Restart(); for (int i = 0; i < templatefiles.Length; ++i) { string file = templatefiles[i]; string filename = Path.GetFileNameWithoutExtension(file); templatenums[i] = int.Parse(filename.Split('-')[1]); templates[i] = new double[s, 60]; using (var fs = new FileStream(file, FileMode.Open)) { using (var br = new BinaryReader(fs)) { for (int j = 0; j < s; ++j) { for (int k = 0; k < 60; ++k) { templates[i][j, k] = br.ReadDouble(); } } } } if (i % 100 == 0) Debug("已完成{0}个", i); } Debug("模板读取完成,用时{0}ms.", timer.Stop()); #endregion string[] testfiles = Directory.GetFiles(@"D:\Play Data\test\", "*.bmp") .Take(100).ToArray(); #region 测试 int testcase = testfiles.Length, acc = 0; Debug("为{0}个对象寻找候选模板------------------------------------------", testcase); foreach (var file in testfiles) { timer.Restart(); string filenameext = Path.GetFileName(file); string filename = Path.GetFileNameWithoutExtension(file); int thisnum = int.Parse(filename.Split('-')[1]); Image<Gray, Byte> img = new Image<Gray, byte>(file); var list = getEdge(img.Resize(2.5, Emgu.CV.CvEnum.INTER.CV_INTER_LINEAR)).Sample(s); var scq = Jim.OCR.ShapeContext2D.ShapeContext.ComputeSC(list); var arr = new ValueIndexPair<double>[templatecount]; for (int i = 0; i < templatecount; ++i) { double[,] sci = templates[i]; double[,] costmat = Jim.OCR.ShapeContext2D.ShapeContext.HistCost(scq, sci); var costmat_int = new int[s, s]; for (int ii = 0; ii < s; ++ii) { for (int jj = 0; jj < s; ++jj) { costmat_int[ii, jj] = (int)(costmat[ii, jj] * 10000); } } var km = new KM(s, costmat_int); km.Match(false); arr[i] = new ValueIndexPair<double> { Index = i, Value = km.MatchResult / 10000.0 }; } Array.Sort(arr, (a, b) => a.Value.CompareTo(b.Value)); int[] matchcount = new int[10]; double[] matchcost = new double[10]; int knn = 10; foreach (var pair in arr.Take(knn)) { int num = templatenums[pair.Index]; matchcount[num]++; matchcost[num] += pair.Value; } var match = matchcount.Select((val, i) => new { Count = val, Num = i }) .Where(v => v.Count > 0) .OrderByDescending(v => v.Count).ToArray(); //var match = matchcost.Select((val, i) => new { Cost = val / matchcount[i], Num = i }) // .Where(v => !double.IsNaN(v.Cost)) // .OrderBy(v => v.Cost).ToArray(); #region 进行精细匹配,效果一般 //double[] matchrate = new double[10]; //foreach (var m in match) { // if (m.Count == 0) break; // string template = Path.Combine(templatepath, m.Num + ".bmp"); // Jim.OCR.ShapeContext2D.ShapeContext sc = new Jim.OCR.ShapeContext2D.ShapeContext(file, template); // sc.debug_flag = false; // sc.timer_flag = false; // sc.display_flag = false; // sc.n_iter = 3; // sc.matchScale = 2.5; // sc.maxsamplecount = 100; // matchrate[m.Num] = sc.MatchFile(); //} //var bestmatches = matchrate.Select((val, i) => new { Cost = val, Num = i }) // .Where(m => m.Cost > 0) // .OrderBy(m => m.Cost).ToArray(); //int firstmatch = bestmatches[0].Num; #endregion int firstmatch = match[0].Num; var fc = Console.ForegroundColor; Console.ForegroundColor = firstmatch == thisnum ? ConsoleColor.Green : ConsoleColor.Red; var timeused = timer.Stop(); totaltime += timeused; string info = String.Format("{0} {1}ms - {2}\t", filename, timeused, (firstmatch == thisnum ? "Right" : "Wrong")); //foreach (var m in bestmatches.Take(4)) { foreach (var m in match) { info += String.Format("{0}/{1}\t", m.Num, m.Count); //info += String.Format("{0}/{1:F3}\t", m.Num, m.Cost); //info += String.Format("{0}/{1:F3}\t", m.Num, m.Cost); } Debug(info); Console.ForegroundColor = fc; if (firstmatch == thisnum) { ++acc; } } Debug("测试用例:{0}。正确率{1}。", testcase, acc); Console.WriteLine("总用时:{0}ms,平均用时:{1}ms。", totaltime, totaltime / testcase); #endregion }
private void client_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e) { try { var image = new Image(e.Result); image.Convert(Image.kFormatAlpha16); if (image.width != 1081 || image.height != 1081) { if (!image.Resize(1081, 1081)) { errorLabel.text = string.Concat(new object[] { "Resize not supported: ", image.format, "-", image.width, "x", image.height, " Expected: ", 1081, "x", 1081 }); return; } } m_LastHeightmap16 = image.GetPixels(); SimulationManager.instance.AddAction(LoadHeightMap16(m_LastHeightmap16)); } catch (Exception ex) { errorLabel.text = ex.ToString(); } }
public void Render(Image image, Drawable drawable) { var parser = new MathExpressionParser(); parser.Init(GetValue<string>("formula"), image.Dimensions); var newImage = new Image(image.Dimensions, image.BaseType); var srcPR = new PixelRgn(drawable, image.Bounds, false, false); PixelRgn destPR1 = null; var layer1 = AddLayer(newImage, 1, _("layer_one"), "translate_1_x", "translate_1_y", out destPR1); PixelRgn destPR2 = null; var layer2 = AddLayer(newImage, 2, _("layer_two"), "translate_2_x", "translate_2_y", out destPR2); var transparent = new Pixel(4); if (destPR1 != null && destPR2 != null) { var iterator = new RegionIterator(srcPR, destPR1, destPR2); iterator.ForEach((src, dest1, dest2) => { var tmp = Copy(src); if (parser.Eval(src) < 0) { dest1.Set(tmp); dest2.Set(transparent); } else { dest2.Set(tmp); dest1.Set(transparent); } }); } else if (destPR1 != null) { var iterator = new RegionIterator(srcPR, destPR1); iterator.ForEach((src, dest) => dest.Set((parser.Eval(src) < 0) ? Copy(src) : transparent)); } else // destPR2 != null { var iterator = new RegionIterator(srcPR, destPR2); iterator.ForEach((src, dest) => dest.Set((parser.Eval(src) >= 0) ? Copy(src) : transparent)); } Rotate(layer1, GetValue<int>("rotate_1")); Rotate(layer2, GetValue<int>("rotate_2")); if (GetValue<bool>("merge")) { var merged = newImage.MergeVisibleLayers(MergeType.ExpandAsNecessary); merged.Offsets = new Offset(0, 0); newImage.Resize(merged.Dimensions, merged.Offsets); } new Display(newImage); Display.DisplaysFlush(); }
public void ShowOriginalImage(Image<Bgr, byte> drawedImage, Face face) { this.OriginalImageViewer.Image = drawedImage.Resize(this.OriginalImageViewer.Width, this.OriginalImageViewer.Height, INTER.CV_INTER_LINEAR); //this.trainBox.ShowOriginalImage(drawedImage, face); }
public async Task saveTransformImagesToBlobAsJpeg(IFormFile file, string fileName) { foreach (var size in imageSizes) { CloudBlockBlob blockBlob = _container.GetBlockBlobReference(Enum.GetName(typeof(Sizes),size.Size) + "/" + fileName); blockBlob.Properties.ContentType = "image/jpeg"; using (var inStream = file.OpenReadStream()) { // Create or overwrite using (var fileStream = await blockBlob.OpenWriteAsync()) { var image = new Image(inStream); image.Resize(size.width, 0) // Passing zero on height or width will perserve the aspect ratio of the image. .Save(fileStream, new JpegFormat()); } } } }
public async Task<bool> saveSmallPicture(ICollection<IFormFile> files, string basePath) { foreach (var value in files) { var fileName = ContentDispositionHeaderValue .Parse(value.ContentDisposition) .FileName .Trim('"');// FileName may return double quotes using (var inStream = value.OpenReadStream()) { using (var outStream = File.OpenWrite(basePath + "\\wwwroot\\Content\\Pictures\\Small\\" + Path.GetFileNameWithoutExtension(fileName) + ".jpg")) { var image = new Image(inStream); Task<bool> saveImg = new Task<bool>(() => { image.Resize(260, 0) // Passing zero one of height or width will perserve the aspect ratio of the image. .Save(outStream, new JpegFormat()); return true; }); try { await saveImg; } catch (Exception e) { return false; } } } } return true; }
/// <summary> /// スキル使用時エフェクト /// </summary> /// <param name='mySpritePosition'> /// 自機スプライトの位置 /// </param> public static void SkillUseEffect(Vector2 mySpritePosition) { var image1 = new Image("/Application/resourses/Bullet01_64x64.png"); image1 = image1.Crop(new ImageRect(0,0,64,64)); var image2 = new Image("/Application/resourses/effect1.png"); image2 = image2.Resize(new ImageSize(960,180)); var waveTexture = Convert.CreateTextureFromImage(image1); image2.Decode(); var bgTexture = Convert.CreateTextureFromImage(image2); image1.Dispose(); image2.Dispose(); var skillName = ""; switch(Global.setSkill){ case SkillID.Default : skillName = "The WORLD"; break; case SkillID.Skill1 : skillName = "Refrection"; break; case SkillID.Skill2 : skillName = ""; break; case SkillID.Skill3 : skillName = ""; break; } var textTexture = Convert.CreateTextureFromText(skillName,new Font(FontAlias.System,120,FontStyle.Bold | FontStyle.Italic),0xFFFFFF00) ; waveTextureInfo = new TextureInfo(waveTexture); textTextureInfo = new TextureInfo(textTexture); bgTextureInfo = new TextureInfo(bgTexture); waveSprite = new SpriteUV(){TextureInfo = waveTextureInfo}; textSprite = new SpriteUV(){TextureInfo = textTextureInfo}; bgSprite = new SpriteUV(){TextureInfo = bgTextureInfo}; waveSprite.Quad.S = waveTextureInfo.TextureSizef; textSprite.Quad.S = textTextureInfo.TextureSizef; bgSprite.Quad.S = bgTextureInfo.TextureSizef; waveSprite.CenterSprite(); textSprite.CenterSprite(); bgSprite.CenterSprite(); waveSprite.Position = mySpritePosition; textSprite.Position = new Vector2(1500,272); bgSprite.Position = new Vector2(1500,272); Scenes.sceneOnGame.AddChild(waveSprite); Scenes.sceneOnGame.AddChild(bgSprite); Scenes.sceneOnGame.AddChild(textSprite); var seq0 = new Sequence(); seq0.Add(new MoveTo(new Vector2(480,272),1)); seq0.Add(new DelayTime(1.0f)); seq0.Add(new MoveTo(new Vector2(-500,272),1)); var seq1 = new Sequence(); seq1.Add(new MoveTo(new Vector2(480,272),1)); seq1.Add(new DelayTime(1.0f)); seq1.Add(new MoveTo(new Vector2(-500,272),1)); var seq2 = new Sequence(); seq2.Add(new DelayTime(3.5f)); seq2.Add(new CallFunc(()=>{Sounds.PlaySkill2();})); seq2.Add(new ScaleTo(new Vector2(40,40),3)); Sounds.PlaySkill1(); bgSprite.RunAction(seq0); textSprite.RunAction(seq1); waveSprite.RunAction(seq2); }