pixel

Get the percentage usage of every colour in an image

匿名 (未验证) 提交于 2019-12-03 02:45:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have this one working but it is so damn slow on jpeg images and also needs some changing. I need to know the individual colours in an image (with a tolerance of +/- 1 for RGB) and the % of the image that is that colour. so if an image was black and white it would say something like White : 74% Black : 26% The code below works like I said but I need to add a tolerance system as well and I have no idea on how I would do that. private Dictionary<string, string> getPixelData(Bitmap image) { Dictionary<string, string> pixelData = new Dictionary

How to calculate the pixel width of a String in JavaFX?

匿名 (未验证) 提交于 2019-12-03 02:44:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: It appears that there is no API call to calculate the width (in pixels) of a text string in Java FX 2.2. There have been suggestions of workarounds on other forums, but my efforts to create or find any code that returns the width of a String, either using the default font or otherwise, have failed. Any help would be appreciated. 回答1: If you are just measuring the default font without CSS: Place the String to be measured in a Text object. Get the width of the Text object's layout bounds. If you need to apply CSS: Place the String to

how to take an average of a 2x2 pixel block?

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have an image and I have to take the average of the color of 2x2 pixel. take the average color of a 2x2 pixel block, then compute the distance between the colors in the image and the colors available for our use. I have no idea what taking the average of 2x2 pixel block means. How to solve this? Thank you. 回答1: You can process non-overlapping blocks of an image using blockproc Im = imread('coins.png'); %// example image fun = @(block_struct) mean( block_struct.data(:) ); %// anonymous function to get average of a block B = blockproc(Im,[2

Consolidated Scrolling - “Pixel by Pixel” + “Item by Item”

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've a Drag-Drop framework in which scrolling support is already there (Pixel by Pixel scrolling). This works good in case Virtualization is not enabled but if it is enabled then it gets messed up. As the logic of scrolling is based on Viewport height and as per MSDN we've - MSDN- If CanContentScroll is true, the values of the ExtentHeight, ScrollableHeight, ViewportHeight, and VerticalOffset properties are number of items. If CanContentScroll is false, the values of these properties are Device Independent Pixels. Also If Virtualization is

Buffered image pixel manipulation

匿名 (未验证) 提交于 2019-12-03 02:33:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have this code: public Image toNegative() { int imageWidth = originalImage.getWidth(); int imageHeight = originalImage.getHeight(); int [] rgb = null; // new int[imageWidth * imageWidth]; originalImage.getRGB(0, 0, imageWidth, imageHeight, rgb, 0,imageWidth); for (int y = 0; y < imageHeight; y++) { for (int x = 0; x < imageWidth; x++) { int index = y * imageWidth + x; int R = (rgb[index] >> 16) & 0xff; //bitwise shifting int G = (rgb[index] >> 8) & 0xff; int B = rgb[index] & 0xff; R = 255 - R; G = 255 - R; B = 255 - R; rgb[index] =

Huge negative values extracted by using getPixel() method

匿名 (未验证) 提交于 2019-12-03 02:31:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am having a problem with an image processing app I am developing (newbie here). I am trying to extract the value of specific pixels by using the getPixel() method. I am having a problem though. The number I get from this method is a huge negative number, something like -1298383. Is this normal? How can I fix it? Thanks. 回答1: I'm not an expert, but to me it looks like you are getting the hexadecimal value. Perhaps you want something more understandable like the value of each RGB layer. To unpack a pixel into its RGB values you should do

Convert Image to binary stream

匿名 (未验证) 提交于 2019-12-03 02:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: There are two sides to my app, on one side I'm using C++ in order to read the frames from a camera using Pleora's EBUS SDK. When this stream is first received, before I convert the buffer to an image, I am able to read the stream 16 bits at a time in order to perform some calculations for each pixel, i.e. there exists a 16 bit chunk of data for each pixel. Now the second half is a Django web app where I am also presented this video output, this time via an ffmpeg, nginx, hls stream. When the user clicks on the video I want to be able to take

Calculating the required buffer size for the WriteableBitmap.WritePixels method

匿名 (未验证) 提交于 2019-12-03 02:23:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How do I calculate the required buffer size for the WriteableBitmap.WritePixels method? I am using the overload taking four parameters, the first is an Int32Rect, the next is a byte array containing the RGBA numbers for the colour, the third is the stride (which is the width of my writeable bitmap multiplied by the bits per pixel divided by 8), and the last is the buffer (referred to as the offset in Intellisense). I am getting the Buffer size is not sufficient runtime error in the below code: byte[] colourData = { 0, 0, 0, 0 }; var

How do I normalize an image?

匿名 (未验证) 提交于 2019-12-03 02:17:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: If I have a series of pixels, which range from say -500 to +1000, how would I normalize all the pixels on the same gradient so that they fall between a specific range, say 0 and 255? 回答1: Some pseudocode like this would scale values linearly from one range to another oldmin=-500 oldmax=1000 oldrange=oldmax-oldmin; newmin=0 newmax=255; newrange=newmax-newmin; foreach(oldvalue) { //where in the old scale is this value (0...1) scale=(oldvalue-oldmin)/oldrange; //place this scale in the new range newvalue=(newrange*scale)+newmin } 回答2: Your

Xcode 9.1 iOS simulator: Pixel Accurate option disabled and grayed out

匿名 (未验证) 提交于 2019-12-03 02:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: On Xcode 9.1 the Pixel Accurate option is disabled and grayed out under the Window menu. How can you re-enable this option? 回答1: The original answer is wrong! Russ from the Apple Simulator team says: To take app store screenshots uncheck the "Optimize rendering for Window Scale" option in the Debug menu. I recommend turning this back on normally as it improves rendering performance. Double-clicking does not make the device use native resolution, that's just an accident due to the size of device you tested with and the size of your screen. ==