pixel

Edit pixel values

浪尽此生 提交于 2019-11-30 21:29:39
How to edit pixel values of an image in Java. Is there any method to change pixel values? For example: BufferedImage image = ... image.setRGB(x, y, 0); From documentation : void setRGB(int x, int y, int rgb) //Sets a pixel in this BufferedImage to the specified RGB value. In BufferedImage : public void setRGB(int x, int y, int rgb) Sets a pixel in this BufferedImage to the specified RGB value. The pixel is assumed to be in the default RGB color model, TYPE_INT_ARGB, and default sRGB color space. For images with an IndexColorModel, the index with the nearest color is chosen. http://download

How to measure the pixel width of a digit in a given font / size (C#)

青春壹個敷衍的年華 提交于 2019-11-30 19:25:05
I am trying to calculate the pixel width of Excel columns, as described in this post , using the official formula from the OpenXML specification. However, in order to apply this formula, I need to know the Maximum Digit Width of the Normal font, which is the pixel width of the widest numeric digit. The OpenXML specification gives this example as a clarification: Using the Calibri font as an example, the maximum digit width of 11 point font size is 7 pixels (at 96 dpi). I have checked that this is correct by visually examining a Calibri 11-point digit and it is indeed 7 pixels wide. So, I am

How do I access a pixel in OpenCV?

拜拜、爱过 提交于 2019-11-30 18:54:45
问题 I have an x,y point coordinate, how would I use this to access a specific point on an IplImage? Thanks 回答1: Use CV_IMAGE_ELEM CV_IMAGE_ELEM( image_header, elemtype, y, x*N+C ) E.g. given an 8-bit 3 channel (such as RGB) IplImage* img , we want (x,y) on the 2nd channel: CV_IMAGE_ELEM(img, uchar, y, (x * 3) + 1)) 回答2: OR, you can do this. for more matrix operation, see here. http://note.sonots.com/OpenCV/MatrixOperations.html int col, row, z; uchar b, g, r; for( y = 0; row < img->height; y++ )

Commonly used pixel sizes for webpages and their pros/cons

百般思念 提交于 2019-11-30 17:09:09
What are the most commonly used pixel sizes (primarily widths) and what are there advantages and disadvantages? How can I best find a happy medium to give a good experience to people with a wide variety of monitor sizes? An answer with an explanation rather than just the size would be greatly appreciated. the most grids use a width of 960px. (When the design has a fixed width). When you take a look at global statistics 1024 range resolutions are still the most common: http://gs.statcounter.com/#resolution-ww-monthly-201006-201106 Do not use 1000 width. (You have to count in the border width of

Highlight differences between images

◇◆丶佛笑我妖孽 提交于 2019-11-30 14:06:55
There is this image comparison code I am supposed to modify to highlight/point out the difference between two images. Is there a way to modify this code so as to highlight the differences in images. If not any suggestion on how to go about it would be greatly appreciated. int width1 = img1.getWidth(null); int width2 = img2.getWidth(null); int height1 = img1.getHeight(null); int height2 = img2.getHeight(null); if ((width1 != width2) || (height1 != height2)) { System.err.println("Error: Images dimensions mismatch"); System.exit(1); } long diff = 0; for (int i = 0; i < height1; i++) { for (int j

Android specifying pixel units (like sp, px, dp) without using XML

谁说我不能喝 提交于 2019-11-30 14:00:34
Is it possible to specify the pixel unit in code. What I mean is, say I have a layout and I want the size to be 20dp, then is there any way to do so without writing in a layout xml Ted Hopp In a view: DisplayMetrics metrics = getContext().getResources().getDisplayMetrics(); float dp = 20f; float fpixels = metrics.density * dp; int pixels = (int) (fpixels + 0.5f); In an Activity, of course, you leave off the getContext() . To convert from scaled pixels ( sp ) to pixels, just use metrics.scaledDensity instead of metrics.density . EDIT: As @Santosh's answer points out, you can do the same thing

How to Convert a WPF inch unit to Winforms pixels and vice versa?

纵然是瞬间 提交于 2019-11-30 10:27:44
I have a window that designed at WPF and I used that on center of a WinForms owner. Now, I want to move the owner form and at the moment my WPF window has also to be moved in the center of the form! But I have a problem, Only when window is in the center of the form that form in the center of the screen. And otherwise act in a different form than the Windows coordinates. I just add the displacement values of the form to window location. Now I have come to the conclusion that the coordinates of the pixels on WPF Windows are different by WinForms! How to convert WPF window location to WinForms

Pyqt get pixel position and value when mouse click on the image

南楼画角 提交于 2019-11-30 10:04:18
I would like to know how i can select a pixel with a mouse click in an image (QImge) and get pixel position and value. Thanks Jared self.image = QLabel() self.image.setPixmap(QPixmap("C:\\myImg.jpg")) self.image.setObjectName("image") self.image.mousePressEvent = self.getPos def getPos(self , event): x = event.pos().x() y = event.pos().y() xioxox First you have to draw the image. You can do this my making a QLabel widget and call setPixmap . You need to convert your QImage to QPixmap before doing this (you can use QPixmap.fromImage(img) ). You can get mouse clicks by subclassing the QImage and

Cocoa Point vs Pixel and PPI

僤鯓⒐⒋嵵緔 提交于 2019-11-30 09:46:56
问题 Well, I have basically two questions regarding screen resolution in iOS devices. 1) In iOS documentation, on the Point vs Pixels section, it states the coordinates are passed in to framework as points, and that "One point does not necessarily correspond to one pixel on the screen." as found here: https://developer.apple.com/library/ios/#documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/WindowsandViews/WindowsandViews.html When they are different? Up until now I was assuming they were

In Python, how can I draw to a pixel on the screen directly?

こ雲淡風輕ζ 提交于 2019-11-30 09:22:19
I'm wanting to do something like the following: ... pixel[0,0] = [ 254, 0, 0 ] # Draw R at pixel x0y0 pixel[2,1] = [ 0, 254, 0 ] # Draw G at pixel x2y1 pixel[4,2] = [ 0, 0, 254 ] # Draw B at pixel x4y2 ... I hope to display many different configurations of pixels and colours in a short space of time -- writing to an intermediary file would be too expensive. How should I best go about achieving this goal in Python? hamstergene Direct answer: This can only be done with OS-specific APIs. Some OSes does not allow changing pixels on the screen directly. On Windows, you can use pywin32 libraries to