getpixel

C# get pixel color from another window

允我心安 提交于 2019-12-05 21:07:18
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); [DllImport("user32.dll")] static extern Int32 ReleaseDC(IntPtr hwnd, IntPtr hdc); [DllImport("gdi32.dll")] static extern uint GetPixel(IntPtr hdc, int nXPos, int nYPos); static public System.Drawing.Color GetPixelColor(int x, int y) { IntPtr hdc = GetDC(IntPtr.Zero); uint pixel = GetPixel(hdc, x, y); ReleaseDC(IntPtr.Zero, hdc); Color color = Color.FromArgb((int)

Perl & Image::Magick, getting color values by pixel

蓝咒 提交于 2019-12-04 04:53:45
问题 I'm using Perl and the Image::Magick module to process some JPEGs. I'm using the GetPixels sub to get the RGB components of each pixel. e.g. my @pixels = $img->GetPixels( width => 1, height => 1, x => 0, y => 0, map => 'RGB', #normalize => 1 ) print Dumper \@pixels; $img->Resize( width => 1, height => 1, filter => 'Lanczos' ); @pixels = $img->GetPixels( width => 1, height => 1, x => 0, y => 0, map => 'RGB', #normalize => 1 ); print Dumper \@pixels; $img->Write('verify.jpg'); I've found that

android Bitmap getPixel

孤街浪徒 提交于 2019-12-04 01:58:16
问题 I need to get the color of a pixel in order to compare it with a color from my color.xml file, but all values are negative and this comparison will always return a false result. How to get the proper color value? This color may be transparent. I've read this but I need an answer, not a link to theory. bmp.getPixel(n.x, n.y) is returning zero when I'm expecting to return a propper value for color #00FFFFFF Thanks 回答1: You could do something like this: int pixel = Color.RED; //bmp.getPixel(n.x,

Get Pixel Color on screen Java?

允我心安 提交于 2019-12-01 23:50:24
Hello I am trying to get the color of a particular pixel on my JFrame. This is my code. My frame is red. The problem I am having is when I click the Frame it should return me the RGB color for red that is (255,0,0) but when I click at different points i sometimes get the RGB color for white (255,255,255) what is the problem in my code guys? public class guiTest extends JFrame { private static Shape ellipse; private static Robot rb; public guiTest() { super("4-connected approach"); setLayout(new FlowLayout()); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); setSize(800,800);

Perl & Image::Magick, getting color values by pixel

陌路散爱 提交于 2019-12-01 22:58:58
I'm using Perl and the Image::Magick module to process some JPEGs. I'm using the GetPixels sub to get the RGB components of each pixel. e.g. my @pixels = $img->GetPixels( width => 1, height => 1, x => 0, y => 0, map => 'RGB', #normalize => 1 ) print Dumper \@pixels; $img->Resize( width => 1, height => 1, filter => 'Lanczos' ); @pixels = $img->GetPixels( width => 1, height => 1, x => 0, y => 0, map => 'RGB', #normalize => 1 ); print Dumper \@pixels; $img->Write('verify.jpg'); I've found that getPixels is returning two bytes per channel, e.g. $VAR1 = [ 46260, 45232, 44975 ]; $VAR1 = [ 58271,

How to get a Bitmap from VectorDrawable

拟墨画扇 提交于 2019-11-30 15:35:19
问题 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 return the Color of what the user has touched using OnTouchListener . The pie is a VectorDrawable resource, vectordrawable.xml I don't need to do anything with the pixel data yet, I just need to test it. So I made a TextView that will spit out the

How to get a Bitmap from VectorDrawable

蹲街弑〆低调 提交于 2019-11-30 15:22:50
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 return the Color of what the user has touched using OnTouchListener . The pie is a VectorDrawable resource, vectordrawable.xml I don't need to do anything with the pixel data yet, I just need to test it. So I made a TextView that will spit out the Color touched. public class MainActivity extends AppCompatActivity { ImageView imageView; TextView

QT QImage pixel manipulation

≡放荡痞女 提交于 2019-11-29 07:00:28
问题 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 problems but this is only for the first pixel of each row. Is this correct or I got it all wrong? thanks in advance 回答1: The scanlines correspond to the the height of image, the columns correspond to the width of the image. According to the docs, the

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

倖福魔咒の 提交于 2019-11-27 16:14:50
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 doesn't work beacuse the values that synthesize the two colors don't match. Example: With GetPixel: {Name=ff000000, ARGB=(255, 0, 0, 0)} Color.Black: {Name=Black, ARGB=(255, 0, 0, 0)} if (pixelColor.ToArgb().Equals(startingOffsetColor.ToArgb())) { } The code above works, but I still want to know if there is any better method or any method that can reduce

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

 ̄綄美尐妖づ 提交于 2019-11-27 12:27:11
问题 I am looking for an efficient way for editing/reading pixels from Mat (or Mat3b) variable. I have used :- Image.at<Vec3b>(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 this is when I run this loop for(i=0; j<A.rows; i++){ for(j=0; j<A.cols; j++){ A.data[A.channels()*A.cols*i + j + 0] = 0; A.data[A.channels()*A.cols*i + j + 1] = 0; A.data[A.channels()*A.cols*i + j + 2] = 0; } } only a portion of image is blackened.