rgb

Channel and Bit values of a YUV2 data

人走茶凉 提交于 2019-12-11 11:00:00
问题 I have a data stream coming from a Camera(PAL) The data type I got from callback function is in a format like U0-Y0-V0-Y1 U2-Y2-V2-Y3 U4-Y4-V4-Y5 ...... I need to change the color format to RGB (or BGR) by using OpenCV's cvCvtColor() function. Usage of the function is cvCvtColor(YCrCb, dst, CV_YCrCb2BGR); Now here(actually before) comes the problem, dst is a 3 channel 8U image, thats OK, but how can I store the data coming from callback function in an IplImage directly ? If I can store it

Java image conversion to RGB565

南楼画角 提交于 2019-12-11 10:25:55
问题 I try to convert image to RGB565 format. I read this image: BufferedImage bufImg = ImageIO.read(imagePathFile); sendImg = new BufferedImage(CONTROLLER_LCD_WIDTH/*320*/, CONTROLLER_LCD_HEIGHT/*240*/, BufferedImage.TYPE_USHORT_565_RGB); sendImg.getGraphics().drawImage(bufImg, 0, 0, CONTROLLER_LCD_WIDTH/*320*/, CONTROLLER_LCD_HEIGHT/*240*/, null); Here is it: Then I convert it to RGB565: int numByte=0; byte[] OutputImageArray = new byte[CONTROLLER_LCD_WIDTH*CONTROLLER_LCD_HEIGHT*2]; int i=0; int

Using numpy and pil to convert 565(16bit-color) to 888(24bit-color)

好久不见. 提交于 2019-12-11 10:16:41
问题 I must preface this, with the fact that I have a working method using bitshift and putpixel, but it is incredibly slow, and I am looking to leverage numpy to speed up the process. I believe I am close, but not quite there. Having timed what I think should work, I'm seeing a 0.3 second improvement in time, hence my motivation. The current working code: buff # a binary set of data im = Image.new("RGBA",(xdim,ydim)) for y in xrange(ydim): for x in xrange(xdim): px = buff[x*y] # the 255 is for

coordinates out of bound:bufferedimage

邮差的信 提交于 2019-12-11 09:54:08
问题 I made a program to separate red blue and green components of a image but the code below gives an error: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Coordinate out of bounds! at sun.awt.image.ByteInterleavedRaster.getDataElements(ByteInterleavedRaster.java:318) at java.awt.image.BufferedImage.getRGB(BufferedImage.java:888) at rgb.Rgb.main(Rgb.java:46): Here is the source code: public static void main(String[] args) { String type = "jpg"; BufferedImage img = null; try

Javascript style object converts complex color names into rgb

大城市里の小女人 提交于 2019-12-11 08:36:33
问题 Is there a way to override how javascript converts complex CSS color names to rgb values when applying them to DOM elements in the document.getElementById(xxx).style object. For example: setting document.getElementById("colorMe").style.background = "lightblue" will set the "DOMElement".style object with a background = "rgb(...)" . However, setting document.getElementById("colorMe").style.background = "blue" will set the "DOMElement".style object with a background = "blue" . I WANT the second

Converting RGB values into color

不打扰是莪最后的温柔 提交于 2019-12-11 06:59:34
问题 I have a java code that returns decimal values as shown below [1.0, 0.0, 0.0] for Red [0.0, 1.0, 0.0] for Green the first value denotes the color code for Red, the second value denotes color code for Green and the third value denotes Color code for Blue. Is there any way we can convert these RGB values into the respective color in java? 回答1: There are an example to return the color name which depend on using Reflection to get the name of the color (java.awt.Color) public static String

Convert RGB bytes to HSL and back?

a 夏天 提交于 2019-12-11 06:41:16
问题 Is there an algorithm for converting a RGB byte array to an HSL float array and back again? I have tried the one found here but it seems to have bugs. 回答1: I use the following class which converts from HSL to RGB and vice-versa. You can construct a ColorRGB instance from a Color , or simply cast one. It exposes H , S , L properties also. I found it on the internet. Apologies to the original author, I cannot find a reference: public class ColorRGB { public byte R; public byte G; public byte B;

How to interpret a RGB array in R

时光怂恿深爱的人放手 提交于 2019-12-11 06:32:40
问题 I'm having troubles with interpreting the RGB values I get from an image read in R. The array I get show values from 0-1, when the RGB colour range is from 0-255. I tried to convert it back to the 0-255 range adjusting a script like this, picturemax <- max(picture) picturemin <- min(picture) p.picture <- as.numeric(picture) if (picturemax > 255 || picturemin < 0) p.picture <- (picture - picturemin)/(picturemax - picturemin) p.picture retrieved from https://stat.ethz.ch/pipermail/r-help/2003

How do I convert RGB into HSV in Cocoa Touch?

这一生的挚爱 提交于 2019-12-11 04:06:19
问题 I want to set the background color of a label using HSV instead of RGB. How do I implement this into code? Code: //.m file #import "IBAppDelegate.h" @implementation IBAppDelegate @synthesize label; { self.label.backgroundColor = [UIColor colorWithRed:1.0f green:0.8f blue:0.0f alpha:1.0f]; } 回答1: You can use the following convenience constructor of the UIColor object: + (UIColor *)colorWithHue:(CGFloat)hue saturation:(CGFloat)saturation brightness:(CGFloat)brightness alpha:(CGFloat)alpha 来源:

GPU YUV to RGB. Worth the effort?

江枫思渺然 提交于 2019-12-11 03:47:47
问题 I have to convert several full PAL videos (720x576@25) from YUV 4:2:2 to RGB, in real time, and probably a custom resize for each. I have thought of using the GPU, as I have seen some example that does just this (except that it's 4:4:4 so the bpp is the same in source and destiny)-- http://www.fourcc.org/source/YUV420P-OpenGL-GLSLang.c However, I don't have any experience with using GPU's and I'm not sure of what can be done. The example, as I understand it, just converts the video frame to