pixel

Offset gl_Position or gl_Vertex by pixels value

拜拜、爱过 提交于 2020-01-04 06:45:47
问题 I have attribute contains pixels values. And i want to offset my gl_vertex with this attribute value. The problem is that my gl_vertex is in world units and the offset\attribute is in pixels. I can do it if i'm sending the screen size as uniforms and then convert the pixels to -1 to 1 values, and add it to the final gl_Position. But i don't want now to manage screen size events and sending it anyway every draw, every shader that i have. It there any way to do it with some matrix play, or

Offset gl_Position or gl_Vertex by pixels value

孤者浪人 提交于 2020-01-04 06:45:26
问题 I have attribute contains pixels values. And i want to offset my gl_vertex with this attribute value. The problem is that my gl_vertex is in world units and the offset\attribute is in pixels. I can do it if i'm sending the screen size as uniforms and then convert the pixels to -1 to 1 values, and add it to the final gl_Position. But i don't want now to manage screen size events and sending it anyway every draw, every shader that i have. It there any way to do it with some matrix play, or

OpenCV: How to iterate each pixel in a specific area of an image

大兔子大兔子 提交于 2020-01-03 05:55:09
问题 I have an Image(see below) that is marked by two parallel green lines. This image is read in a OpenCV Mat in C++, the slope of green lines and their distances to the image center are already known. Now I want to iterate all the pixels in the area between these two green lines. How can i solve this problem? It will be very helpful, if somebody can give me a code example. Many thanks. 回答1: The formula for a slope is the following: y = mx + b Since you have two of them you should have two slope

c++ read pixels with GetDIBits()

家住魔仙堡 提交于 2020-01-03 05:18:35
问题 I'm trying to create a function which is equivalent to the windows API GetPixel() function, but I want to create a bitmap of my screen and then read that buffer. This is what I've got (Mostly copy pasted from google searches), when I run it it only prints out 0's. I think I've got most of it right, and that my issue is that I don't know how to read the BYTE variable. So my question is, what do I need to do in order to get it to print out some random colors (R,G or B) with my for loop?

Kinect depth conversion from mm to pixels

孤人 提交于 2020-01-03 05:16:14
问题 Does anybody knows how many pixels correspond for each millimeter of depth value in images taken from kinect for xbox360? I'm using the standard resolution and settings... Thanks! 回答1: 1 pixel corresponds to a number of millimiters that depends on the depth value of that pixels (i.e. its level of gray). The simplest way you can get the distance between two pixels in a depth image is to convert those pixels (which are expressed in Depth Space ) in real world coordinates (i.e. in Skeleton Space

Image Magick / Detect colors contained on a image

不羁岁月 提交于 2020-01-02 02:40:30
问题 What would be the simple process that would gives an array of the colors contained in an image ? 回答1: ImageMagick's "convert" command can generate a histogram. $ convert image.png -define histogram:unique-colors=true -format %c histogram:info:- 19557: ( 0, 0, 0) #000000 gray(0,0,0) 1727: ( 1, 1, 1) #010101 gray(1,1,1) 2868: ( 2, 2, 2) #020202 gray(2,2,2) 2066: ( 3, 3, 3) #030303 gray(3,3,3) 1525: ( 4, 4, 4) #040404 gray(4,4,4) . . . Depending on your language of choice and how you want the

Working in a BufferedImage's int[] pixels array

只愿长相守 提交于 2020-01-01 05:25:08
问题 When working with BufferedImage using the setRGB and getRGB methods, I noticed two things: the setRGB and getRGB methods can be incredibly slow on some systems (as much as two orders of magnitude slower than modifiyng the int[] array). there are no guarantee that a getRGB following a setRGB will give back the same pixel you passed This last point is basically pretty clear from the JavaDoc of setRGB , which states: ...For images with an IndexColorModel, the index with the nearest color is

javascript ImageData typed array read whole pixel?

本小妞迷上赌 提交于 2020-01-01 04:27:05
问题 So there is are a lot of examples on how to write an entire pixel from a Uint32Array view of the ImageData object. But is it possible to read an entire pixel without incrementing the counter 4 times? From hacks.mozilla.org, writing an rgba pixels looks like this . var imageData = ctx.getImageData(0, 0, canvasWidth, canvasHeight); var buf = new ArrayBuffer(imageData.data.length); var buf8 = new Uint8ClampedArray(buf); var data = new Uint32Array(buf); for (var y = 0; y < canvasHeight; ++y) {

blurring an image using PIL in python

懵懂的女人 提交于 2020-01-01 04:10:09
问题 I have been trying to blur an image using the PIL. from what I know i need to copy the image, and then change every pixel to the average of the pixels surrounding him, from the original picture. so I didn't get really far, i'm using python 3.3x from PIL import Image img = Image.open("source") im = Image.copy(img) I know how to use putpixe, and get a pixel's data, but I can't figure out how to get the average of the pixels around. Thanks in advance for the help! 回答1: You can just do: blurred

MFC中的CDC 绘图(2)

北城以北 提交于 2020-01-01 01:32:48
.面色(刷) 在Windows中,面状图必须用刷(brush)来填充,所以面色是由刷色来确定的。MFC中的刷类为CBrush(它也是CGDIObject的派生类),刷的创建与使用的步骤与笔的相似。 构造函数有4个: CBrush( ); // 创建一个刷的空对象 CBrush( COLORREF crColor ); // 创建颜色为crColor的实心刷 CBrush( int nIndex, COLORREF crColor ); // 创建风格由nIndex指定且颜色为crColor的条纹(hatch孵化)刷,其中nIndex可取条纹风格(Hatch Styles)值: 符号常量 数字常量 风格 HS_HORIZONTAL 0 水平线 HS_VERTICAL 1 垂直线 HS_FDIAGONAL 2 正斜线 HS_BDIAGONAL 3 反斜线 HS_CROSS 4 十字线(正网格) HS_DIAGCROSS 5 斜十字线(斜网格) CBrush( CBitmap* pBitmap ); // 创建位图为pBitmap的图案刷 如:pDC->FillRect( &rect, new CBrush( RGB(r, g, b) ) ); 与构造函数相对应,有多个创建不同类型刷的成员函数: BOOL CreateSolidBrush( COLORREF crColor );