pixels

Resizing an image in cm C#

北慕城南 提交于 2019-12-10 14:07:37
问题 I have an requirement that asks for an image with 10 X 6,88 cm. I know that I can't simple convert from cm to pixels, cause one pixel size depends on the user display resolution. I would like to know if there is a way to resize an image to have that size in cm. (I need to keep the image extension also. e.g.: can't convert it to a pdf or other extension) 回答1: It really depends on in which resolution the user will print the image (sizes in cm makes little sense other than when printed). If the

ARKit: Plot a Node at a specific pixel at a specific Z distance from Camera

浪尽此生 提交于 2019-12-10 12:07:11
问题 Referring to the image above. I have a Red Node at the center of the screen with a distance of 1.0 unit (1 meter away) [See iPhone Portrait Top View] What I do is I capture a screenshot of the iPhone screen and the resulting image is 750 x 1334 pixels [See iPhone Portrait Front View] sceneView.snapshot() What I want to do is put 4 Red Square Nodes located on the four sides of the iPhone screen relative to the Red Circle (at the dead center of the screen). I am making this to mark where I did

Android DrawBitmap in DIP?

霸气de小男生 提交于 2019-12-10 11:17:34
问题 Can I use DrawBitmap with display independant pixels on android? If not, is there a suitable alternative? Thanks. 回答1: Are you looking for how to change pixels to dip? then you can use the following code int pixel = 120; final float scale = getResources().getDisplayMetrics().density; int dip = (int) (pixel* scale + 0.5f); you can use this dip, it will be 来源: https://stackoverflow.com/questions/4146328/android-drawbitmap-in-dip

iPhone App - Display pixel data present in buffer on screen

余生长醉 提交于 2019-12-10 00:34:41
问题 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

How can I find out a web page viewers pixels per inch?

。_饼干妹妹 提交于 2019-12-08 19:26:49
问题 Can anyone think of a way I can discover a users pixels per inch? I want to ensure that a image displays in a web browser exactly the size I need it to, so using a combination of resolution (which I can get from the user agent) and pixels per inch I could do this. However, I'm not sure if there is any way to discover a users pixels per inch, ideally using JavaScript or some other non-invasive method. Any suggestions? Thanks, CJ 回答1: You could use the following javascript function to get the

Plotting a line on a grid layout, then addition veritcal axis

懵懂的女人 提交于 2019-12-08 11:17:16
问题 SOLUTION AT BOTTOM OF THIS QUESTION I have this code: public void lineImproved(int x0, int y0, int x1, int y1, Color color) { int pix = color.getRGB(); int dx = x1 - x0; int dy = y1 - y0; raster.setPixel(pix, x0, y0); if (Math.abs(dx) > Math.abs(dy)) { // slope < 1 float m = (float) dy / (float) dx; // compute slope float b = y0 - m*x0; dx = (dx < 0) ? -1 : 1; while (x0 != x1) { x0 += dx; raster.setPixel(pix, x0, Math.round(m*x0 + b)); } } else if (dy != 0) { // slope >= 1 float m = (float)

Change all white pixels of image to transparent in OpenCV C++

荒凉一梦 提交于 2019-12-08 03:52:46
问题 I have this image in OpenCV imgColorPanel = imread("newGUI.png", CV_LOAD_IMAGE_COLOR); : When I load it in with grey scale imgColorPanel = imread("newGUI.png", CV_LOAD_IMAGE_GRAYSCALE); it looks like this: However I want to remove the white background or make it transparent (only it's white pixels), to be looking like this: How to do it in C++ OpenCV ? 回答1: You can convert the input image to BGRA channel (color image with alpha channel) and then modify each pixel that is white to set the

Photoshop like Magic Wand for selecting pixels of a similar color, but in VB.NET

纵然是瞬间 提交于 2019-12-07 22:44:58
问题 Im a noob. I need to write some vb.net code that looks at a picture and "removes" the blackish pixels. Here's the scenario. A wound care doctor takes a picture of a persons hand on a flat bed scanner. The nice pink palm print is there but it is surrounded by blackish pictures. I want to make the picture pop by programatically "removing" or recoloring the pixels that are in the blackish range. i.e. the Photoshop magic wand select and delete. I have not code to start off. Hoping for some

Bresenham line algorithm (thickness)

浪子不回头ぞ 提交于 2019-12-07 17:43:29
问题 I was wondering if anyone knew of any algorithm to draw a line with specific thickness, based on Bresenham's line algorithm or any similar. On a second thought, I've been wondering about for each setPixel(x,y) I'd just draw a circle, e.g.: filledCircle(x,y,thickness); for every x,y but that would of course be very slow. I also tried to use dictionary but that would fill the memory in no time. Check the pixels I'm about to draw on if they have the same color, but that's also not efficient

Getting pixel coordinates efficiently in Matlab

[亡魂溺海] 提交于 2019-12-07 13:00:55
问题 I would like to create a function in Matlab that, given an image, will allow one to select a pixel by clicking on it in the image and return the coordinates of the pixel. Ideally, one would be able to click on several pixels in the image in succession, and the function would store all the respective coordinates in a matrix. Is there a way to do this in Matlab? 回答1: ginput Graphical input from mouse or cursor Syntax [x,y] = ginput(n) [x,y] = ginput [x,y,button] = ginput(...) Description [x,y]