Questions tagged [getpixel]

GetPixel is a Windows GDI API function which retrieves the RGB color value of the pixel at a specific coordinates.

199 questions
62
votes
5 answers

C# - Faster Alternatives to SetPixel and GetPixel for Bitmaps for Windows Forms App

I am trying to teach myself C# and have heard from a variety of sources that the functions get and setpixel can be horribly slow. What are some of the alternatives and is the performance improvement really that significant? A chunk of my code for…
purdoo
  • 992
  • 1
  • 12
  • 16
42
votes
3 answers

OpenCV get pixel channel value from Mat image

Maybe I'm not looking hard enough, but everything seems to want me to use an array. Thus, how do I get the channel value for a particular pixel for foo if foo is something like Mat foo = imread("bar.png")?
HRÓÐÓLFR
  • 5,842
  • 5
  • 32
  • 35
14
votes
2 answers

How to edit/read pixel values in OpenCv from Mat variable?

I am looking for an efficient way for editing/reading pixels from Mat (or Mat3b) variable. I have used :- Image.at(i,j) but it seems to be very slow. I also used this:- A.data[A.channels()*A.cols*i + j + 0] but the problem I am facing with…
Ravi Upadhyay
  • 314
  • 1
  • 3
  • 16
14
votes
3 answers

QT QImage pixel manipulation

I am building a QT GUI application and use QImage for opening images. My problem is that I can't figure out how to use QImage's bit() and scanline() methods to get access at per pixel level. I've seen this post Qt QImage pixel manipulation…
theosem
  • 1,174
  • 3
  • 10
  • 22
9
votes
2 answers

How to get a Bitmap from VectorDrawable

I'm still trying to solve the problem I've had since a couple of days ago and I still have not found a solution. However, I am getting there step by step. Now I have run into another roadblock. I am trying to get Bitmap.getpixel(int x, int y) to…
9
votes
2 answers

Get Pixel color fastest way?

I'm trying to make an auto-cliker for an windows app. It works well, but it's incredibly slow! I'm currently using the method "getPixel" which reloads an array everytime it's called. Here is my current code: hdc = GetDC(HWND_DESKTOP); bx =…
Manitoba
  • 8,522
  • 11
  • 60
  • 122
7
votes
1 answer

C# get pixel color from another window

I want to get a pixel color from another window. The code I have is: using System; using System.Drawing; using System.Runtime.InteropServices; sealed class Win32 { [DllImport("user32.dll")] static extern IntPtr GetDC(IntPtr hwnd); …
5
votes
1 answer

VBA Get Colour of Pixel

I'm importing images into Excel, and trying to calculate the average colour for a user-defined area of the image. To do that, the user creates a boundary and then I loop through the screen pixels to see whether or not they fall within this boundary…
Nat Aes
  • 887
  • 5
  • 18
  • 34
4
votes
1 answer

How to compare a Color by the GetPixel Method and a Color passed in a method like Color.Black?

I have a loop that gets pixelcolors from an image and try to see if they are the same as the Color I passed into the method as parameter. I tried the Equals method but it doesn't work. I also tried the ToKnown method. It looks like that match…
Relok
  • 301
  • 4
  • 14
4
votes
1 answer

Why am I receiving "AttributeError: module 'image' has no attribute 'Image'"?

When I try to execute the program below: import image img = image.Image("LutherBellPic.jpg") print(img.getWidth()) print(img.getHeight()) p = img.getPixel(45, 55) print(p.getRed(), p.getGreen(), p.getBlue()) I keep receiving the following…
4
votes
0 answers

Convert plot into pixels in R

Does anyone know how to convert a simple plot into png_format without saving the picture...? In other words, I look for the most straight forward and fastest way to convert a simple plot into pixels, if it is not already (see code below)... EDIT:…
Robert
  • 133
  • 10
4
votes
3 answers

How to get the Pixel from coordinates of a polygon/point on openlayers4

var geometry = Feature.getGeometry(); var coordinate = geometry.getCoordinates(); var pixel = map.getPixelFromCoordinate(coordinate); i want to get the Pixel from coordinate,since i tried for point on openlayers4,i got the coordinate values as…
RamanaMuttana
  • 481
  • 6
  • 22
4
votes
2 answers

Huge negative values extracted by using getPixel() method

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…
max_tech91
  • 47
  • 5
4
votes
1 answer

Node.js: Efficient access of values in ndarray for pixel reading

I'm using npm:get-pixels which returns an ndarray and I'm having some trouble understanding how to correctly work this array. Assuming pixels is the ndarray console.log(pixels.get(800, 200, 0)); console.log(pixels.get(800, 200,…
Fletch
  • 450
  • 1
  • 4
  • 15
4
votes
2 answers

How to filter a specific color from a bitmapData object (or byte-array)

I'm looking for an efficient way to filter a specific color from a bitmapData object in ActionScript 3. Currently I use a loop with readByte32(). This takes about a second to process which is unacceptable. I have been trying to get paletteMap()…
user372950
  • 43
  • 1
  • 4
1
2 3
13 14