pixel

Retrieving a pixel alpha value for a UIImage (MonoTouch)

三世轮回 提交于 2019-11-29 08:35:57
This question is a duplicate of 1042830 , but MonoTouch-specific. Is there a way that's safer than allocating an IntPtr, drawing into it using CGBitmapContext and then reading bytes at the appropriate offset? I don't know if it's kosher to answer your own question, but: protected CGBitmapContext CreateARGBBitmapContext(CGImage inImage) { var pixelsWide = inImage.Width; var pixelsHigh = inImage.Height; var bitmapBytesPerRow = pixelsWide * 4; var bitmapByteCount = bitmapBytesPerRow * pixelsHigh; //Note implicit colorSpace.Dispose() using(var colorSpace = CGColorSpace.CreateDeviceRGB()) { /

Getting Pixel Color from an Image using CGPoint in Swift 3

孤街醉人 提交于 2019-11-29 08:09:12
I am try this PixelExtractor class in Swift 3, get a error; Cannot invoke initializer for type 'UnsafePointer' with an argument list of type '(UnsafeMutableRawPointer?)' class PixelExtractor: NSObject { let image: CGImage let context: CGContextRef? var width: Int { get { return CGImageGetWidth(image) } } var height: Int { get { return CGImageGetHeight(image) } } init(img: CGImage) { image = img context = PixelExtractor.createBitmapContext(img) } class func createBitmapContext(img: CGImage) -> CGContextRef { // Get image width, height let pixelsWide = CGImageGetWidth(img) let pixelsHigh =

Getting pixel data from UIImageView — works on simulator, not device

谁都会走 提交于 2019-11-29 07:46:59
Based on the responses to a previous question , I've created a category on UIImageView for extracting pixel data. This works fine in the simulator, but not when deployed to the device. I should say not always -- the odd thing is that it does fetch the correct pixel colour if point.x == point.y; otherwise, it gives me pixel data for a pixel on the other side of that line, as if mirrored. (So a tap on a pixel in the lower-right corner of the image gives me the pixel data for a corresponding pixel in the upper-left, but tapping on a pixel in the lower-left corner returns the correct pixel colour)

web前端入门到实战:纯CSS实现数据上报和HTML验证

戏子无情 提交于 2019-11-29 06:26:53
一、纯CSS实现数据上报 举个例子,要跟踪并统计某个按钮的点击事件: .button-1:active::after { content: url(./pixel.gif?action=click&id=button1); display: none; } .button-2:active::after { content: url(./pixel.gif?action=click&id=button2); display: none; } 此时,当我们点击按钮的时候,相关行为数据就会上报给服务器,这种上报,就算把JS禁掉也无法阻止。 当然,我们可以统计的不仅仅是单击行为,hover行为,focus行为都可以统计,当然,还有很多其他方面的。例如: 1. 不支持CSS3浏览器比例统计 web前端开发学习Q-q-u-n: 767273102 ,分享学习的方法和需要注意的小细节,不停更新最新的教程和学习方法(详细的前端项目实战教学视频) .any-element { background: url(./pixel.gif?css=2); background-image: url(./pixel.gif?css=3), none; } 例如,我的Chrome发出的图片请求地址就是: 类似的,我们可以检测支持其他一些CSS属性的比例,要比单纯看浏览器的占比要精准的多

matlab 图像处理--OPAP信息隐藏

老子叫甜甜 提交于 2019-11-29 05:52:55
%%OPAP I1 = imread('Lena.jpg'); [M N] = size(I1); I2 = I1; x = input('input bits'); for i = 1 : M for j = 1 : N S = round(rand(1 , x)) pixel = I2(i,j); count = 1; for k = 1 : x pixel2 = bitset(pixel , count , S(k)); count = count + 1; if (count > x) break end end sgm = pixel2 - pixel; if(sgm > 2^(x-1) && sgm < 2^x && pixel >= 2^x) finalP = pixel2 - 2^x; else if(sgm < -2^(x-1) && sgm > -2^x && pixel <= 255 - 2^x) finalP = pixel2 + 2^x; else finalP = pixel2; end end I2(i,j) = finalP; end end imshow(I2) 来源: https://blog.csdn.net/V1AN_zzz/article/details/100533433

Is a CSS pixel really an absolute unit? That is, is 1 inch = 96px true?

旧街凉风 提交于 2019-11-29 05:44:36
问题 The official W3C documentation says: 1 px = 1/96th of 1 in In my previous 18.5 inch screen, the screen.width was 1367 px and the screen width in inches was 14 inches . By the W3C formula: 14 * 96 px = 1344 px The W3C formula deviated by 20/14 px per inch . Since the deviation is too low, and 1 inch on my screen was 97.4 px I accepted the W3C formula, and believed that a CSS pixel is an absolute unit of measure , meaning it is always equal to 0.75 pt (a physical unit). This week I bought a 21

CSS style - percentage vs em vs px? [closed]

懵懂的女人 提交于 2019-11-29 04:41:25
After reading several articles on the web I´m a bit confused about when to use percent , em or px for div´s , input´s , font´s , buttons and so on... For the site I´m working on we wan´t to add a responsive design, and from what I understand from different articles than percent is the way to go for elements and div´s . But than I get confused because I´m thinking that I should be able to get a responsive design even if I use px för layout and than set different width, height in px depending on device/screen resolution...? And is there a best practice for when to use what? And not only for

Finding closest non-black pixel in an image fast

笑着哭i 提交于 2019-11-29 04:29:37
I have a 2D image randomly and sparsely scattered with pixels. given a point on the image, I need to find the distance to the closest pixel that is not in the background color (black). What is the fastest way to do this? The only method I could come up with is building a kd-tree for the pixels. but I would really want to avoid such expensive preprocessing. also, it seems that a kd-tree gives me more than I need. I only need the distance to something and I don't care about what this something is. As Pyro says, search the perimeter of a square that you keep moving out one pixel at a time from

setRGB() in java

淺唱寂寞╮ 提交于 2019-11-29 04:09:02
I am using setRGB() for changing the values of the pixel of an image. int rgb=new Color(0,0,0).getRGB(); image1.setRGB(i,j,rgb); //where i,j is the boundaries of the image Here,i am setting all the pixel values with white. But the change is not getting reflected in the image. Any One knows about the setRGB() how it works? Lo Juego White is in RGB 255,255,255 so: Color myWhite = new Color(255, 255, 255); // Color white int rgb = myWhite.getRGB(); try { BufferedImage img = null; try { img = ImageIO.read(new File("bubbles.bmp")); } catch (IOException e) { } for (int i = 0; i < 100; i++) { for

Different Layouts For Different Screen Sizes On Android?

。_饼干妹妹 提交于 2019-11-29 03:14:38
问题 So I made an app using in Eclipse using the Graphical Editor, AbsoluteLayout , fixed pixel values, etc... just bad practice in general. It defaulted to a 3.7in screen . Is there any way to design a separate layout for each screen size and have the program choose which to load based on said screen size? 回答1: Provide different layouts for different screen sizes By default, Android resizes your application layout to fit the current device screen. In most cases, this works fine. In other cases,