pixel

相机标定棋盘格制作

末鹿安然 提交于 2019-12-02 12:00:55
#include <opencv2/opencv.hpp> #include <iostream> /** 输出指定格式的棋盘图 @param width 棋盘的宽度,不要超过10000. @param height 棋盘的高度,不要超过10000. @param pixel 每个格子的大小,建议行和列的格子数一个为奇数一个为偶数 @param fileName 输出的文件名,支持相对路径和绝对路径,支持png、jpg、bmp等. */ static int checkerboard(int width, int height, int pixel, const char* fileName) { if (width > 0 && height > 0 && pixel > 0 && width <= 10000 && height <= 10000 && pixel <= width && pixel <= height && fileName) { cv::Mat image = cv::Mat::zeros(cv::Size(width, height), CV_8U); uchar* uc = image.data; for (size_t j = 0; j < height; j++) { for (size_t i = 0; i < width; i++) { if (

OpenGL ES: Undo in a Pixel Painting App

ⅰ亾dé卋堺 提交于 2019-12-02 11:32:11
I'm currently working on an app that allows the user to draw pixelated images using OpenGL ES, but I don't know how to implement an undo function. How could I do it? I thought of using an image for every pixel and adding it to an array. Basically, how can I store the rectangles I use as pixels? charse you can try : NSData *data = [NSData dataWithBytes:vertexBuffer length:vertexCount * sizeof(GL_FLOAT) * 2] ; if (self.vertexBuffers == nil) self.vertexBuffers = [[NSMutableArray alloc] init]; [self.vertexBuffers addObject:data]; save every draw point to a array; if undo clear old buffer

Monochrome grayscale image, get the intensity of a pixel

℡╲_俬逩灬. 提交于 2019-12-02 11:06:15
问题 I'm attempting to derive an intensity value for a particular pixel in a monochrome "grayscale" image. I have some pseudocode, but thus far I've been unable to implement something that really works. /** * Retrieve the intensity value at location ('row', 'column') of the image 'img' and return it * Note: * - the 2D image is stored as an 8bit, 1D, row-major array of type byte * - the data type byte is signed in Java * - Slide 27 of chapter 2 introduces the representation of an image * @param img

Fast Pixel Search in Java

折月煮酒 提交于 2019-12-02 10:12:47
问题 i have a problem regarding a pixel search in java. At the moment my Class/Programm is searching pixel by pixel thats to slow for my purposes. I wan't Java to search the Pixels much faster so i came to the idea to ask you guys. I'm searching for the pixels by an RGB color. This is my Source code: final int rot = 0; final int gruen = 0; final int blau = 0; int toleranz = 1; Color pixelFarbe; Dimension bildschirm = Toolkit.getDefaultToolkit().getScreenSize(); Robot roboter = null; try { roboter

Mapping pixels of two matrices

ε祈祈猫儿з 提交于 2019-12-02 10:07:12
Say that I have two matrices of the following sizes: matrix_1 = 30090x2 matrix_2 = 170x177 Assume here that the number of rows n matrix_1 represents the number of pixels . You can see that the size of matrix_2 is equal to the number of pixels. What I'm trying to do is map the pixels in matrix_1 to the pixels in matrix_2 , such that for example: matrix_1(1) = matrix_2(1) matrix_1(2) = matrix_2(2) matrix_1(3) = matrix_2(3) ...... ...... matrix_1(n) = matrix_2(n) How can I do that in matlab ? Here is an option matrix_1 = matrix_2(:); which copies the elements (all of them) of matrix_2 in one long

Problem reconstituting UIImage from RGBA pixel byte data

杀马特。学长 韩版系。学妹 提交于 2019-12-02 09:10:44
I need to create 12 coloured images from a single greyscale image ( red orange yellow etc ) Source image is actually a PNG, RGBA: I'm using a library I found ( https://github.com/PaulSolt/UIImage-Conversion/ ) to break the UIImage into a RGBA byte array which I then process pixel by pixel, and use the same library to reconstitute a new UIImage. This is my code: - (UIImage*) cloneWithTint3: (CGColorRef) cgTint { enum { R, G, B, A }; // - - - assert( CGColorGetNumberOfComponents( cgTint ) == 4 ); const float* tint = CGColorGetComponents( cgTint ); // - - - int w = self.size.width; int h = self

Drawing multiple pixels/rectangles

梦想与她 提交于 2019-12-02 07:59:40
I'm trying to make a java sand game and can't get past one bit. i've made my method that draws a rectangle at mouseX and mouseY, and i have set it up so it updates every frame so it constantly follows the mouse. what i assume is that i would use an array to create each rectangle, and from there would use a pre-defined algorithm to float to the ground, I'm all good with that, i just don't understand how to 'hook my method' up to an array. This is the method i am using to draw the rectangle (in it's own class called Methods) import org.newdawn.slick.Graphics; public class Methods { public

Painting sprite in unity

半城伤御伤魂 提交于 2019-12-02 07:32:23
问题 Problem : I want to make prototype for cleaning windows (I mean cleaning dirty windows) in unity. I was searching about this subject and finding that I can change pixel by Texture2D.SetPixel() . I try to do it by this method, First I enabled read/write of texture and try this method but nothing happened on my sprite. So I want to ask it if it's possible to change alpha of the sprite that is clicked by mouse or touched to show the below sprite of original one !? My Code : private RaycastHit2D

Read HSV value of pixel in opencv

别来无恙 提交于 2019-12-02 06:43:46
how would you go about reading the pixel value in HSV format rather than RGB? The code below reads the pixel value of the circles' centers in RGB format. Is there much difference when it comes to reading value in HSV? int main(int argc, char** argv) { //load image from directory IplImage* img = cvLoadImage("C:\\Users\\Nathan\\Desktop\\SnookerPic.png"); IplImage* gray = cvCreateImage(cvGetSize(img), IPL_DEPTH_8U, 1); CvMemStorage* storage = cvCreateMemStorage(0); //covert to grayscale cvCvtColor(img, gray, CV_BGR2GRAY); // This is done so as to prevent a lot of false circles from being detected

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

那年仲夏 提交于 2019-12-02 05:33:27
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[613,296] print(m) while 1: if m!=px[613,296]: m=px[613,296] print(m) I ran the code and started a