pixel

how to handle SVG pixel snapping

纵然是瞬间 提交于 2019-12-06 02:56:30
问题 I am trying to render two svg lines using path element. The first line has 1px width and it is sharp The second line has 2px width and it is blurred The stroke-width is the same for both. How to fix this <svg xmlns="http://www.w3.org/2000/svg" version="1.1"> <path style="stroke-width:1;stroke:red;opacity:1;" d="M 300.5 250 L 300.5 300 "></path> <path style=" stroke-width:1;stroke:red;opacity:1;" d="M 350 250 L 350 300 "></path> </svg> 回答1: Mainly it's the 0.5 offset that makes the line sharp.

Calculate pixels between two points on a image

China☆狼群 提交于 2019-12-06 01:20: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.e. Take this image: http://i.stack.imgur.com/41vS1.png Then place two horizontal lines anywhere on the

Compare two images to check if they are the same

大兔子大兔子 提交于 2019-12-05 22:35:25
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 3rd party libs without hardcode a pixel-per-pixel image comparer? If not, any example of a function to

how to get the alpha channel alone in IOS?

不想你离开。 提交于 2019-12-05 20:55:53
I have the image and I need to produce the image of alpha coordinates only... I did the following but it produces the red colored image only what I did wrong in the code... Thanks in advance .... myCode: -(UIImage*)alphaAlone:(UIImage*)sourceImage { CGImageRef img=sourceImage.CGImage; CFDataRef m_DataRef; m_DataRef = CGDataProviderCopyData(CGImageGetDataProvider(img)); UInt8 *dataMasked=(UInt8 *)CFDataGetBytePtr(m_DataRef); double length=CFDataGetLength(m_DataRef); NSLog(@"length::%f",length); for(int index=0;index<length;index+=4) { dataMasked[index] =dataMasked[index]; dataMasked[index+1] =0

LeetCode 531. Lonely Pixel I

时光总嘲笑我的痴心妄想 提交于 2019-12-05 19:23:05
原题链接在这里: https://leetcode.com/problems/lonely-pixel-i/ 题目: Given a picture consisting of black and white pixels, find the number of black lonely pixels. The picture is represented by a 2D char array consisting of 'B' and 'W', which means black and white pixels respectively. A black lonely pixel is character 'B' that located at a specific position where the same row and same column don't have any other black pixels. Example: Input: [['W', 'W', 'B'], ['W', 'B', 'W'], ['B', 'W', 'W']] Output: 3 Explanation: All the three 'B's are black lonely pixels. Note: The range of width and height of the

react 移动端 1像素线的使用

自作多情 提交于 2019-12-05 17:31:22
   //1像素线文件 @mixin border($color,$width) { & { position: relative; &:before { content: ""; position: absolute; top: 0; left: 0; border-style: solid; border-color: $color; border-width: $width; transform-origin: 0 0; // padding: 1px; box-sizing: border-box; pointer-events: none; } &:last-child:before { // border-top:none; } } @media (-webkit-min-device-pixel-ratio:1),(min-device-pixel-ratio:1) { &:before { width: 100%; height: 100%; transform: scale(1); } } @media (-webkit-min-device-pixel-ratio:2),(min-device-pixel-ratio:2) { &:before { width: 200%; height: 200%; transform: scale(0.5); } }

python - opencv - convert pixel from bgr to hsv

微笑、不失礼 提交于 2019-12-05 11:04:47
img = cv2.imread('example.jpg') img_hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) # lower mask (0-10) lower_red = np.array([0, 50, 50]) upper_red = np.array([10, 255, 255] mask0 = cv2.inRange(img_hsv, lower_red, upper_red) # upper mask (170-180) lower_red = np.array([170, 50, 50]) upper_red = np.array([180, 255, 255]) mask1 = cv2.inRange(img_hsv, lower_red, upper_red) # join my masks mask = mask0 + mask1 height = mask.shape[0] width = mask.shape[1] # iterate over every pixel for i in range(height): for j in range(width): px = mask[i,j] print px # check if pixel is white or black if (px[2] >= 0

Pixel fonts in Silverlight 4

安稳与你 提交于 2019-12-05 10:07:17
Is there a way to render pixel fonts correctly in Silverlight 4? Without breaking text into paths or some sort of manual rendering because the text is dependent on data binding. Tweaks with UseLayoutRounding and .5px positioning shifting don't work. Just have created a custom TextBlock control which renders text with a pixel font and anti-aliasing turned off. Pixel Fonts for Silverlight MS render the font anti-aliased to make them look better... generally... but of course that does not work for pixel fonts that are already optimised for a specific display size. Manual rendering from a set of

python读取MNIST数据集

纵然是瞬间 提交于 2019-12-05 08:19:48
在学习ufldl课程时需要用到MNIST数据集,主页在 这里 。但由于该数据集为IDX文件格式,是一种用来存储向量与多维度矩阵的文件格式,不能直接读取。 mnist的结构如下 TRAINING SET LABEL FILE (train-labels-idx1-ubyte): [offset] [type] [ value ] [description] 0000 32 bit integer 0x00000801 ( 2049 ) magic number (MSB first ) 0004 32 bit integer 60000 number of items 0008 unsigned byte ?? label 0009 unsigned byte ?? label ........ xxxx unsigned byte ?? label The labels values are 0 to 9. TRAINING SET IMAGE FILE (train-images-idx3-ubyte): [offset] [type] [ value ] [description] 0000 32 bit integer 0x00000803 ( 2051 ) magic number 0004 32 bit integer 60000 number of images

How to rasterize OpenGL triangle on half-integer pixels centers

 ̄綄美尐妖づ 提交于 2019-12-05 07:29:14
OpenGL pixels/fragments are conceptually 1x1 squares centered on half-integer pixels. The OpenGL 4.5 specification states: A fragment is located by its lower left corner, which lies on integer grid coordinates. Rasterization operations also refer to a fragment’s center, which is offset by (1/2,1/2) from its lower left corner (and so lies on half-integer coordinates). Rasterizers typically assume that pixel centers lie on the integer grid. Since I am attempting to implement a correct OpenGL triangle fill I want to know if the following procedures seems sound. Let's take the simple case of a