public void image(PImage img, int x, int y, int width, int height) { /* * image(画像ファイル名, x, y); – 座標(x, y)を左上にして、画像を表示 * image(画像ファイル名, x, y, width, height); – 座標(x, y)を左上にして、幅(width)と高さ(height)を指定して画像を表示 */ }
public async Task <IActionResult> Create(Product product, IList <IFormFile> PImages) { string AllFileNames = ""; if (PImages != null && PImages.Count > 0) { foreach (IFormFile PImage in PImages) { string FolderPath = ENV.ContentRootPath + "\\wwwroot\\Images\\ProductImages\\"; string FileName = Guid.NewGuid() + Path.GetExtension(PImage.FileName); PImage.CopyTo(new FileStream(FolderPath + FileName, FileMode.Create)); AllFileNames += (FileName + ","); } } if (ModelState.IsValid) { if (AllFileNames.Contains(',')) { AllFileNames = AllFileNames.Remove(AllFileNames.LastIndexOf(',')); } product.Images = AllFileNames; _context.Add(product); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(product)); }
public async Task <IActionResult> Create([Bind("Id,Name,ShortDescription,LongDescription,CurrentStock,CostPrice,SalePrice,ProductCode,Status,OpeningStock,OpeningDate,ProductFeatures,CreatedBy")] Product product, IList <IFormFile> PImages) { string AllFileNames = ""; if (PImages != null && PImages.Count > 0) { foreach (IFormFile PImage in PImages) { string FolderPath = ENV.ContentRootPath + "\\wwwroot\\Images\\ProductImages\\"; string FileName = Guid.NewGuid() + Path.GetExtension(PImage.FileName); PImage.CopyTo(new FileStream(FolderPath + FileName, FileMode.Create)); AllFileNames += (FileName + ","); } } if (TempData["Message"] != null) { ViewBag.Message = TempData["Message"].ToString(); } if (ModelState.IsValid) { if (AllFileNames.Contains(',')) { AllFileNames = AllFileNames.Remove(AllFileNames.LastIndexOf(',')); } product.Images = AllFileNames; ORM.Add(product); await ORM.SaveChangesAsync(); TempData["Message"] = product.Name + " Successfully added"; return(RedirectToAction(nameof(Index))); } return(View(product)); }
public PFrame(PImage image, PGuid frameId, PGuid sourceId) : this(PapillonPINVOKE.new_PFrame__SWIG_1(PImage.getCPtr(image), PGuid.getCPtr(frameId), PGuid.getCPtr(sourceId)), true) { if (PapillonPINVOKE.SWIGPendingException.Pending) { throw PapillonPINVOKE.SWIGPendingException.Retrieve(); } }
public PFrame(PImage image) : this(PapillonPINVOKE.new_PFrame__SWIG_3(PImage.getCPtr(image)), true) { if (PapillonPINVOKE.SWIGPendingException.Pending) { throw PapillonPINVOKE.SWIGPendingException.Retrieve(); } }
static void Main(string[] args) { // ********************** // intialise Papillon SDK // ********************** PLog.OpenConsoleLogger(); PapillonSDK.Initialise(); // ********************************************************** // set an image from a pixel buffer (a byte[]) and display it //*********************************************************** int width = 600; int height = 400; int depth = 3; var buf = new byte[width * height * depth]; for (int i = 0; i < buf.Length; i += depth) { buf[i] = 127; buf[i + 1] = 0; buf[i + 2] = 255; } PImage image = new PImage(); image.Set(buf, width, height, PImage.EPixelFormat.E_BGR8U); image.Display("Pink", 10000); }
public override void setup() { invWidth = 1.0f / P5Setting.SCREEN_W; invHeight = 1.0f / P5Setting.SCREEN_H; aspectRatio = width * invHeight; aspectRatio2 = aspectRatio * aspectRatio; // create fluid and set options fluidSolver = new MSAFluidSolver2D((int)(FLUID_WIDTH), (int)(FLUID_WIDTH * height / width)); fluidSolver.enableRGB(true).setFadeSpeed(0.003f).setDeltaT(0.5f).setVisc(0.0001f); fluidSolver.enableBoundary = enableBoundary; // create image to hold fluid picture imgFluid = createImage(fluidSolver.getWidth(), fluidSolver.getHeight(), PImangeFormat.RGB); pImageRender.image = imgFluid; // create particle system if (p5particleSystem == null) { p5particleSystem = this.gameObject.AddComponent <P5ParticleSystem> (); } p5particleSystem.Init(fluidSolver); }
public override void Initialize() { PNode blue = new PNode(); blue.SetBounds(0, 0, 60, 80); blue.Brush = new SolidBrush(Color.Blue); Canvas.Layer.AddChild(blue); PNode red = new PEllipse(); red.SetBounds(50, 30, 60, 45); red.Brush = new SolidBrush(Color.Red); Canvas.Layer.AddChild(red); Bitmap bm = new Bitmap(GetType().Module.Assembly.GetManifestResourceStream("PocketPiccoloFeatures.hcil.bmp")); PImage image = new PImage(bm); image.SetBounds(80, 100, image.Width, image.Height); Canvas.Layer.AddChild(image); Canvas.ZoomEventHandler = null; Canvas.AddInputEventListener(new PPanEventHandler()); base.Initialize(); }
public PImage(PImage other) : this(PapillonPINVOKE.new_PImage__SWIG_4(PImage.getCPtr(other)), true) { if (PapillonPINVOKE.SWIGPendingException.Pending) { throw PapillonPINVOKE.SWIGPendingException.Retrieve(); } }
public void SetImage(PImage image) { PapillonPINVOKE.PFrame_SetImage(swigCPtr, PImage.getCPtr(image)); if (PapillonPINVOKE.SWIGPendingException.Pending) { throw PapillonPINVOKE.SWIGPendingException.Retrieve(); } }
public void SetNewImage(PImage image, PGuid frameId) { PapillonPINVOKE.PFrame_SetNewImage__SWIG_1(swigCPtr, PImage.getCPtr(image), PGuid.getCPtr(frameId)); if (PapillonPINVOKE.SWIGPendingException.Pending) { throw PapillonPINVOKE.SWIGPendingException.Retrieve(); } }
public void SetThumbnail(PImage thumbnail) { PapillonPINVOKE.PDescription_SetThumbnail(swigCPtr, PImage.getCPtr(thumbnail)); if (PapillonPINVOKE.SWIGPendingException.Pending) { throw PapillonPINVOKE.SWIGPendingException.Retrieve(); } }
public void SetDataSourceAsPNGImage(PImage imageDataSource) { PapillonPINVOKE.PDescriptor_SetDataSourceAsPNGImage(swigCPtr, PImage.getCPtr(imageDataSource)); if (PapillonPINVOKE.SWIGPendingException.Pending) { throw PapillonPINVOKE.SWIGPendingException.Retrieve(); } }
public Starbase(PLayer layer, String name, float x, float y, float sigRadius, float rrRadius) { float sigDia = (sigRadius * 2) / 100; float rrDia = (rrRadius * 2) / 100; string dataDirectory = "Images"; string filePath = Path.Combine("..", ".."); if (File.Exists(Path.Combine(dataDirectory, "stations.gif"))) { filePath = ""; } Image image = Image.FromFile(Path.Combine(filePath, Path.Combine(dataDirectory, "stations.gif"))); PImage stationImage = new PImage(image); stationImage.X = (x - (image.Width / 2)) / 100; stationImage.Y = (y - (image.Height / 2)) / 100; float sigX = (x / 100) - ((sigDia / 2) - (image.Width / 2)); float sigY = (y / 100) - ((sigDia / 2) - (image.Height / 2)); float rrX = (x / 100) - ((rrDia / 2) - (image.Width / 2)); float rrY = (y / 100) - ((rrDia / 2) - (image.Height / 2)); Pen sigPen = new Pen(Color.Yellow, 2.0F); sigPen.DashStyle = DashStyle.DashDotDot; Pen rrPen = new Pen(Color.LightGoldenrodYellow, 1.0F); PPath sigCircle = PPath.CreateEllipse(sigX, sigY, sigDia, sigDia); sigCircle.Pen = sigPen; PPath rrCircle = PPath.CreateEllipse(rrX, rrY, rrDia, rrDia); rrCircle.Pen = rrPen; PNode sigNode = sigCircle; sigNode.Brush = Brushes.Transparent; PNode rrNode = rrCircle; rrNode.Brush = Brushes.Transparent; PText pname = new PText(name); pname.TextBrush = Brushes.White; pname.TextAlignment = StringAlignment.Center; pname.X = (x / 100) - (pname.Width / 2); pname.Y = (y / 100) - 20; stationImage.AddChild(sigNode); stationImage.AddChild(rrNode); stationImage.AddChild(pname); //Display Object by adding them to its layer layer.AddChild(stationImage); }
protected override void setup() { size(512 * displayAspectW, 512); bg = loadImage("PSamples/bg", 512, 512); apple = loadImage("PSamples/apple", 64, 64); recycle(); }
public PResult Resize(PImage dest, PSizei newSize) { PResult ret = new PResult(PapillonPINVOKE.PImage_Resize__SWIG_8(swigCPtr, PImage.getCPtr(dest), PSizei.getCPtr(newSize)), true); if (PapillonPINVOKE.SWIGPendingException.Pending) { throw PapillonPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public PResult Resize(PImage dest, int newWidth, int newHeight) { PResult ret = new PResult(PapillonPINVOKE.PImage_Resize__SWIG_2(swigCPtr, PImage.getCPtr(dest), newWidth, newHeight), true); if (PapillonPINVOKE.SWIGPendingException.Pending) { throw PapillonPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public PResult Resize(PImage dest, PSizei newSize, PImage.EAspectRatioMode aspectRatioMode, PImage.EInterpolation interpolation) { PResult ret = new PResult(PapillonPINVOKE.PImage_Resize__SWIG_6(swigCPtr, PImage.getCPtr(dest), PSizei.getCPtr(newSize), (int)aspectRatioMode, (int)interpolation), true); if (PapillonPINVOKE.SWIGPendingException.Pending) { throw PapillonPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public PResult InsertImageInPlace(PImage image, int x, int y) { PResult ret = new PResult(PapillonPINVOKE.PImage_InsertImageInPlace(swigCPtr, PImage.getCPtr(image), x, y), true); if (PapillonPINVOKE.SWIGPendingException.Pending) { throw PapillonPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public PResult Convert(PImage dest, PImage.EPixelFormat destImageType) { PResult ret = new PResult(PapillonPINVOKE.PImage_Convert(swigCPtr, PImage.getCPtr(dest), (int)destImageType), true); if (PapillonPINVOKE.SWIGPendingException.Pending) { throw PapillonPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public PResult ExtractSubImage(PImage dest, int x, int y, int width, int height) { PResult ret = new PResult(PapillonPINVOKE.PImage_ExtractSubImage__SWIG_0(swigCPtr, PImage.getCPtr(dest), x, y, width, height), true); if (PapillonPINVOKE.SWIGPendingException.Pending) { throw PapillonPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public PResult ExtractSubImage(PImage dest, PRectanglei r) { PResult ret = new PResult(PapillonPINVOKE.PImage_ExtractSubImage__SWIG_1(swigCPtr, PImage.getCPtr(dest), PRectanglei.getCPtr(r)), true); if (PapillonPINVOKE.SWIGPendingException.Pending) { throw PapillonPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public PResult EqualizeHistogram(PImage dest) { PResult ret = new PResult(PapillonPINVOKE.PImage_EqualizeHistogram(swigCPtr, PImage.getCPtr(dest)), true); if (PapillonPINVOKE.SWIGPendingException.Pending) { throw PapillonPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public bool IsSame(PImage other) { bool ret = PapillonPINVOKE.PImage_IsSame(swigCPtr, PImage.getCPtr(other)); if (PapillonPINVOKE.SWIGPendingException.Pending) { throw PapillonPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public PResult DrawOSD(PImage image) { PResult ret = new PResult(PapillonPINVOKE.PAnalytics_DrawOSD(swigCPtr, PImage.getCPtr(image)), true); if (PapillonPINVOKE.SWIGPendingException.Pending) { throw PapillonPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public PResult VerifyFromImage(PImage image1, PImage image2, PMatchScore matchScore, PDescription outputDescription1, PDescription outputDescription2) { PResult ret = new PResult(PapillonPINVOKE.PVerify_VerifyFromImage(swigCPtr, PImage.getCPtr(image1), PImage.getCPtr(image2), PMatchScore.getCPtr(matchScore), PDescription.getCPtr(outputDescription1), PDescription.getCPtr(outputDescription2)), true); if (PapillonPINVOKE.SWIGPendingException.Pending) { throw PapillonPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public PResult Rotate(PImage dest, int angleInDegrees) { PResult ret = new PResult(PapillonPINVOKE.PImage_Rotate(swigCPtr, PImage.getCPtr(dest), angleInDegrees), true); if (PapillonPINVOKE.SWIGPendingException.Pending) { throw PapillonPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public PResult Apply(PImage source, PImage destination) { PResult ret = new PResult(PapillonPINVOKE.PImageFilter_Apply__SWIG_0(swigCPtr, PImage.getCPtr(source), PImage.getCPtr(destination)), true); if (PapillonPINVOKE.SWIGPendingException.Pending) { throw PapillonPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public void TestImage() { string SAMPLE_DIR = PPath.Join(PUtils.GetEnv("PAPILLON_INSTALL_DIR"), "Data", "Samples"); PImage image = new PImage(); Assert.IsTrue(image.Load(PPath.Join(SAMPLE_DIR, "sample.jpg")).Ok()); Assert.IsFalse(image.Load(PPath.Join(SAMPLE_DIR, "sample2.jpg")).Ok()); PImage image2 = new PImage(); Assert.IsTrue(image2.Load(PPath.Join(SAMPLE_DIR, "sample.jpg")).Ok()); Assert.IsTrue(image.IsSame(image2)); }
public PResult Blur(PImage dest, int blurFactor) { PResult ret = new PResult(PapillonPINVOKE.PImage_Blur(swigCPtr, PImage.getCPtr(dest), blurFactor), true); if (PapillonPINVOKE.SWIGPendingException.Pending) { throw PapillonPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public PResult Resize(PImage dest, float scaleFactor) { PResult ret = new PResult(PapillonPINVOKE.PImage_Resize__SWIG_13(swigCPtr, PImage.getCPtr(dest), scaleFactor), true); if (PapillonPINVOKE.SWIGPendingException.Pending) { throw PapillonPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
protected override void setup() { layerMaskEverything(); removeLayerMask("UI"); size(500 * displayAspectW, 500, U3D, 1.0f); unityChanLogo = loadImage("unitychanLogo"); unityChan.init(this); recycle(); }
public void TestImageFromUserDataForMemory() { int width = 600; int height = 400; int depth = 3; var buf = new byte[width * height * depth]; PColour3i colour = PColour3i.C_PINK; PImage image2 = new PImage(width, height, PImage.EPixelFormat.E_BGR8U); image2.Fill(colour); for (int j = 0; j < 1000; j++) { for (int i = 0; i < buf.Length; i += depth) { buf[i] = (byte)colour.b; buf[i + 1] = (byte)colour.g; buf[i + 2] = (byte)colour.r; } PImage image = new PImage(); image.Set(buf, width, height, PImage.EPixelFormat.E_BGR8U); Assert.IsTrue(image.IsSame(image2)); } }
public void TestImageFromUserData() { int width = 600; int height = 400; int depth = 3; var buf = new byte[width * height * depth]; PColour3i colour = PColour3i.C_PINK; for (int i = 0; i < buf.Length; i+=depth) { buf[i] = (byte)colour.b; buf[i + 1] = (byte)colour.g; buf[i + 2] = (byte)colour.r; } PImage image = new PImage(); image.Set(buf, width, height, PImage.EPixelFormat.E_BGR8U); Assert.AreEqual(image.GetWidth(), width, "Image width not equal"); Assert.AreEqual(image.GetHeight(), height, "Image height not equal"); PImage image2 = new PImage(width, height, PImage.EPixelFormat.E_BGR8U); image2.Fill(colour); Assert.IsTrue(image.IsSame(image2)); }
// // ================================================== // Super Fast Blur v1.1 // by Mario Klingemann // <http://incubator.quasimondo.com> // ================================================== public void fastblur(PImage img, int radius) { if (radius < 1) { return; } int w = img.width; int h = img.height; int wm = w - 1; int hm = h - 1; int wh = w * h; int div = radius + radius + 1; int[] r = new int[wh]; int[] g = new int[wh]; int[] b = new int[wh]; int rsum, gsum, bsum; int x, y, i, p1, p2, yp, yi, yw; int[] vmin = new int[Mathf.Max (w, h)]; int[] vmax = new int[Mathf.Max (w, h)]; byte[] data = img.pixelsInt; byte[] dv = new byte[256 * div]; for (i=0; i<256*div; i++) { dv [i] = (byte)(i / div); } yw = yi = 0; for (y=0; y<h; y++) { rsum = gsum = bsum = 0; for (i=-radius; i<=radius; i++) { int index = yi + Mathf.Min (wm, Mathf.Max (i, 0)); // p = pix [index]; rsum += (data [index * 4 + 0]); gsum += (data [index * 4 + 1]); bsum += (data [index * 4 + 2]); } for (x=0; x<w; x++) { r [yi] = dv [rsum]; g [yi] = dv [gsum]; b [yi] = dv [bsum]; if (y == 0) { vmin [x] = Mathf.Min (x + radius + 1, wm); vmax [x] = Mathf.Max (x - radius, 0); } int index1 = (yw + vmin [x]) * 4; int index2 = (yw + vmax [x]) * 4; rsum += (data [index1 + 0]) - (data [index2 + 0]); gsum += (data [index1 + 1]) - (data [index2 + 1]); bsum += (data [index1 + 2]) - (data [index2 + 2]); yi++; } yw += w; } for (x=0; x<w; x++) { rsum = gsum = bsum = 0; yp = -radius * w; for (i=-radius; i<=radius; i++) { yi = Mathf.Max (0, yp) + x; rsum += r [yi]; gsum += g [yi]; bsum += b [yi]; yp += w; } yi = x; for (y=0; y<h; y++) { data [yi * 4 + 0] = (dv [rsum]); data [yi * 4 + 1] = (dv [gsum]); data [yi * 4 + 2] = (dv [bsum]); data [yi * 4 + 3] = 0xff; if (x == 0) { vmin [y] = Mathf.Min (y + radius + 1, hm) * w; vmax [y] = Mathf.Max (y - radius, 0) * w; } p1 = x + vmin [y]; p2 = x + vmax [y]; rsum += r [p1] - r [p2]; gsum += g [p1] - g [p2]; bsum += b [p1] - b [p2]; yi += w; } } }
public void copy(PImage srcImg) { width = srcImg.width; height = srcImg.height; /* pixelsInt = new int[srcImg.pixelsInt.Length]; for(int i = 0; i < pixelsInt.Length; i++){ pixelsInt[i] = srcImg.pixelsInt[i]; } */ pixelsInt = srcImg.pixelsInt; }
public void image(PImage img, int x, int y, int width, int height) { /* image(画像ファイル名, x, y); – 座標(x, y)を左上にして、画像を表示 image(画像ファイル名, x, y, width, height); – 座標(x, y)を左上にして、幅(width)と高さ(height)を指定して画像を表示 */ }
// Use this for initialization void Start() { Processing.SCREEN_W = Screen.width; Processing.SCREEN_H = Screen.height; int w = texture.width; int h = texture.height; /* texture = new Texture2D(320, 240); */ cam = new PImage (w, h); img = new PImage (w, h); // imgに対して輪郭抽出処理を行う theBlobDetection = new BlobDetection (img.width, img.height); theBlobDetection.setPosDiscrimination (true); }
static void Main(string[] args) { // ********************** // intialise Papillon SDK // ********************** PLog.OpenConsoleLogger(); PapillonSDK.Initialise("PapillonCSharpDemo"); string SAMPLE_DIR = PPath.Join(PUtils.GetEnv("PAPILLON_INSTALL_DIR"), "Data", "Samples"); // ********************************************************************* // load an image from disk (can be JPEG, TIF, BMP or PNG) and display it // ********************************************************************* PImage image = new PImage(); image.Load(PPath.Join(SAMPLE_DIR, "sample.jpg")).OrDie(); image.Display("MySampleImage"); // ********************************************************** // set an image from a pixel buffer (a byte[]) and display it //*********************************************************** int width = 600; int height = 400; int depth = 3; var buf = new byte[width * height * depth]; for (int i = 0; i < buf.Length; i+=depth) { buf[i] = 127; buf[i + 1] = 0; buf[i + 2] = 255; } PImage image2 = new PImage(); image2.Set(buf, width, height, PImage.EPixelFormat.E_BGR8U); image2.Display("Pink"); // ********************************************************** // open a video stream from local webcam, then // 1. display the video stream // 2. write it on the disk (AVI file) // 3. stabilise the video stream (if the "stabilisation" plugin is available) // 4. perform face detection on the video stream //*********************************************************** PInputVideoStream inputStream = new PInputVideoStream(); PInputVideoStream.Open("device:0", inputStream).OrDie(); POutputVideoStream outputStream = new POutputVideoStream(); POutputVideoStream.Open("webcam.avi?fps=20.0", outputStream).OrDie(); bool isStabilisationEnabled = false; PImage stabilisedImage = new PImage(); PImageFilterOptions stabilisationOptions = new PImageFilterOptions(); PImageFilter stabilisationFilter = new PImageFilter(); if (PImageFilter.Create("Stabilisation", "", stabilisationFilter).Ok()) { stabilisationOptions.SetDoubleParameter("motion", 0.5); stabilisationOptions.SetIntParameter("panning", 0); isStabilisationEnabled = true; } PFrame frame = new PFrame(); PDetector faceDetector = new PDetector(); PDetector.Create("FaceDetector", "", faceDetector).OrDie(); PDetectorOptions detectorOptions = new PDetectorOptions(); detectorOptions.SetIntParameter("LOCALISER", 0); // no localiser detectorOptions.SetMinDetectionSize(60); PDetectionList detectionList = new PDetectionList(); while (inputStream.GetFrame(frame).Ok()) { frame.Display("Web-cam image", 50); outputStream.PutImage(frame.GetImage()); if (isStabilisationEnabled) { stabilisationFilter.Apply(frame.GetImage(), stabilisationOptions, stabilisedImage); stabilisedImage.Display("Stabilised stream"); } faceDetector.Detect(frame, detectorOptions, detectionList); PUtils.DisplayDetectionList(frame, detectionList, "Face Detector"); } }
public void cursor(PImage image, int x, int y) { }
// Use this for initialization void Start() { Processing.SCREEN_W = Screen.width; Processing.SCREEN_H = Screen.height; camTexture = new WebCamTexture(); camTexture.Play (); cam = new PImage (w, h); img = new PImage (w, h); // imgに対して輪郭抽出処理を行う theBlobDetection = new BlobDetection (img.width, img.height); theBlobDetection.setPosDiscrimination (true); }
protected override void setup() { size(600, 600); canvas = createImage(width, height); }