pixel

FreeImage: Get pixel color

风流意气都作罢 提交于 2019-12-04 21:48:33
I'm writing a little application that reads color of each pixel in image and writes it to file. First I did it in Python, buit it's too slow on big images. Then I discovered FreeImage library, which I could use, but I can't understand how to use GetPixelColor method. Could you please provide an example on how to get color, for example, of pixel[50:50]? Here is information about GetPixelColor: http://freeimage.sourceforge.net/fnet/html/13E6BB72.htm . Thank you very much! With FreeImagePlus using a 24 or 32 bit image, getting the pixel at coords 50, 50 would look like this: fipImage input;

how can i draw an image pixel by pixel to jframe

我们两清 提交于 2019-12-04 19:49:42
I'm very beginner at java, until this day i tried to do what i thought myself. So the day is here; i've got all pixels of an image to array as rgb. i want to click a button and to make animated-like image has created pixel by pixel. this is what i did that not works; import java.awt.BorderLayout; import java.awt.FlowLayout; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.ImageIcon;

How to get pixel coordinates of a pixel inside an html5 canvas

岁酱吖の 提交于 2019-12-04 19:38:51
I know that you can get the value of each pixel inside the html5 Canvas using getImageData() and .data() but is there a way to get their coordinates and not just their values? var w = ctx.canvas.width, h = ctx.canvas.height; var id = ctx.getImageData(0,0,w,h); var d = id.data; for (var y=0;y<h;++y){ for (var x=0;x<w;++x){ var i=(y*w+x)*4; var r=d[i],g=d[i+1],b=d[i+2],a=d[i+3]; } } It's just as easy to derive the x/y from the index while looping through the image data array, or to add in offsets if you have fetched only part of the canvas pixels. for (var i=0,len=d.length;i<len;i+=4){ var x=i/4

C++ drawing pixels question

ぐ巨炮叔叔 提交于 2019-12-04 19:08:42
How to make window, or more like clipping region , where I'll be able to draw pixels? It might use WinApi, however I don't want my project to look like winapi one, so it will have int main(){} instead of int WINAPI WinMain(HINSTANCE ... I have found an example, where I'm able to draw in console window int main() { COLORREF color = RGB(255,0,0); // COLORREF to hold the color info SetConsoleTitle("Pixel In Console?"); // Set text of the console so you can find the window HWND hwnd = FindWindow(NULL, "Pixel In Console?"); // Get the HWND HDC hdc = GetDC(hwnd); // Get the DC from that HWND for(

How can I get the pixel colors in matplotlib?

≡放荡痞女 提交于 2019-12-04 17:13:53
I am plotting a collection of rectangles with matplotlib.patches . My code is: import matplotlib.pyplot as plt import matplotlib.patches as patches fig = plt.figure(figsize=(14, 10)) for i in rectangles_list: ax1 = fig.add_subplot(111, aspect='equal') ax1.add_patch(patches.Rectangle( (x[i], y[i]), width[i], height[i], alpha = 1.0, facecolor = colors_list[i] ) ) plt.show() The rectangles may be overlapping, therefore some of them may be completely hidden. Do you know if it is possible to get the colors of the visible rectangles? I mean the colors of the rectangles that are not completely hidden

How to pixelate a set of lines into a matrix

与世无争的帅哥 提交于 2019-12-04 17:12:30
It looks a very simple question. There are many lines available as their two endpoints. The question is how to discretize them into a matrix . Then the matrix can be used for image processing purposes. At the following figure example lines (yellow) and their corresponding pixelated demonstrations are shown. A piece of code in any language would be of great help and strongly recommended and of course is in advance appreciated. Note that performance and accuracy are very important factors. Also as demonstrated each point of line must have only one pixel (i.e., element of matrix) associated.

HTML 5: Canvas copying Pixel Data within a Polygon

我怕爱的太早我们不能终老 提交于 2019-12-04 16:37:31
Good afternoon, I am new to Canvas in HTML 5 and in using it with Javascript. But I can see how powerful this really is and I needed help. I have done a search and could not find a clear answer to this. Perhaps someone here can help. I have created a context on the Canvas with a background image in place. Now, I want crop or copy a part of that image which is contained in Polygon Data and place it else where on the screen. I know how to create the background image. I know how to create a polygon over that image and I know how to copy image data to another part of the screen. So how would I

How to check pixel color of a UIView or a UIImage?

只谈情不闲聊 提交于 2019-12-04 15:32:54
I am trying to check if an entire UIView is filled with one color. I managed to get a screenshot of the UIView using the following block of code: UIImage *image = [self imageFromView]; NSFileManager *fileManager = [NSFileManager defaultManager]; NSData *myImageData = UIImagePNGRepresentation(image); [fileManager createFileAtPath:@"/Users/{username}/Desktop/myimage.png" contents:myImageData attributes:nil]; [imageData writeToFile:@"/testImage.jpg" atomically:YES]; The method implementation for imageFromView is the following: - (UIImage*)imageFromView{ UIImage *bitmapImage;

html5 canvas: clipping by color

佐手、 提交于 2019-12-04 15:29:53
is there any way to choose an area on the canvas by color and clip it? I want to be able to clip an undefined aread that the only thing in common between all the pixels is that they all have the same color. thanks Live Demo Below is a way to select a color.. and do whatever you want with it. I pass a color I want to find iterate over every pixel and remove the color that matches, since Im not sure what you meant by clipping I assumed you mean remove. However please note on large images this method will be slow. // Takes an array with 3 color components, rgb function removeColor(color){ var

Fast pixel drawing library

寵の児 提交于 2019-12-04 15:08:34
My application produces an "animation" in a per-pixel manner, so i need to efficiently draw them. I've tried different strategies/libraries with unsatisfactory results especially at higher resolutions. Here's what I've tried: SDL : ok, but slow; OpenGL : inefficient pixel operations; xlib : better, but still too slow; svgalib , directfb , (other frame buffer implementations): they seem perfect but definitely too tricky to setup for the end user. (NOTE: I'm maybe wrong about these assertions, if it's so please correct me) What I need is the following: fast pixel drawing with performances