pixel

C++ Getting RGB from hBitmap

南楼画角 提交于 2019-12-09 06:48:01
问题 Working with bitmaps is very new to me so I've been really struggling with the online tutorials and strategies that I've read through. Basically my goal is to scan the screen for a particular RGB value. I believe the steps to do this is to capture the screen in a hBitmap and then produce an array of RGB values from it that I can scan through. I originally started with GetPixel but that is very slow. The solution was to use GetDIBits which produces the array of RGB values. The problem is that

How to use the ImageGrab.grab().load() function or any other function to get pixel updates?

南楼画角 提交于 2019-12-09 03:48:14
问题 I have been trying to check if a pixel on the screen is changing. What do I need to do? I have surfed the internet for a long time with no success. I have experimented with the code given on the net, and found out that my code is only giving data from the screen that was open when the code was run. ie, if the screen was white when the code was run, it will read pixels from the white screen, even though the screen color already changed. from PIL import ImageGrab px=ImageGrab.grab().load() m=px

Get RGB value from screen pixels with python

江枫思渺然 提交于 2019-12-09 01:02:23
问题 To get the RGB values from a pixel of the screen with coordinates (x,y) in Python, I do: import PIL.ImageGrab rgb = PIL.ImageGrab.grab().load()[x,y] It was working as I expected until I did: rgb = PIL.ImageGrab.grab().load()[1673,0] Instead of the RGB values of the pixel, I received: IndexError: image index out of range I don't understand why because my screen has 1920x1080 resolution. How can I fix this? 回答1: If you do: import PIL.ImageGrab PIL.ImageGrab.grab().size You will see the

How to Convert a WPF inch unit to Winforms pixels and vice versa?

吃可爱长大的小学妹 提交于 2019-12-08 23:32:38
问题 I have a window that designed at WPF and I used that on center of a WinForms owner. Now, I want to move the owner form and at the moment my WPF window has also to be moved in the center of the form! But I have a problem, Only when window is in the center of the form that form in the center of the screen. And otherwise act in a different form than the Windows coordinates. I just add the displacement values of the form to window location. Now I have come to the conclusion that the coordinates

How to clear pixel of BufferedImage in java?

六眼飞鱼酱① 提交于 2019-12-08 12:00:52
问题 In java, I read an image and then go through the pixels and if its color distance is < 30, then I want to clear the image by changing its alpha to 0. This is my code: But this is not working. It is having no effect... Does anyone see the problem? Thanks import java.awt.Color; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import javax.imageio

Get x,y position of a specific pixel

女生的网名这么多〃 提交于 2019-12-08 09:07:33
问题 I got a little problem, I got a code, that reads all pixels and takes the RGB color of the pixel. But before that, I cut the picture into chunks, so I can also calculate larger images, without exceeding memory. Here is the code: Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED); try { decoder_image = BitmapRegionDecoder.newInstance(filePath, false); } catch (IOException e) { e.printStackTrace(); } try { boolean bool_pixel = true; final int width = decoder_image.getWidth(

Create bitmap from binary data

佐手、 提交于 2019-12-08 05:14:12
问题 I have the following: byte[] pixels = new byte[28] { 0x00, 0x00, 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x00, 0x00 }; This is an upside down exclamation mark like this: 0x00, 0x00, 0x30, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, 0x00, 0x00 Which in binary is: 00000000 00000000 00110000 00000000

Ndimage or skimage functions for returning pixel neighborhoods

断了今生、忘了曾经 提交于 2019-12-08 04:52:50
问题 Does anyone know of any efficient ways of computing a pixel's neighborhood and returning it in array form based on an input image and pixel coordinates? I would like to compute a number of pixel level features, such as integrated intensity and the Haralick features, based on these neighborhoods. 回答1: I can think of at least two approaches: Construct slice objects corresponding to your coordinates, then index into the array with those slices individually. Construct index arrays based on your

【Python_OpenCv】笔记4:python,OpenCv中对图片像素的操作以及图片基本属性的获取方法

走远了吗. 提交于 2019-12-08 03:00:57
#coding:utf-8 #=================================================================================================== #文件说明: # 第三节:图像处理 #开发环境: # Ubuntu14.04+Python2.7+IDLE+IPL #时间地点: # 陕西师范大学 2016.11.19 #作  者: # 九月 #=================================================================================================== import numpy as np #[1]导入python中的数值分析,矩阵运算的程序库模块 import cv2 #[2]导入OpenCv程序库模块 from matplotlib import pyplot as plt #[3]仅仅导入了matplotlib绘图程序库中的一个子模块 #1--我们可以根据像素的行和列的坐标获取它们的像素值 #2--对BGR图像而言,返回的是B,G,R的像素值 #3--对灰度图像而言,返回的是灰度值 srcImg = cv2.imread("/home/wei/Image/cat.png",1) #[1]彩色图片

Converting PNG file to bitmap array in Python

六月ゝ 毕业季﹏ 提交于 2019-12-08 02:56:06
问题 I would like to convert a PNG image to a 2 dimensional array where each array holds a list of the RGB values of that specific pixel. How could one create a program to read-in a *.png file and convert to this type of data structure? 回答1: If you have PIL installed then you can create an image with Image.open and get the colors like so: data = [image.getpixel((x, y)) for x in range(image.width) for y in range(image.height)] 回答2: You can use the existing pygame module. Import a file into a