pixels

Browsers truncate border values to integers

隐身守侯 提交于 2019-12-05 14:17:37
问题 Whenever a non-integer pixel value is used for the border of an element, the browser simply truncates the value to become an integer. Why is this the case? I'm aware that the border will not actually take up part of a pixel, but these types of values are sometimes used in combination with others to form full pixels. For example, the left and right border having widths of 1.6px should cause the total width of the element to increase by 3px. This works because the full value is stored in memory

How to make bmp image from pixel byte array in java

若如初见. 提交于 2019-12-05 14:13:22
I have a byte array containing pixel values from a .bmp file. It was generated by doing this: BufferedImage readImage = ImageIO.read(new File(fileName)); byte imageData[] = ((DataBufferByte)readImage.getData().getDataBuffer()).getData(); Now I need to recreate the .bmp image. I tried to make a BufferedImage and set the pixels of the WritableRaster by calling the setPixels method. But there I have to provide an int[], float[] or double[] array. Maybe I need to convert the byte array into one of these. But I don't know how to do that. I also tried the setDataElements method. But I am not sure

'Stride' Woes from a TransformedBitmap Object

狂风中的少年 提交于 2019-12-05 05:22:22
I have a 2208 x 3000 TransformedBitmap object with format {Indexed8} that I'm do .CopyPixels() on. I'm using (int)((formattedBitmap.PixelWidth * formattedBitmap.Format.BitsPerPixel + 7) / 8) (assuming 'formattedBitmap' is the name of the image from which I'm trying to copy the pixels) for the 'stride' value in my method call and an array of bytes which is 2208 in length. I have something just like this working elsewhere in the code (where the format of the image is {Gray8}. However, where I'm trying to do this same thing on the aforementioned image, I continually get an "Argument Out of Range"

How does bicubic interpolation work?

流过昼夜 提交于 2019-12-05 01:22:05
问题 After reading text about this said topic, i found out that it considers 16 of the original neighboring pixels. What i want to know is how does it compute the color value of the new pixel. If the color values of the 16 pixels are known, how could you compute the value of the new one? 回答1: I think it's pretty well explained in Wikipedia. You need the intensity values of 4*4=16 pixels, from which you can calculate the interpolated value at any point within that 4*4 grid. If you mean how to do

iPhone App - Display pixel data present in buffer on screen

蓝咒 提交于 2019-12-04 23:29:49
I have the source code for a video decoder application written in C, which I'm now porting on iphone. My problem is as follows: I have RGBA pixel data for a frame in a buffer that I need to display on the screen. My buffer is of type unsigned char. (I cannot change it to any other data type as the source code is too huge and not written by me.) Most of the links I found on the net say about how to "draw and display pixels" on the screen or how to "display pixels present in an array", but none of then say how to "display pixel data present in a buffer". I'm planning to use quartz 2D. All I need

Generating pixel values of line connecting 2 points

旧时模样 提交于 2019-12-04 16:41:26
I am having some troubles trying to connect separate points in my picture (see below). Right now, the code I have is as follows: first_time = resulting_coords[0:40] for i in range(len(first_time)): if(i < (len(first_time))-1): cv2.line(copy_test_image[0], (resulting_coords[i,0],resulting_coords[i,1]), (resulting_coords[i+1,0],resulting_coords[i+1,1]), (0,0,225), 2) elif(i>=(len(first_time))-1): # print(i) cv2.line(copy_test_image[0], (resulting_coords[i,0],resulting_coords[i,1]), (resulting_coords[0,0],resulting_coords[0,1]), (0,0,225), 2) Which actually gives the result I want: Results in But

Drawing Images on Html5 Canvas at floating point coordinates

邮差的信 提交于 2019-12-04 13:03:36
As you know using rounded coordinates while drawing on canvas is faster. Also floating coordinates may cause unintended gaps on canvas. For example, you are drawing google map tiles to canvas, 256x256 tiles work well, if the starting coordinates are integer. If not, to avoid one pixel unpainted lines, you should round the coordinates. Here, that's Ok. But, what if you should use scaling, transformation over canvas, how can you round the coordinates? e.g. ctx.drawImage(image, round(x), round(y), 256, 256); is OK. But what if ctx.scale(1.0/65536); ctx.translate(118079.4); ctx.drawImage(image, x,

How do I find the display size of my system in Emacs?

梦想的初衷 提交于 2019-12-04 12:07:33
I use the same .emacs across multiple machines, operating systems and platforms. I would like the default frame size of Emacs upon invocation to be relative to the available screen size (e.g. 96 lines work very well on a 1600x1200 desktop screen, but on an 1280x800 laptop I need to specify no more than 68 lines). Is there an emacs-lisp expression that returns the width & height of the system's screen? Update: I just found a similar question , but for some reason neither (x-display-pixel-width) nor (display-pixel-width) can be found in my GNU Emacs 23.2 on Windows XP system. Continuing to

Auto Layout vs Frame Sizes

孤者浪人 提交于 2019-12-04 09:11:41
So I'm slightly embarrassed to ask this because it seems so rudimentary but ever since beginning iOS development (about a year of self/internet teaching), when not using storyboards, I have relied heavily on frame sizes and used auto layout very sparingly. In Objective C I find myself in situation where I need to use Auto Layout more often but with Swift I can animate a frame's x and y origins, its center, etc... I have never run into a situation where I could not accomplish what I want with frame sizes and pixel locations alone and I have done some fairly complex view work. My question is,

IllegalArgumentException in Bitmap.getPixels()

安稳与你 提交于 2019-12-04 07:48:47
I'd like to copy the data from a Bitmap into an int[] using getPixels() , this is my current code: int[] pixels = new int[myBitmap.getHeight() * myBitmap.getWidth()]; myBitmap.getPixels(pixels, 0, myBitmap.getWidth(), 0, 0, myBitmap.getHeight(), myBitmap.getWidth()); for(int i = 0; i < myBitmap.getHeight() * myBitmap.getWidth(); i++) { Log.e(TAG, "pixel"+i+"" +pixels[i]); } But it's throwing an exception: 05-04 20:24:08.281: ERROR/AndroidRuntime(5700): Uncaught handler: thread main exiting due to uncaught exception 05-04 20:24:08.296: ERROR/AndroidRuntime(5700): java.lang