rgb

Convert character(s) to tuple and back

孤街浪徒 提交于 2019-12-11 16:35:07
问题 I am trying to change the output of this encoder: https://github.com/akapila011/Text-to-Image/blob/master/text_to_image/encode.py from grayscale to a tri-color scheme such as the one shown here: Tricolor The main lines of code I need to change from the encoder are: img = Image.new("L", size) # grayscale, blank black image ind = 0 for row in range(0, size[0]): for col in range(0, size[1]): if ind < text_length: # only change pixel value for length of text pixel_value = convert_char_to_int(text

Why does .toString(16) convert rgb, decimal, or other inputs into a hexidecimal

泪湿孤枕 提交于 2019-12-11 14:28:09
问题 I've tried searching everywhere I could to find the answer as to why .toString(16) converts a number to a hexidecimal value. My first question is, why 16? My second question is, how can this return letters even though I see no letters going into the code. For example, I don't understand how the following code returns ff instead of a number. var r = 255; r.toString(16); //returns ff If anyone has any links or insights as to why this is, please let me know. I'm very curious. Thank you in

About converting YUV(YV12) to RGB with GLSL for iOS

落爺英雄遲暮 提交于 2019-12-11 13:32:00
问题 I'm trying to convert YUV(YV12) to RGB with GLSL shader. As below step. read a raw YUV(YV12) data from image file filtering Y, Cb and Cr from the raw YUV(YV12) data mapping texture send Fragment Shader. but result image is not same as raw data. below image is raw data. screenshot of raw image link(Available for download) and below image is convert data. screenshot of convert image link(Available for download) and below is my source code. - (void) readYUVFile { ... NSData* fileData = [NSData

how can convert image cmyk to rgb mode in javascript

。_饼干妹妹 提交于 2019-12-11 13:27:01
问题 I have a problem: Browsers do not support showing images in CMYK mode and the client see some really sharp and different colors in his uploaded image while the colors is alright. solve this problem i think its a good idea to convert an CMYK image to a RGB mode image in client-side with using JavaScript language. based on my search result about converting image in CMYK to RGB mode with using JavaScript, required image to be imported to a canvas and makes every color number in each pixel

Small color defects when aplying mean filter on images

本秂侑毒 提交于 2019-12-11 12:52:28
问题 I have been trying to do a program that applies a mean filter over images, and I think I am close to do it correctly, but there still small flaws in the images. For instance: Original racing: http://s72.photobucket.com/user/john_smith140/media/gp4_zpstafhejk5.jpg.html?filters[user]=139318132&filters[recent]=1&sort=1&o=2 Original Triangles: http://s72.photobucket.com/user/john_smith140/media/input_zpsz2cfhrc7.jpeg.html?filters[user]=139318132&filters[recent]=1&sort=1&o=3 Modified racing: http:

Android : converting RGB888 to Y800

戏子无情 提交于 2019-12-11 11:53:48
问题 I am getting image captured from vuforia as RGB888 bytes[] . I want to pass this to zbar which is expecting the format to be Y800 . How can i do that. i tried Image barcode = new Image(width, height, "RGB3"); barcode.setData(imgRGB888); int result = scanner.scanImage(barcode.convert("Y800")); but its not giving right result 回答1: check this Thread and Review Your Full Code : http://sourceforge.net/p/zbar/discussion/2308158/thread/ce0d36f8 By the Way : zbar Accepts GRAY format too.. 来源: https:/

Changing RGB values of a color over time

拈花ヽ惹草 提交于 2019-12-11 11:53:18
问题 I want to create a background color that transitions smoothly between colors by changing its RGB values incrementally. I am using the setBackground(Color) to change the background. Would this be possible in Java? 回答1: Here is some old code that changes the background Color when a component gains focus. import java.awt.*; import java.awt.event.*; import java.util.Hashtable; import java.util.ArrayList; import javax.swing.*; public class Fader { // background color when component has focus

Saving RGB matrix as text

大憨熊 提交于 2019-12-11 11:52:41
问题 I tried to save an RGB matrix in text format but without success. The resolution of the image is 640 x 480. I'm looking for matrix with 640 columns and 480 rows and for every element the corresponding RGB value. For example: (230, 200, 20) (130, 11, 13) ... # and the others 658 columns (200, 230, 20) (11, 130, 13) ... ... # and the others 478 rows 回答1: If that's the exact output you want, then I think this does the job. You can use str.format() to get whatever you need. # Read the image file.

Calculate Euclidean distance between RGB vectors in a large matrix

风格不统一 提交于 2019-12-11 11:37:31
问题 I have this RGB matrix of a set of different pixels. (N pixels => n rows, RGB => 3 columns). I have to calculate the minimum RGB distance between any two pixels from this matrix. I tried the loop approach, but because the set is too big (let's say N=24000), it looks like it will take forever for the program to finish. Is there another approach? I read about pdist , but the RGB Euclidean distance cannot be used with it. k=1; for i = 1:N for j = 1:N if (i~=j) dist_vect(k)=RGB_dist(U(i,1),U(j,1)

Rails show rgb color string as color swatch

旧时模样 提交于 2019-12-11 11:03:16
问题 Im using RMagick to take the average color of an image a user uploads. and I've got it down to displaying as RGB format. Now I'd like to take that RGB string and display it as a color swatch on the page...any idea on how to accomplish this? {:r=>155, :g=>132, :b=>118} 回答1: # controller @image = Magick::Image.read(@design.photo.path).first average_color = # your magick method to return the average color # so average is like " {:r=>155, :g=>132, :b=>118} " @average_color_string = "##{average