pixels

'Stride' Woes from a TransformedBitmap Object

寵の児 提交于 2019-12-07 01:23:18
问题 I have a 2208 x 3000 TransformedBitmap object with format {Indexed8} that I'm do .CopyPixels() on. I'm using (int)((formattedBitmap.PixelWidth * formattedBitmap.Format.BitsPerPixel + 7) / 8) (assuming 'formattedBitmap' is the name of the image from which I'm trying to copy the pixels) for the 'stride' value in my method call and an array of bytes which is 2208 in length. I have something just like this working elsewhere in the code (where the format of the image is {Gray8}. However, where I'm

Change all white pixels of image to transparent in OpenCV C++

核能气质少年 提交于 2019-12-06 15:41:11
I have this image in OpenCV imgColorPanel = imread("newGUI.png", CV_LOAD_IMAGE_COLOR); : When I load it in with grey scale imgColorPanel = imread("newGUI.png", CV_LOAD_IMAGE_GRAYSCALE); it looks like this: However I want to remove the white background or make it transparent (only it's white pixels), to be looking like this: How to do it in C++ OpenCV ? You can convert the input image to BGRA channel (color image with alpha channel) and then modify each pixel that is white to set the alpha value to zero. See this code: // load as color image BGR cv::Mat input = cv::imread("C:/StackOverflow

Gaussian Filter without using ConvolveOp

自闭症网瘾萝莉.ら 提交于 2019-12-06 09:53:18
I am trying to create a guassian filter without using ConvolveOp. I am having a lot of problems trying to get this to work, i have gotten a grey scale filter to work, but for this one i am having problems finding the location of a pixels 8 neighbors, so i can apply the filter. here is what i have so far. Is this the right way to approach getting each of the pixels? public class Gaussian implements Filter { public void filter(PixelImage pi) { Pixel[][] data = pi.getData(); Pixel[][] original = data; int kernel_rows = 3; int kernel_cols = 3; // define kernel here (double loop), these are the 1

Android DrawBitmap in DIP?

心已入冬 提交于 2019-12-06 09:45:14
Can I use DrawBitmap with display independant pixels on android? If not, is there a suitable alternative? Thanks. Are you looking for how to change pixels to dip? then you can use the following code int pixel = 120; final float scale = getResources().getDisplayMetrics().density; int dip = (int) (pixel* scale + 0.5f); you can use this dip, it will be 来源: https://stackoverflow.com/questions/4146328/android-drawbitmap-in-dip

How do I find the display size of my system in Emacs?

孤街醉人 提交于 2019-12-06 04:19:51
问题 I use the same .emacs across multiple machines, operating systems and platforms. I would like the default frame size of Emacs upon invocation to be relative to the available screen size (e.g. 96 lines work very well on a 1600x1200 desktop screen, but on an 1280x800 laptop I need to specify no more than 68 lines). Is there an emacs-lisp expression that returns the width & height of the system's screen? Update: I just found a similar question, but for some reason neither (x-display-pixel-width)

Auto Layout vs Frame Sizes

喜你入骨 提交于 2019-12-06 03:18:01
问题 So I'm slightly embarrassed to ask this because it seems so rudimentary but ever since beginning iOS development (about a year of self/internet teaching), when not using storyboards, I have relied heavily on frame sizes and used auto layout very sparingly. In Objective C I find myself in situation where I need to use Auto Layout more often but with Swift I can animate a frame's x and y origins, its center, etc... I have never run into a situation where I could not accomplish what I want with

CSS width/height pixel and percentage calculation combintaion?

喜夏-厌秋 提交于 2019-12-06 02:58:35
问题 Is there a way to set the height/width CSS properties to something like that: 100% - 50px So if the total 100% is 1000px, then the end result would be 950px. And the 100% is set by the browser size. UPDATE: What I'm trying to do is: I have two div, the first div's height is 50px, I would like the second div's height to cover the remaining space. 回答1: There is a solution in css3, and I also actually think it has been supported in IE for sometime. Example: width: -moz-calc(25% - 1em); See http:

How to determine and interpret the pixel format of a CGImage

半世苍凉 提交于 2019-12-06 00:09:36
问题 I'm loading this (very small) image using: UIImage* image = [UIImage named:@"someFile.png"]; The image is 4x1 and it contains a red, green, blue and white pixel from left to right, in that order. Next, I get the pixel data out of the underlying CGImage: NSData* data = (NSData*)CGDataProviderCopyData(CGImageGetDataProvider(image.CGImage)); Now, for some reason, the pixel data is laid out differently depending on the iOS device. When I run the app in the simulator or on my iPhone 4, the pixel

Bresenham line algorithm (thickness)

心不动则不痛 提交于 2019-12-05 20:56:24
I was wondering if anyone knew of any algorithm to draw a line with specific thickness, based on Bresenham's line algorithm or any similar. On a second thought, I've been wondering about for each setPixel(x,y) I'd just draw a circle, e.g.: filledCircle(x,y,thickness); for every x,y but that would of course be very slow. I also tried to use dictionary but that would fill the memory in no time. Check the pixels I'm about to draw on if they have the same color, but that's also not efficient enough for large brushes. Perhaps I could somehow draw half circles depending on the angle? Any input would

Getting pixel coordinates efficiently in Matlab

帅比萌擦擦* 提交于 2019-12-05 19:40:36
I would like to create a function in Matlab that, given an image, will allow one to select a pixel by clicking on it in the image and return the coordinates of the pixel. Ideally, one would be able to click on several pixels in the image in succession, and the function would store all the respective coordinates in a matrix. Is there a way to do this in Matlab? ginput Graphical input from mouse or cursor Syntax [x,y] = ginput(n) [x,y] = ginput [x,y,button] = ginput(...) Description [x,y] = ginput(n) enables you to identify n points from the current axes and returns their x- and y-coordinates in