pixel

Calculate pixels between two points on a image

独自空忆成欢 提交于 2019-12-10 10:23:17
问题 Turns out I am not explaining what I want to do very well so I am going to re-write the whole question again and add graphics to assist in the explanation. I am designing an app for android/iPhone. I have designed one algorithm for it already, but am stuck on the next one. What I am aiming to do is place two horizontal lines on an image (any image, just a picture taken by the iPhone/android) and then calculate what pixel the lines lye on, to then calculate the number of pixels between them. I

BMP文件格式学习总结

*爱你&永不变心* 提交于 2019-12-10 06:22:35
一个BMP文件可以包含4部分 1,文件头是14字节长的数据结构,定义如下: typedef struct _BFHEADER { unsigned short magic; unsigned int size; unsigned int reserved; unsigned int bitOffset; }bfHeader; 2.bmp 信息结构,结构定义如下: typedef struct _bmpInfoHead { unsigned int headSize; unsigned int width; unsigned int height; unsigned short planes; unsigned short bpp; unsigned int compress; unsigned int imageSize; unsigned int PelsPerMeterX; unsigned int PelsPerMeterY; unsigned int ClrUsed; unsigned int ClrImportant; unsigned int RedMask; unsigned int GreenMask; unsigned int BlueMask; unsigned int AlphaMask; unsigned int CsType; unsigned int

Calculating camera ray direction to 3d world pixel

十年热恋 提交于 2019-12-10 04:22:38
问题 I'm want to calculate ray directions from camera to pixel positions (in world coords) with given height as described in this paper. Camera image size is 640,480. I calibrated the intrinsic camera parameters and undistort each image. I measured the physical distance between camera and background plane (29 cm) as sketched here: 1 cm translates to 25 pixel (assuming quadratic pixels). My first approach was to calculate based on pixel- and camera position as follows: float3 pixPos = (float3)(u, v

HTML 5: Canvas copying Pixel Data within a Polygon

↘锁芯ラ 提交于 2019-12-09 21:05:46
问题 Good afternoon, I am new to Canvas in HTML 5 and in using it with Javascript. But I can see how powerful this really is and I needed help. I have done a search and could not find a clear answer to this. Perhaps someone here can help. I have created a context on the Canvas with a background image in place. Now, I want crop or copy a part of that image which is contained in Polygon Data and place it else where on the screen. I know how to create the background image. I know how to create a

Android Bitmap setPixel doens't work correctly? (set value, then read a different value)

Deadly 提交于 2019-12-09 19:33:10
问题 I use setPixel() to set the pixel to a certain value, but then when I call getPixel on the same pixel right after it, it returns a different value. It works fine when alpha==255, but any other value it gives a different value; This was tested on an Asus Transformer, Honeycomb 3.2 int newPixel=Color.argb(alpha, red, green, blue); if(x==74&&y==86){ Log.w("PuzzleMaker","newPixel:"+newPixel+","+image.getConfig().name()+","+image.isMutable()); } image.setPixel(x,y,newPixel); if(x==74&&y==86){ int

How to get the X Y coordinates and pixel size of a TextView?

空扰寡人 提交于 2019-12-09 17:07:17
问题 Given a TextView , is it possible to know at runtime the X and Y coordinates of where it is drawn? Is it also possible to know the size (width/length) in pixels? 回答1: There are getLeft() , getTop() , getWidth() , getHeight() methods for a view, it works for textView too. for more information , see the following link... getLeft() and getTop() will return you the starting x,y co-ordinates. http://developer.android.com/reference/android/view/View.html 回答2: Coordinates relative to parent int x =

关于gtk控件上字符串像素宽度计算--Pango

天涯浪子 提交于 2019-12-09 16:44:58
在实际Gtk图形开发过程中,经常有计算控件上字符串显示的像素宽度的需求,如何能正确计算出实际宽度? Pango的出现解决了这一问题! Pango以模块化,跨平台,跨控件库的形式实现,可以应用于各种不同的环境之中,Pango同样与Gtk+和Gnome项目有着紧密的关联。它的出现在于在Gtk+和Gnome项目中需要对国际化文本进行高质量的处理。通过Pango来计算字符串的宽度只是其中一小部分应用。 可以方便获取其源码: sudo apt-get source libpango1.0-dev Pango基于PangoLayout结构,在PangoLayout结构创建过程中会创建一以合适字体映射为基础的PangoContext结构,通过计算文本区的矩形区域大小来计算字符串像素的宽度。 简单应用样例如下(string_pixel_width.c): #include <gtk/gtk.h> int main (int argc, char *argv[]) { gtk_init (&argc, &argv); int width = 0; GtkWidget *label = NULL; PangoLayout *layout = NULL; label = gtk_label_new (""); gchar *s1 = "hello"; gchar *s2 = "@@@@@"; gchar

Getting the area occupied by a certain color onscreen - iOS

若如初见. 提交于 2019-12-09 14:00:22
问题 I'm trying to do something similar to what is asked in this question, but I don't really understand the answer given to that question and I'm not sure if it is what I need. What I need is simple, though I'm not so sure it's easy. I want to calculate the number of pixels on the screen that are a certain color. I understand that each 'pixel' that we see is actually a combination of pixels of different colors that appear to be, say, green. So what I need is that actual color- the one that the

Help with the theory behind a pixelate algorithm?

假如想象 提交于 2019-12-09 13:15:51
问题 So say I have an image that I want to "pixelate". I want this sharp image represented by a grid of, say, 100 x 100 squares. So if the original photo is 500 px X 500 px, each square is 5 px X 5 px. So each square would have a color corresponding to the 5 px X 5 px group of pixels it swaps in for... How do I figure out what this one color, which is best representative of the stuff it covers, is? Do I just take the R G and B numbers for each of the 25 pixels and average them? Or is there some

How can I measure pixels in Chrome without an extension?

99封情书 提交于 2019-12-09 08:01:07
问题 Due to security limitations at work, I am not allowed to install Chrome extensions. Chrome has a ruler built in to the developer tools, but I can't figure out how to define start and end points like a ruler would permit. Are there any tools or techniques for measuring pixels that don't require installing a Chrome extension? 回答1: You could create your own ruler functionality and paste it into the console. Here's a basic example: var fromX, fromY; var svg = document.createElementNS ('http://www