writeablebitmap

How to work with pixels in Windows Phone/C#

旧巷老猫 提交于 2019-12-10 22:55:42
问题 Windows Phone 8 scales elements using the scale factor value so all pixels are virtual to 800x480 and values such as ActualWidth/ActualHeight return the "fake" 800x400 value. I'm displaying a WritableBitmap that is constructed dynamically on the background of my UI and would like it to be constructed of all available pixels not a scaled 800x480 image. How do I "disable" the scaling and map the virtual pixels to be real device pixels? I know how to calculate the value from the scale factor but

Sobel operator & Convolution with WriteableBitmapEx

倾然丶 夕夏残阳落幕 提交于 2019-12-10 18:06:40
问题 So I'm using WriteableBitmapEx for an app on Windows RT. I'm trying to implement edge detection on an image using the sobel operator. I have successfully applied both kernels for x and y detection onto the image using .Convolute(), but now I'm stuck adding both images to one. The problem is, that all the pixels of both images seem to have the value 0 for transparency (so the A in ARGB). I can display both images on their own without a Problem, but adding them gives me just a black picture. So

Convert ImageSource to WriteableBitmap in Metro Windows 8

天大地大妈咪最大 提交于 2019-12-10 14:43:02
问题 I was wondering how I could go about converting an ImageSource object (in my case the source property of an image element) to a WriteableBitmap . The WriteableBitmap(BitmapSource) constructor doesn't work in Windows 8 Metro, so I can't do that. I've tried to load the ImageSource object into a stream and then use WriteableBitmap.SetSource(stream) , but I can't figure out how do load the image in a stream either. InMemoryRandomAccessStream ras = new InMemoryRandomAccessStream(); BitmapEncoder

How do I add watermark text to a bitmap in WinRT?

ぐ巨炮叔叔 提交于 2019-12-10 13:54:52
问题 I would like to do something like this http://weblogs.asp.net/broux/archive/2011/02/08/silverlight-how-to-watermark-a-writeablebitmapimage-with-a-text.aspx. I am having a tough time getting this to work in WinRT. I am using the WriteableBitmap extensions to "render" some text but I want it to look exactly like it looks in this example. Any suggestions or help? 回答1: You could render that text to a png asset and blit it on top of the bitmap. Unless the text needs to be dynamic - then you'd need

Resizing WritableBitmap

十年热恋 提交于 2019-12-09 22:58:31
问题 I have created a WriteableBitmap in Gray16 format. I want to resize this WriteableBitmap to my known dimention preserving the pixel format(Gray16). Is any one worked on the Resizing the WriteableBitmap. Please help me. I also searched the internet and found http://writeablebitmapex.codeplex.com/ but this through an assebmly reference error. Please help me. 回答1: You can use the following function to resize a writableBitmap : WriteableBitmap resize_image(WriteableBitmap img, double scale) {

Converting WriteableBitmap to Bitmap for use in EmguCV

感情迁移 提交于 2019-12-08 17:51:45
问题 In my code, I'm receiving WriteableBitmaps from a byte array (in turn from a Kinect) and I'd like to turn them into bitmaps for use with EmguCV. Currently this is the code I have: // Copy the pixel data from the image to a temporary array colorFrame.CopyPixelDataTo(this.colorPixels); // Write the pixel data into our bitmap this.colorBitmap.WritePixels( new Int32Rect(0, 0, this.colorBitmap.PixelWidth, this.colorBitmap.PixelHeight), this.colorPixels, this.colorBitmap.PixelWidth * colorFrame

How are writeable bitmaps used with the kinect in VS 2013 wpf applications to hold video information?

血红的双手。 提交于 2019-12-08 12:52:43
问题 I'm looking at the colors basic sample from the Kinect developers toolkit using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using Microsoft.Kinect;

How do I disable silverlight cross-domain content protection for WriteableBitmap

泪湿孤枕 提交于 2019-12-08 06:15:12
问题 I have an Esri map in silverlight and I am trying to get a screenshot. However, I am facing cross-domain content protection for writeablebitmap, saying "Pixels are not accessible". Is there a way that I can disable this? or any other work around in silverlight 3 or 4? 回答1: you can kind of hack around this by rehosting the image. basically you can set up a wcf service on your server that acts as a proxy to the map, then when silverlight does the security check on your media source it will see

Copy a System.Drawing.Bitmap into a region of WriteableBitmap

感情迁移 提交于 2019-12-08 03:54:35
问题 I'm currently having some problems in integrating a System.Drawing.Bitmap into a WPF WriteableBitmap . I want to copy from the Bitmap to position (X,Y) of the WriteableBitmap . The following code shows how I've tried to do this. BitmapData Data = Bitmap.LockBits(new Rectangle(0, 0, Bitmap.Width, Bitmap.Height), ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); WriteableBitmap.Lock(); //CopyMemory(WriteableBitmap.BackBuffer, Data.Scan0, ImageBufferSize); Int32Rect

How to dispose a Writeable Bitmap? (WPF)

爷,独闯天下 提交于 2019-12-06 23:00:23
问题 Some time ago i posted a question related to a WriteableBitmap memory leak, and though I received wonderful tips related to the problem, I still think there is a serious bug / (mistake made by me) / (Confusion) / (some other thing) here. So, here is my problem again: Suppose we have a WPF application with an Image and a button. The image's source is a really big bitmap (3600 * 4800 px), when it's shown at runtime the applicaton consumes ~90 MB. Now suppose i wish to instantiate a