pixel

FreeImage: Get pixel color

╄→гoц情女王★ 提交于 2019-12-06 15:33:47
问题 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! 回答1: With FreeImagePlus

Calculate pixels within a polygon

萝らか妹 提交于 2019-12-06 15:25:17
问题 In an assignment for school do we need to do some image recognizing, where we have to find a path for a robot. So far have we been able to find all the polygons in the image, but now we need to generate a pixel map, that be used for an astar algorithm later. We have found a way to do this, show below, but the problem is that is very slow, as we go though each pixel and test if it is inside the polygon. So my question is, are there a way that we can generate this pixel map faster? We have a

OpenGL ES Pixel Art - Scaling

和自甴很熟 提交于 2019-12-06 14:56:04
Im having trouble displaying pixel based art (think retro tiles and art) on OpenGL Es 1.1 on the iPhones. Tiles are represented using 8bytes (1 byte for each row) with each bit representing a pixel being set or not. For example a tile with the number 8: 0 0 0 0 0 0 0 0 -> 0 0 1 1 1 0 0 0 -> xxx 0 1 0 0 0 1 0 0 -> x x 0 1 0 0 0 1 0 0 -> x x 0 0 1 1 1 0 0 0 -> xxx 0 1 0 0 0 1 0 0 -> x x 0 1 0 0 0 1 0 0 -> x x 0 0 1 1 1 0 0 0 -> xxx Converting this to OpenGL on iPhone using glDrawArrays(GL_POINTS, 0, 64); The logic is correct, but the problem is it doesn't give the retro effect. I was looking for

Convert jpeg/png to an array of pixels in java

前提是你 提交于 2019-12-06 14:42:57
How can I convert a string containing a jpeg or png to an array (preferably one dimensional) of pixels? Ideally using classes built into java? It turns out you need commons-fileupload . Look at the user guide for how to obtain the image InputStream . From there you can simply call: BufferedImage image = ImageIO.read(item.getInputStream()); From here on there are many ways: loop over the image dimensions and for each x and y call int rgb = image.getRGB(x, y); same as above, but call getRed(x, y) , getGreen(x, y) , getBlue(x, y) get the ColorModel and call the above methods there call getRGB

iOS retrieve different pixels in pixel by pixel comparison of UIImages

♀尐吖头ヾ 提交于 2019-12-06 14:36:19
I am trying to do a pixel by pixel comparison of two UIImages and I need to retrieve the pixels that are different. Using this Generate hash from UIImage I found a way to generate a hash for a UIImage. Is there a way to compare the two hashes and retrieve the different pixels? Rob If you want to actually retrieve the difference, the hash cannot help you. You can use the hash to detect the likely presence of differences, but to get the actual differences, you have to use other techniques. For example, to create a UIImage that consists of the difference between two images, see this accepted

How to Get Pixel Color in Android

有些话、适合烂在心里 提交于 2019-12-06 14:17:32
I'm using Intent to call and show an image from Gallery, and now I made it enable to get me the coordinates of the image in a TextView using these: final TextView textView = (TextView)findViewById(R.id.textView); final TextView textViewCol = (TextView)findViewById(R.id.textViewColor); targetImage.setOnTouchListener(new ImageView.OnTouchListener(){ @Override public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub int x=0; int y=0; textView.setText("Touch coordinates : " + String.valueOf(event.getX()) + "x" + String.valueOf(event.getY())); ImageView imageView = (

C++ drawing pixels question

别等时光非礼了梦想. 提交于 2019-12-06 13:55:19
问题 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

how can i draw an image pixel by pixel to jframe

↘锁芯ラ 提交于 2019-12-06 13:45:38
问题 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

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

蹲街弑〆低调 提交于 2019-12-06 13:27:09
问题 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

Replace all the colors of a photo except from the existing black and white pixels PYTHON

僤鯓⒐⒋嵵緔 提交于 2019-12-06 11:55:19
I'm a beginner in python and i would like the way to change all of the pixels of a photo to white, except the pixels that white or black that were already in the photo. I tried to use PIL but I couldn't find it. Thanks! i would like the way to change all of the pixels of a photo to white, except the pixels that white or black that were already in the photo. So basically you want to change all pixels to white except black, right? If so, then below work (note: it expect cv2 lib is installed on your machine) import cv2 import numpy as np img = cv2.imread('my_img.jpeg') img[img != 0] = 255 #