pixel

Getting the pixel value of a TIFF image in Java

偶尔善良 提交于 2019-12-08 02:03:12
问题 The ImageIO package doesn't work with .tif images and I cannot create a BufferedImage (Class I'm more familiar with) from a .tif file. How do I easily get the pixel value of a TIFF image in Java? How can I do it FAST? I'm not experienced with image processing and some sample code would be greatly appreciated! Thanks! 回答1: You will need the Java Advanced Imaging API: JAI in order to work with TIFF images. From the JAI API description: TIFF In addition to the baseline specification, the encoder

移动端1px解决方案 1px border.css

安稳与你 提交于 2019-12-08 01:53:34
将以下代码放在border.css文件中,然后引入 常用className border : 整个盒子都有边框 border-top : 上边框 border-right : 右边框 border-bottom : 下边框 border-left : 左边框 **使用:<div class= "border-top" ></div>** 使用时注意:该class名字只作用于(display:block)的块级元素上,其它看不到效果 想改变边框颜色的话,将代码中的所有颜色统一全部替换成你需要的颜色 @charset "utf-8" ; .border, .border-top, .border-right, .border-bottom, .border-left, .border-topbottom, .border-rightleft, .border-topleft, .border-rightbottom, .border-topright, .border-bottomleft { position : relative ; } .border::before, .border-top::before, .border-right::before, .border-bottom::before, .border-left::before, .border-topbottom

实现真正的1px的边框 border

萝らか妹 提交于 2019-12-08 01:52:28
实现真正的1px的边框 border 问题 解决的问题是1像素的边框在某些移动设备中会显示过粗,主要原因是设备进行了放大,成为了2px; 解决 利用媒体查询和 min-device-pixel-ratio 实现解决办法. scss代码如下: //定义一个混合器,用于多次复用. @ mixin border-1px ($color) { // 用于伪类的定位 position : relative; & :after { //定义一个伪类,将它置于元素的底部. display : block; position : absolute; left : 0 ; bottom : 0 ; width : 100 %; border-top : 1 px solid $color; content : ' ' ; } } // 使用上面定义的混合器 @ include border-1px (red); // 定义全局类:.border-1px;期望根据不同dpi去缩放,使用@media实现. // 最小dpi为1.5的设备进行相关设置:1.5*0.7~1 @ media (-webkit-min-device-pixel-ratio: 1.5 ),(min-device-pixel-ratio: 1.5 ) { .border-1px { & ::after { -webkit-

Method that processes pixels in a certain way

回眸只為那壹抹淺笑 提交于 2019-12-07 23:49:27
问题 in a code snippet, I have found the following method that I could not understand: static void processPixels(int width, int height, int *pixels, int *rgb) { int R[256]; int G[256]; int B[256]; for (int i = 0; i < 256; i++) { R[i] = (rgb[i] << 16) & 0x00FF0000; G[i] = (rgb[i] << 8) & 0x0000FF00; B[i] = rgb[i] & 0x000000FF; } for (int i = 0; i < width * height; i++) { pixels[i] = (0xFF000000 & pixels[i]) | (R[(pixels[i] >> 16) & 0xFF]) | (G[(pixels[i] >> 8) & 0xFF]) | (B[pixels[i] & 0xFF]); } }

关于CSS中的PX值(像素)

二次信任 提交于 2019-12-07 23:29:47
场景: 人物:前端实习生「阿树」与 切图工程师「玉凤」 事件:设计师出设计稿,前端实现页面 玉凤:树,设计稿发给你啦,差那么点像素,就叼死你┏(  ̄へ ̄)=☞ 阿树:~(>_<)~毛问题噶啦~ 阿树:哇靠,为啥你给的设计稿是640px宽 ,iPhone 5不是320px宽吗??? 玉凤:A pixel is not a pixel is not a pixel, you know ? 阿树:(#‵′),I know Google。。。 为什么会出现以上的情况,难道他们当中一位出错了,摆了这样的乌龙? 事实上,他们都是对的,只是谈的不是同一个「像素」。 此像素非彼像素 设备像素(device pixel) : 设备像素设是物理概念,指的是设备中使用的物理像素。 比如iPhone 5的分辨率640 x 1136px。 CSS像素(css pixel) : CSS像素是Web编程的概念,指的是CSS样式代码中使用的逻辑像素。 在CSS规范中,长度单位可以分为两类,绝对(absolute)单位以及相对(relative)单位。px是一个相对单位,相对的是设备像素(device pixel)。 比如iPhone 5使用的是Retina视网膜屏幕,使用2px x 2px的 device pixel 代表 1px x 1px 的 css pixel,所以设备像素数为640 x 1136px

how to get the alpha channel alone in IOS?

╄→гoц情女王★ 提交于 2019-12-07 17:28:10
问题 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)

Interpret PNG pixel data

浪子不回头ぞ 提交于 2019-12-07 12:05:36
问题 Looking at the PNG specification, it appears that the PNG pixel data chunk starts with IDAT and ends with IEND (slightly clearer explanation here). In the middle are values that don't make sense to make sense to me. How can I get usable RGB values from this, without using any libraries (ie from the raw binary file)? As an example, I made a 2x2px image with 4 black rgb(0,0,0) pixels in Photoshop: Here's the resulting data (in the raw binary input, the hex values, and the human-readable ASCII):

python - opencv - convert pixel from bgr to hsv

蓝咒 提交于 2019-12-07 07:32:54
问题 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

Pixel fonts in Silverlight 4

五迷三道 提交于 2019-12-07 06:27:29
问题 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. 回答1: Just have created a custom TextBlock control which renders text with a pixel font and anti-aliasing turned off. Pixel Fonts for Silverlight 回答2: MS render the font anti-aliased to make them look better... generally... but of course that does

Draw 1 pixel stroke-width graph in a A4 svg drawing

时间秒杀一切 提交于 2019-12-07 01:12:18
问题 I'm currently trying to draw some graphics in svg, the paper size is A4, 1 logic unit stands for 1mm. So I set the viewport to be 297mmx210mm, viewbox as 297x210. The problem now is that stroke-width of the graph I draw is no longer 1 pixel. For example, <!DOCTYPE html> <html> <body> <svg width="297mm" height="210mm" viewBox='0 0 297 210' style="border: 1px solid #cccccc;"> <path stroke="black" fill="none" stroke-width='1' d='M 10 10 L 60 10'/> <path stroke="black" fill="none" stroke-width=