pixels

sqrt-based filled ellipse pixel drawing function

夙愿已清 提交于 2019-12-12 01:47:23
问题 I'm trying to make a function in Lua or VB based code to draw / plot a filled ellipse. I don't have much knowledge about this math and I can use some help. I Googled everything there is to Google about drawing ellipses with code but I can't find a good simple working example in VB or Lua for a filled one. On a previous post on this site I did get an answer about how to draw a normal ellipse but nothing came up for a filled one, that's why i make a new topic for a filled one. Here are a few

Number of pixels of screen python

那年仲夏 提交于 2019-12-12 01:23:16
问题 How can I calculate the number of pixels in screen (width, height) with python? I want it to be adaptable to any screen, is this possible? 回答1: Borrowing from this question: How do I get monitor resolution in Python?, there are several options. Here's one with Tkinter: import Tkinter as tk root = tk.Tk() screen_width = root.winfo_screenwidth() screen_height = root.winfo_screenheight() print screen_width * screen_height # (e.g.) 3686400 = 2560*1440 That other post has a lot of different ways

How do I position a div 'x' pixels from the center of a page?

守給你的承諾、 提交于 2019-12-12 00:55:41
问题 I want to position a <div> a given number of pixels relative to the center of a page. How can this be done? 回答1: You can use $(window).width() / 2 to get the horizontal center... like: $('.myDiv').css({left: ($(window).width() / 2) - 50}) You'll get the div 50px left of the center 来源: https://stackoverflow.com/questions/11905699/how-do-i-position-a-div-x-pixels-from-the-center-of-a-page

OpenCV in Python can't scan through pixels

余生颓废 提交于 2019-12-11 12:54:35
问题 I'm stuck with a problem of the python wrapper for OpenCv. I have this function that returns 1 if the number of black pixels is greater than treshold def checkBlackPixels( img, threshold ): width = img.width height = img.height nchannels = img.nChannels step = img.widthStep dimtot = width * height data = img.imageData black = 0 for i in range( 0, height ): for j in range( 0, width ): r = data[i*step + j*nchannels + 0] g = data[i*step + j*nchannels + 1] b = data[i*step + j*nchannels + 2] if r

How can I get X11 screen buffer (or how can I get X11 to write to /dev/fb0)

限于喜欢 提交于 2019-12-11 07:48:43
问题 I'm trying to get pixel data from my X11 instance, I've seen this thread (How do take a screenshot correctly with xlib?) and the double for loop is taking just too long for me (over a million loops, as the system I'm building requires the highest amount of efficiency possible, sitting around for 600 miliseconds is just not an option). Is there no way to just get a raw array of pixels to avoid the for loop? I know the XImage class has a "data" member which is supposed to contain all of the

How to rotate an image 90 degrees in C

白昼怎懂夜的黑 提交于 2019-12-11 06:47:05
问题 I've been trying to turn an image black and white, and then rotate it 90 degrees in C but i'm fairly new to programming, this is what i have to far. #include<stdio.h> #include<string.h> int main () { FILE* first; FILE* second; FILE* third; int counter; char c; int width, height, pixelmax, average; int pixelred, pixelgreen, pixelblue, black[300][300][3]; int i, j, timer=0; int k, f=0; first=fopen("blackbuck.ppm","r"); second=fopen("blacktrout.ppm","w"); this skips the first few lines of code

In android Image filter application,Getpixels and setpixels not working properly

試著忘記壹切 提交于 2019-12-11 06:40:06
问题 I am creating an image filters app in android. I am retrieving pixels from a bitmap doing some rgb work on then and setting them on another bitmap. Here is my code and it isnt working properly. please help bmOut = Bitmap.createBitmap(bm1.getWidth(), bm1.getHeight(), bm1.getConfig()); final double GS_RED = 0.299; final double GS_GREEN = 0.587; final double GS_BLUE = 0.114; int A, R, G, B; int pixel; int[] pixels = new int[bm1.getHeight()* bm1.getWidth()]; bm1.getPixels(pixels, 0, bm1.getWidth(

How to copy contents of one canvas to another?

◇◆丶佛笑我妖孽 提交于 2019-12-10 22:49:16
问题 Have a Canvas . Draw something (in my case, several red lines). I want to quite literally copy the contents of this canvas to another. This is what I do: SnapshotParameters params = new SnapshotParameters(); params.setFill(Color.TRANSPARENT); WritableImage image = firstCanvas.snapshot(params, null); secondCanvas.getGraphicsContext2D().drawImage(image, 0, 0); And this is what you get in the second canvas: It is blurred. It is antialiased I guess. I imagine it may be because I am using a

Finding pixel on sprite in Unity

寵の児 提交于 2019-12-10 22:41:58
问题 In Unity3d we have RaycastHit.textureCoord but it doesn't exist anymore in 2D. I was searching about this problem, a lot but I didn't find anything useful. So I want to know the solution for this problem and I'm wondering why method like textureCoord in 3D doesn't exist in 2D actually in RaycastHit2D . also I want to access to the pixel when mouse cursor on it. 回答1: It works in 3D because RaycastHit.textureCoord requires a mesh collider. In the 2D case it is way simplee because you can

How to find Black Pixel locations

蹲街弑〆低调 提交于 2019-12-10 14:10:43
问题 I'm working on a strange project. I have access to a laser cutter that I am using to make stencils (from metal). I can use coordinates to program the machine to cut a certain image, but what I was wondering was: how can I write a program that would take a scanned image that was black and white, and give me the coordinates of the black areas ? I don't mind if it gives every pixel even though I need only the outer lines, I can do that part. I've searched for this for a while, but the question