private bool UpdateAppeal(string message, int _appeal_type = 0) { if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.AppealMessageText, (UnityEngine.Object)null)) { Text componentInChildren = (Text)this.AppealOption.GetComponentInChildren <Text>(); if (UnityEngine.Object.op_Equality((UnityEngine.Object)componentInChildren, (UnityEngine.Object)null)) { DebugUtility.LogError("訴求文言を表示するオブジェクトがありません"); return(false); } this.AppealMessageText = componentInChildren; } if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.AppealBgs, (UnityEngine.Object)null)) { ImageArray componentInChildren = (ImageArray)this.AppealOption.GetComponentInChildren <ImageArray>(); if (UnityEngine.Object.op_Equality((UnityEngine.Object)componentInChildren, (UnityEngine.Object)null)) { DebugUtility.LogError("訴求吹き出し画像を表示するオブジェクトがありません"); return(false); } this.AppealBgs = componentInChildren; } if (_appeal_type < this.AppealBgs.Images.Length) { this.AppealBgs.ImageIndex = _appeal_type; } this.AppealMessageText.set_text(message); return(true); }
public ActionResult EditProfile(ViewModels.UserAspNet.Edit model) { if (ModelState.IsValid) { var User = db.Users.Find(model.ID); User.UserName = model.UserName ?? User.UserName; User.PhoneNumber = model.PhoneNo; var profile = db.UserProfiles.Find(model.ID); profile.FirstName = model.UserProfile.FirstName; profile.LastName = model.UserProfile.LastName; profile.Gender = model.UserProfile.Gender; profile.BirthDate = model.UserProfile.DateOfBirth; profile.Street = model.UserProfile.Street; profile.City = model.UserProfile.City; profile.Zip = model.UserProfile.Zip; profile.Modified = DateTime.UtcNow.Ticks; profile.Image = model.UserProfile.Image ?? ImageArray.ToByteArray(model.UserProfile.Upload); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(model)); }
public void TestGetSubPixelValue() { var image = new ImageArray(new byte[] { 1, 1, 3, 3 }, 2, 2); var value = image.GetSubPixelValue(0.5, 0.5); Assert.AreEqual(2, value); }
public void TestRoi() { var image = new ImageArray(new byte[] { 1, 2, 3, 4 }, 2, 2); var roi = image.ExtractRoi(new Int32Rect(1, 1, 1, 1)); Assert.AreEqual(4, roi.At(0, 0)); }
public void TestRoiOutsideRange() { var image = new ImageArray(new byte[] { 1, 2, 3, 4 }, 2, 2); var largeRoi = image.ExtractRoi(new Int32Rect(-2, -2, 4, 4)); Assert.AreEqual(4, largeRoi.At(1, 1)); }
private void InitOperatedOrigBitmaps() { this.operatedBitmapOrig = new ImageArray(); for (int i = 0; i < this.originalBitmap.Count; i++) { this.operatedBitmapOrig.Add((Bitmap)this.originalBitmap[i].Clone()); } }
public OpHelper(ImageArray originalBitmap, Viewer viewer) { this.originalBitmap = originalBitmap; InitOperatedOrigBitmaps(); //ReInitOperatedBitmaps(); this.viewer = viewer; }
private static ImageArray BuildRedImage() { var blue = new ImageArray(new byte[250], 50, 50); var green = new ImageArray(new byte[250], 50, 50); var red = new ImageArray(Enumerable.Repeat((byte)255, 250).ToArray(), 50, 50); return(blue.Merge(green, red)); }
public async Task DeleteImageArrayAsync(string workid) { ImageArray image = await GetConnection().Table <ImageArray>().Where(i => i.Id == workid).FirstOrDefaultAsync(); if (image != null) { await GetConnection().DeleteAsync(image); } }
public override Category Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType is not JsonTokenType.StartObject) { throw new JsonException(); } var imageArrayConverter = options.GetConverter <ImageArray>(); var uriConverter = options.GetConverter <Uri>(); string id = string.Empty; Uri href = null !; string name = string.Empty; ImageArray images = Array.Empty <Image>(); while (reader.Read()) { if (reader.TokenType is JsonTokenType.EndObject) { break; } if (reader.TokenType is not JsonTokenType.PropertyName) { throw new JsonException(); } var propertyName = reader.GetString(); reader.Read(); // Read to next token. switch (propertyName) { case "id": id = reader.GetString() !; break; case "href": href = uriConverter.Read(ref reader, typeof(Uri), options) !; break; case "name": name = reader.GetString() !; break; case "icons": images = imageArrayConverter.Read(ref reader, typeof(ImageArray), options) !; break; default: reader.Skip(); break; } } return(new(id, href, name, images)); }
public bool Setup(bool lock_flag, int story_part) { this.mStoryNum = 1; this.mLockFlag = false; this.mAlphaState = StoryPartIcon.AlphaState.None; if (Object.op_Equality((Object)this.IconGo, (Object)null) || Object.op_Equality((Object)this.LockGo, (Object)null) || (Object.op_Equality((Object)this.LockCover, (Object)null) || Object.op_Equality((Object)this.LockCoverPart, (Object)null)) || (Object.op_Equality((Object)this.LockOpen, (Object)null) || Object.op_Equality((Object)this.BlurIcon, (Object)null) || Object.op_Equality((Object)this.BlurIcon2, (Object)null))) { return(false); } ImageArray component = (ImageArray)this.IconGo.GetComponent <ImageArray>(); if (Object.op_Equality((Object)component, (Object)null) || story_part > component.Images.Length) { return(false); } int num = story_part - 1; this.mStoryNum = story_part; this.mLockFlag = lock_flag; if (!lock_flag) { this.IconGo.SetActive(true); this.LockGo.SetActive(false); this.IconMask.SetActive(true); this.LockMask.SetActive(false); this.LockTitleMask.SetActive(false); component.ImageIndex = num; } else { component.ImageIndex = num; this.IconGo.SetActive(false); this.LockGo.SetActive(true); this.IconMask.SetActive(false); this.LockMask.SetActive(true); this.LockTitleMask.SetActive(true); this.LockCover.ImageIndex = num; this.LockCoverPart.ImageIndex = num; this.LockOpen.ImageIndex = num; this.BlurIcon.ImageIndex = num; this.BlurIcon2.ImageIndex = num; if (Object.op_Inequality((Object)this.TxtConditions, (Object)null)) { string storyPartWorldName = MonoSingleton <GameManager> .Instance.GetReleaseStoryPartWorldName(this.StoryNum); if (storyPartWorldName != null) { this.TxtConditions.set_text(string.Format(LocalizedText.Get("sys.STORYPART_RELEASE_TIMING"), (object)storyPartWorldName)); } } } ((ImageArray)this.IconMask.GetComponent <ImageArray>()).ImageIndex = num; ((ImageArray)this.LockMask.GetComponent <ImageArray>()).ImageIndex = num; ((ImageArray)this.LockTitleMask.GetComponent <ImageArray>()).ImageIndex = num; return(true); }
public TextureArray(TextureUnit unit, ImageArray images) : base(unit, images) { dirtyRegions = new HashSet<Region2D>[images.Depth]; for (int i = 0; i < dirtyRegions.Length; i++) { dirtyRegions[i] = new HashSet<Region2D>(); } }
public TextureArray(TextureUnit unit, ImageArray images) : base(unit, images) { dirtyRegions = new HashSet <Region2D> [images.Depth]; for (int i = 0; i < dirtyRegions.Length; i++) { dirtyRegions[i] = new HashSet <Region2D>(); } }
public void TestThreshold() { var image = new ImageArray(new byte[] { 1, 2, 3, 4 }, 2, 2); var result = image.Threshold(2, 10, ThresholdType.Binary); Assert.AreEqual(0, result.At(0, 0)); Assert.AreEqual(0, result.At(1, 0)); Assert.AreEqual(10, result.At(0, 1)); Assert.AreEqual(10, result.At(1, 1)); }
public void TestSetTo() { var image = new ImageArray(new byte[] { 1, 2, 3, 4 }, 2, 2); var roi = image.ExtractRoi(new Int32Rect(0, 1, 2, 1)); roi.SetTo(0); Assert.AreEqual(0, image.At(0, 1)); Assert.AreEqual(0, image.At(1, 1)); }
public void Undo(Document doc) { SpriteDocument sprite = (SpriteDocument)doc; ImageArray frames = (ImageArray)sprite.Frames; frames.Clear(); frames.Resize(oldSize.Width, oldSize.Height); frames.AddRange(oldFrames); sprite.FireChanged(); }
public void SetStatus(Unit unit) { this.Reset(); EUnitCondition[] values = (EUnitCondition[])Enum.GetValues(typeof(EUnitCondition)); int index1 = 0; for (int index2 = 0; index2 < values.Length; ++index2) { if (unit.IsUnitCondition(values[index2])) { this.mNowConditions[index2] = true; ++this.mActiveParamCount; if (index1 < this.StatusSlot.Length) { this.StatusSlot[index1].SetActive(true); ImageArray component = (ImageArray)this.StatusSlot[index1].GetComponent <ImageArray>(); if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null) && index2 < component.Images.Length) { component.ImageIndex = index2; } ++index1; } } else { this.mNowConditions[index2] = false; } } int length = values.Length; if (length >= this.mNowConditions.Length) { return; } this.mNowConditions[length] = false; if (unit.Shields.Count == 0) { return; } this.mNowConditions[length] = true; ++this.mActiveParamCount; if (index1 >= this.StatusSlot.Length) { return; } this.StatusSlot[index1].SetActive(true); ImageArray component1 = (ImageArray)this.StatusSlot[index1].GetComponent <ImageArray>(); if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component1, (UnityEngine.Object)null) && length < component1.Images.Length) { component1.ImageIndex = length; } int num = index1 + 1; }
public void TestGoodFeaturesToTrackWithMask() { ImageArray image = CreateSaddlePointImage(10); var corners = image.GoodFeaturesToTrack(1, 0.1, 2).ToList(); Assert.AreEqual(1, corners.Count); var cornersInRoi = image.GoodFeaturesToTrack(1, 0.1, 2, new Int32Rect(0, 0, 3, 3)); Assert.AreEqual(0, cornersInRoi.Count()); }
public void TestMatchTemplate() { ImageArray image = SimulateBlackImageWithWhitePatch(41, 41, new Int32Rect(12, 23, 10, 10)); ImageArray template = SimulateBlackImageWithWhitePatch(21, 21, new Int32Rect(10, 10, 10, 10)); DoubleArray match = image.MatchTemplate(template, TemplateMatchingMethod.SquaredDifference); var minLoc = match.MinLoc(); Assert.AreEqual(minLoc.X, 2, 1e-3); Assert.AreEqual(minLoc.Y, 13, 1e-3); }
public void TestCornerSubPixelInitialPointTwo() { ImageArray image = CreateSaddlePointImage(50); var corners = new[] { new DoublePoint(46.8, 54.7) }; var subPixel = image.CornerSubPixel(corners, new Int32Size(6, 6), 10, 0.05).Single(); Assert.AreEqual(49.5, subPixel.X, 0.01); Assert.AreEqual(49.5, subPixel.Y, 0.01); }
public void TestCornerSubPixel() { ImageArray image = CreateSaddlePointImage(10); var corners = new[] { new DoublePoint(9.3, 9.7) }; var subPixel = image.CornerSubPixel(corners, new Int32Size(3, 3), 10, 0.03).Single(); Assert.AreEqual(9.5, subPixel.X, 0.01); Assert.AreEqual(9.5, subPixel.Y, 0.01); }
public void TestDoubleConversion() { var image = new ImageArray(new byte[] { 1, 2, 3, 4 }, 2, 2); var result = image.ToDoubleArray(); Assert.AreEqual(1.0, result.At(0, 0), 1e-12); Assert.AreEqual(2.0, result.At(1, 0), 1e-12); Assert.AreEqual(3.0, result.At(0, 1), 1e-12); Assert.AreEqual(4.0, result.At(1, 1), 1e-12); }
private void Start() { UIEventListener uiEventListener = ((Component) this).RequireComponent<UIEventListener>(); if (uiEventListener.onMove == null) uiEventListener.onPointerEnter = new UIEventListener.PointerEvent(this.ShowTooltip); else uiEventListener.onPointerEnter += new UIEventListener.PointerEvent(this.ShowTooltip); if (Object.op_Implicit((Object) this.ImageCond)) return; this.ImageCond = (ImageArray) ((Component) this).GetComponent<ImageArray>(); }
public ActionResult _UploadImage(int BookId, HttpPostedFileBase image) { if (ModelState.IsValid) { var BookFromDb = db.Books.Find(BookId); BookFromDb.Image = ImageArray.ToByteArray(image); db.SaveChanges(); return(RedirectToAction("Edit", new { id = BookId })); } return(View()); }
public void TestGoodFeaturesToTrack() { ImageArray image = CreateSaddlePointImage(10); var corners = image.GoodFeaturesToTrack(1, 0.1, 2).ToList(); var subPixel = image.CornerSubPixel(corners, new Int32Size(3, 3), 10, 0.03).Single(); Assert.AreEqual(1, corners.Count); Assert.AreEqual(9.5, subPixel.X, 0.01); Assert.AreEqual(9.5, subPixel.Y, 0.01); }
public void TestCalculateOpticalFlow() { ImageArray imageA = SimulateBlackImageWithWhitePatch(41, 41, new Int32Rect(12, 23, 10, 10)); ImageArray imageB = SimulateBlackImageWithWhitePatch(41, 41, new Int32Rect(14, 25, 10, 10)); var inputPoints = new[] { new DoublePoint(12.0, 23.0) }; var matchedPoint = imageA.CalculateOpticalFlowPyrLK(imageB, inputPoints, new Int32Size(5, 5), 0).Single(); Assert.AreEqual(14, matchedPoint.TrackedPoint.X, 1e-3); Assert.AreEqual(25, matchedPoint.TrackedPoint.Y, 1e-3); }
public ActionResult _UploadImage(int?userId, HttpPostedFileBase image) { if (ModelState.IsValid) { var userProfileFromDb = db.UserProfiles.Find(userId); userProfileFromDb.Image = ImageArray.ToByteArray(image); db.SaveChanges(); return(RedirectToAction("EditProfile", new { Id = userId })); } return(View()); }
public void TestImageMean() { var byteImage = new byte[2 * 2]; byteImage[0] = 100; byteImage[1] = 100; byteImage[2] = 0; byteImage[3] = 0; ImageArray imageA = new ImageArray(byteImage, 2, 2); var mean = imageA.Mean(); Assert.AreEqual(50, mean); }
public ActionResult EditProfilesAdmin(ViewModels.UserAspNet.EditAdmin model) { if (ModelState.IsValid) { var User = db.Users.Find(model.ID); User.UserName = model.UserName ?? User.UserName; User.PhoneNumber = model.PhoneNo; if (User.Roles.FirstOrDefault(a => a.RoleId == model.SelectedRoleId) == null) { UserManager <ApplicationUser> _userManager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(new SPContext())); foreach (var roleId in User.Roles.Select(a => a.RoleId)) { var roleToRemove = db.Roles.Find(roleId); if (roleToRemove != null) { _userManager.RemoveFromRole(User.Id, roleToRemove.Name); } } var roleToAdd = db.Roles.Find(model.SelectedRoleId); if (roleToAdd != null) { _userManager.AddToRole(User.Id, roleToAdd.Name); } } var profile = db.UserProfiles.Find(model.ID); profile.FirstName = model.UserProfile.FirstName; profile.LastName = model.UserProfile.LastName; profile.Gender = model.UserProfile.Gender; profile.BirthDate = model.UserProfile.DateOfBirth; profile.Street = model.UserProfile.Street; profile.City = model.UserProfile.City; profile.Zip = model.UserProfile.Zip; profile.Modified = DateTime.UtcNow.Ticks; profile.Image = model.UserProfile.Image ?? ImageArray.ToByteArray(model.UserProfile.Upload); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(model)); }
private void Awake() { if (!Object.op_Inequality((Object)this.AwardImg, (Object)null)) { return; } ImageArray component = (ImageArray)this.AwardImg.GetComponent <ImageArray>(); if (!Object.op_Inequality((Object)component, (Object)null)) { return; } this.mImageArray = component; }
public void TestGetPixels() { var blue = new ImageArray(new byte[] { 1, 2, 3, 4 }, 2, 2); var green = new ImageArray(new byte[] { 5, 6, 7, 8 }, 2, 2); var red = new ImageArray(new byte[] { 11, 12, 13, 14 }, 2, 2); var image = blue.Merge(green, red); var pixels = image.CopyPixels(); Assert.AreEqual(12, pixels.Length); Assert.AreEqual(blue.At(0, 0), pixels[0]); Assert.AreEqual(green.At(0, 0), pixels[1]); Assert.AreEqual(red.At(0, 0), pixels[2]); }
//public Bitmap OperatedBitmap2 //{ // get // { // if (operatedBitmap != null) // return (Bitmap)operatedBitmap[selectedIndex]; // else if (originalBitmap != null) // return (Bitmap)originalBitmap[selectedIndex]; // else // return null; // } //} //public ImageArray OperatedBitmaps //{ // get // { // if (operatedBitmap != null) // return operatedBitmap; // else // return originalBitmap; // } //} public void Dispose() { if (operatedBitmap != null) { foreach (Image img in operatedBitmap) { if (img != null) { img.Dispose(); } } operatedBitmap.Clear(); operatedBitmap = null; } if (originalBitmap != null) { foreach (Image img in originalBitmap) { if (img != null) { img.Dispose(); } } originalBitmap.Clear(); originalBitmap = null; } try { DisposeToBeDisposed(); } catch { } }
public OpHelper(ImageArray originalBitmap, Viewer viewer) { this.originalBitmap = originalBitmap; InitOperatedOrigBitmaps(); //ReInitOperatedBitmaps(); this.viewer = viewer; }
private void ReInitOperatedBitmaps() { toBeDisposed = this.operatedBitmap; this.operatedBitmap = this.operatedBitmapOrig; }
private void InitOperatedOrigBitmaps() { this.operatedBitmapOrig = new ImageArray(); for (int i = 0; i < this.originalBitmap.Count; i++) { this.operatedBitmapOrig.Add((Bitmap)this.originalBitmap[i].Clone()); } }