pixel

Why is my webgl shader not changing pixel fragments correctly?

拜拜、爱过 提交于 2019-12-12 02:57:47
问题 I'm trying to get position of a fragment and change the color at positions, but when I try to do it, I get a weird effect where they don't want to be changed completely. Notice how there is a cyan color, but that part should be transparent. It seems like there's some weird rounding happening, and I'm not sure how to fix it. What is happening here? void main() { vec4 c0 = vec4(0,1,0,1); c0.a *= step(132.0,gl_FragCoord.x); gl_FragColor = c0; } 回答1: You need to show more code. Did you enable

Cannot get colour of pixel on screen

淺唱寂寞╮ 提交于 2019-12-12 02:49:22
问题 I want to find the colour of a specific pixel on the screen. The background of the JFrame is set to white, which is RGB(255, 255, 255). The Graphics object is set to black, which is RGB(0, 0, 0). I draw a rectangle. (100, 100) is a pixel on the outline of the rectangle. Before drawing, I get the pixel colour of (100, 100) and it gives RGB(255, 255, 255). After drawing, I get the pixel colour of (100, 100) and it gives RGB(255, 255, 255). Is it not supposed to be RGB(0, 0, 0)? Also, the output

C++ how to draw a tone curve (gamma) to graph using setpixel function

旧城冷巷雨未停 提交于 2019-12-12 02:46:15
问题 As title mentions. I'm trying to draw a gamma tone curve but i do not have any idea how to do it. I can do linear tone curve just fine, but when it comes to drawing gamma tone curve, i totally just lose it. As referenced from http://www.mediachance.com/pseam/help/curves.html (1st or 2nd drawing) Codes as below #include <math.h> static COLORREF red=RGB(255,0,0); static COLORREF blue=RGB(0,0,255); static COLORREF green=RGB(0,255,0); The part where i should incorporate in to draw the gamma tone

Implementing Sigmoid Curves in C++

烂漫一生 提交于 2019-12-12 02:37:21
问题 I've been trying to implement Sigmoid curves since 12 hours ago and i could not manage to get it up. I'm using Microsoft Visual Studio 2010. The formula is y = 1/(1+exp(-e)) Yet when i try implementing in the codes it does not work, why? Can any experts please guide me along, thank you. for(int y=0; y<bih.biHeight; y++) { for(int x=0; x<bih.biWidth; x++) { SetPixel(hdc, (double)1/((double)1+exp(double(-x))), bih.biHeight-x, red); } } 回答1: Your result for the (double)1/((double)1+exp(double(-x

int pixels array to bmp in java

試著忘記壹切 提交于 2019-12-12 02:25:49
问题 How do i create new bmp image in java from int array that contains pixels (from getPixel() of pixelGrabber class) ? Thanks 回答1: Make a BufferedImage and call setPixel. BufferedImage: http://download.oracle.com/javase/1.4.2/docs/api/java/awt/image/BufferedImage.html If you want BMP file then you can use ImageIO.write(bufferedImage,"BMP", new File("mybmp.bmp")); I would give you the link to ImageIO class but Stack Overflow is preventing me from spamming. 回答2: In Kotlin: // As it happens default

Pixel size for different browsers

走远了吗. 提交于 2019-12-12 01:28:35
问题 Is the pixel size different for different browsers? For example <input type='button' class='button2' value='...' /> /*****CSS*****/ .button2{ width:120px; } overflows the button value in Chrome but doesn't so in Safari and Firefox. What am I doing is wrong? 回答1: Pixels should be the same. If you investigate, you may find that the different browsers have different default values for things like margins, padding, text size, font face, etc. That's probably what's tripping you up (though I would

Wrong output of prediction function in tensorflow

落爺英雄遲暮 提交于 2019-12-12 01:21:27
问题 I am going to perform pixel-based classification on an image. Here is the code I used for training the NN net = input_data(shape=[None, 1,4]) net = tflearn.lstm(net, 128, return_seq=True) net = tflearn.lstm(net, 128) net = tflearn.fully_connected(net, 1, activation='softmax') net = tflearn.regression(net, optimizer='adam', loss='categorical_crossentropy') model = tflearn.DNN(net, tensorboard_verbose=2, checkpoint_path='model.tfl.ckpt') X_train = np.expand_dims(X_train, axis=1) model.fit(X

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

Getting the Pixel Color of Image using a Button in Android?

故事扮演 提交于 2019-12-11 19:32:25
问题 I'm still learning Android programming, and right now I'm writing an app to detect colors in a picture uploaded from the gallery. So far, using a tutorial, the app can upload a picture from the gallery into imageview, but I'm not sure how to get the second part working. I want the user to be able to simply press a button and display the color of the image (right now I'm using single color images). How would I go about doing this? Here's my source code so far: package com.example.testrunvday;

Determine bits per pixel in a bitmap

心已入冬 提交于 2019-12-11 16:43:43
问题 What's the easiest way to tell the number of bits per pixel in a bitmap, e.g. a Windows .bmp file? 回答1: Look at the header of the file. 回答2: //************************************** PROGRAM : To get the Number of bits per pixel of a bitmap. AUTHOR : Tanmay Roy. - M.Tech(Embedded Sys & VLSI) (Kolkata,INDIA) DATE : 20-May-2011 COMPILER: Visual Studio 6 REMARKS : It's done at very simple way, It works fine. This can be done at Turbo C also. but few modification neesed. E-MAIL : tanmay.roy8@gmail