pixels

Converting an array of Pixels to an image in C#

心已入冬 提交于 2019-11-30 02:31:50
I have an array of int pixels in my C# program and I want to convert it into an image. The problem is I am converting Java source code for a program into equivalent C# code. In java the line reads which displays the array of int pixels into image: Image output = createImage(new MemoryImageSource(width, height, orig, 0, width)); can someone tell me the C# equivalent? Here orig is the array of int pixels. I searched the Bitmap class and there is a method called SetPixel but the problem is it takes a x,y coordinate number. But what I have in my code is an array of int pixels. Another weird thing

Highlight differences between images

不羁岁月 提交于 2019-11-29 19:24:26
问题 There is this image comparison code I am supposed to modify to highlight/point out the difference between two images. Is there a way to modify this code so as to highlight the differences in images. If not any suggestion on how to go about it would be greatly appreciated. int width1 = img1.getWidth(null); int width2 = img2.getWidth(null); int height1 = img1.getHeight(null); int height2 = img2.getHeight(null); if ((width1 != width2) || (height1 != height2)) { System.err.println("Error: Images

Most efficient/quickest way to parse pixel data with Python?

不问归期 提交于 2019-11-29 15:28:19
问题 I have created a simple Python script that gets activated whenever a specific program is running. That program sends information to the screen, which the script needs to grab and analyze. Part of the script's logic can be expressed as follows: while a certain condition is met: function to continuously check pixel information on a fixed area of the screen() if pixel data (e.g. RGB) changes: do something else: continues to check I have already found something that does exactly this, but not

OpenCV pyrMeanShiftFilter in Processing--problems with matrix

会有一股神秘感。 提交于 2019-11-29 12:23:02
I'm trying to use the Mean Shift Function from OpenCV inside a program called Processing, which is a language based on Java. So far, I know that the function requires two mat and two double, [ pyrMeanShiftFiltering( Mat, Mat, Double, Double) ] and the mat needs to be 8 bits and 3 channels. But, when I run it, it only seems to work for the upper 3/4 th of the image and cuts out the rest. Does anyone know how to get this function to run on the whole image? sample image: cat.jpg import gab.opencv.*; import java.nio.*; import org.opencv.imgproc.Imgproc; import org.opencv.core.Mat; import org

Difference between Bitmap.Height and VerticalResolution

有些话、适合烂在心里 提交于 2019-11-29 10:59:31
What is difference in between the b.Height and b.Width properties and the b.HorizontalResolution and b.VerticalResolution in C#? Bitmap b = new Bitmap(@"foo.bmp"); For my sample, Height = 65, Width = 375, HorizontalResolution = VerticalResolution = 150.01239 . MSDN says height and width are in pixels, but the HorizontalResolution and the VerticalResolution are pixel per inch. So, does that mean that is the dpi at which this image was scanned from a scanner for example? Or is this something else? The context of the question is the following: I would like to scan a signature and show in it on an

Can I make a rather native C++ app with Android?

房东的猫 提交于 2019-11-29 01:55:41
问题 I'm interested in the following features: Writing an app for Android Market that is written completely in C++ (a port of existing product actually). Use fast screen-buffer pixel pushing (or rather using OpenGL ES for this). Grab user input and direct it to C++ code. Is it legal to write such an app for Market? Is Market policy somehow strict to such things? 回答1: As of NDK r5 with Android 2.3 (Gingerbread) this is possible, although I assume only devices to support natives apps must have

How do dp, dip, dpi, ppi, pixels and inches relate?

主宰稳场 提交于 2019-11-29 00:09:14
问题 I was reading dp, dip, px, sp measurements, but I still have some questions about dp/dpi vs ppi vs px vs inch. I am not able to compare them... is an inch the largest? They say 160 dpi means 160 pixels per one inch. Does that mean 1 inch contains 160 pixels? They also say 1 pixel on a 160 dpi screen = 1 dp. Does that mean 1 pixel and 1 dp are equal? And lastly, why should we use dp instead of px? I understand that it is ideal, but why ? 回答1: You should (almost) always use flexible sizing

WPF - canvas height in pixels

爱⌒轻易说出口 提交于 2019-11-28 22:08:34
How can I determine the width in pixels for a canvas (which has a certain width)? I have a bitmap in an AnimatedImage control, and I know the bitmap's width in pixels, and I want to scale the bitmap so that it horizontally fits exactly the canvas. How can i determine this scale? Note: I do not need to use RenderTargetBitmap, because the bitmap is already loaded. In WPF units are device independent. The formula to figure out the actual pixel size of a unit is: Pixels per WPF Unit = ConstantWPFUnit size * monitor DPI; Size of your element in pixels = Pixels per WPF Unit * MyElement.ActualWidth

Is it bad to work with pixels in CSS? [closed]

穿精又带淫゛_ 提交于 2019-11-28 16:46:55
Is it bad in terms of compatibility to use pixel numbers in CSS instead of percentages? How about lower resolutions? Is it okay to work with them in ranges of 1-100? This is a difficult question, because the answer mostly depends on your situation. Pixels are not that bad, I mostly use them too. (Sometimes even for font sizes.) I usually fix the outer block element of the layout by a given size (pixels with fixed-width layouts, and percentages with fluid layouts), and on the inside elements I usually set percentages whenever possible. There are some elements which simply can't be styled with

c# drawing text using custom pixels

孤街浪徒 提交于 2019-11-28 14:41:59
I'm wondering if that's possible: I got a c# application with something like a display consisting of about 11000 circles drawn on the Form. What I want to achieve is to be able to draw text on that display, but not using the "real" pixels, but using the circles (rectangles) drawn on the form as pixels. Edit 1: When drawing text in c#, you would i.e. use something like Graphics.DrawString(...) , giving the method a rectangle (so coordinates) in which the text should be drawn in. That text then is drawn in that rectangle using the screen pixels. What I want to do is draw text as well but not