pixel

OpenGL ES Pixel Art - Scaling

血红的双手。 提交于 2019-12-23 02:50:31
问题 Im having trouble displaying pixel based art (think retro tiles and art) on OpenGL Es 1.1 on the iPhones. Tiles are represented using 8bytes (1 byte for each row) with each bit representing a pixel being set or not. For example a tile with the number 8: 0 0 0 0 0 0 0 0 -> 0 0 1 1 1 0 0 0 -> xxx 0 1 0 0 0 1 0 0 -> x x 0 1 0 0 0 1 0 0 -> x x 0 0 1 1 1 0 0 0 -> xxx 0 1 0 0 0 1 0 0 -> x x 0 1 0 0 0 1 0 0 -> x x 0 0 1 1 1 0 0 0 -> xxx Converting this to OpenGL on iPhone using glDrawArrays(GL

Get pixel values of a bitmap image in Android

末鹿安然 提交于 2019-12-23 02:07:45
问题 I need to develop an android application which do some image processing on the image input. For this, I need to get the pixel values of the bitmap in either an array or an object. Can anyone help me to grab the pixel-level details of a bitmap image. Thanks ! 回答1: to get pixel array of bitmap bitmap.getPixels(pixels, offset, stride, x, y, width, height); every pixel/value in array will be represented as Color with ARGB value. 回答2: if you want to get the value of on pixel do this int pixel =

Get pixel values of a bitmap image in Android

邮差的信 提交于 2019-12-23 02:07:09
问题 I need to develop an android application which do some image processing on the image input. For this, I need to get the pixel values of the bitmap in either an array or an object. Can anyone help me to grab the pixel-level details of a bitmap image. Thanks ! 回答1: to get pixel array of bitmap bitmap.getPixels(pixels, offset, stride, x, y, width, height); every pixel/value in array will be represented as Color with ARGB value. 回答2: if you want to get the value of on pixel do this int pixel =

Convert jpeg/png to an array of pixels in java

和自甴很熟 提交于 2019-12-22 14:08:27
问题 How can I convert a string containing a jpeg or png to an array (preferably one dimensional) of pixels? Ideally using classes built into java? 回答1: It turns out you need commons-fileupload. Look at the user guide for how to obtain the image InputStream . From there you can simply call: BufferedImage image = ImageIO.read(item.getInputStream()); From here on there are many ways: loop over the image dimensions and for each x and y call int rgb = image.getRGB(x, y); same as above, but call getRed

Compare two images to check if they are the same

故事扮演 提交于 2019-12-22 10:47:17
问题 Which is the efficient way to compare two images (Bitmaps), to check if they are the same or not? I've tried to document me and I've read that I need to re-size both images to around 16x16px, but I don't get the expected result. I've tried to compare the resized images using .Equals: If img1.Equals(img2) then msgbox("are equals!") End if I've seen AForge image library but I can't found any method inside to compare Images. Is there way to do an efficient Image comparison using .NET classes or

How do GUI developers deal with variable pixel densities?

纵然是瞬间 提交于 2019-12-22 05:50:52
问题 Todays displays have a quite huge range in size and resolution. For example, my 34.5cm × 19.5cm display (resulting in a diagonal of 39.6cm or 15.6") has 1366 × 768 pixels, whereas the MacBook Pro (3rd generation) with a 15" diagonal has 2880×1800 pixels. Multiple people complained that everything is too small with such high resolution displays (see example). That is simple to explain when developers use pixels to define their GUI. For "traditional displays", this is not a big problem as the

How to read a pixel off of the screen?

て烟熏妆下的殇ゞ 提交于 2019-12-22 05:34:11
问题 I am trying to make a simple bot for a web game, so I would like to be able to read the color of a pixel on the screen. I've done this on Windows with GetPixel(), but I can't seem to figure it out on OS X. I been looking online and came across glReadPixel. When I made a simple command line tool in XCode, I put in the following code. However, I cannot seem to make it work. I keep getting a EXC_BAD_ACCESS error from this: GLfloat r; glReadPixels(0, 0, 1, 1, GL_RED, GL_FLOAT, &r); I thought the

How do I correctly translate pixel coordinates to canvas coordinates in Android?

末鹿安然 提交于 2019-12-22 04:10:34
问题 I am capturing a MotionEvent for a long click in an Android SurfaceView using a GestureListener . I then need to translate the coordinates of the MotionEvent to canvas coordinates, from which I can generate custom map coordinates (not Google Maps). From what I have read, I take that given MotionEvent e , e.getX() and e.getY() get pixel coordinates. How can I convert these coordinates to the SurfaceView 's canvas coordinates? Here is my GestureListener for listening for long clicks: /** *

How to draw OpenCL calculated pixels to the screen with OpenGL?

99封情书 提交于 2019-12-22 02:34:11
问题 I wan't to do some calculated pixelart with OpenCL and display this directly on the display without CPU roundtripping. I could use interoperability of OpenCL with OpenGL and write to the texture-banks of the GPU and display the texture with OpenGL. I was wondering what would be the best way to do this, since I do not need any 3d stuff, just 2d pixelart. 回答1: The best way would be to use OpenCL/OpenGL interop, if your OpenCL implementation supports it. This allows OpenCL to access certain

How can I get the pixel colors in matplotlib?

妖精的绣舞 提交于 2019-12-21 21:34:11
问题 I am plotting a collection of rectangles with matplotlib.patches . My code is: import matplotlib.pyplot as plt import matplotlib.patches as patches fig = plt.figure(figsize=(14, 10)) for i in rectangles_list: ax1 = fig.add_subplot(111, aspect='equal') ax1.add_patch(patches.Rectangle( (x[i], y[i]), width[i], height[i], alpha = 1.0, facecolor = colors_list[i] ) ) plt.show() The rectangles may be overlapping, therefore some of them may be completely hidden. Do you know if it is possible to get