rgb

Optimizing RGB565 to RGB888 conversions with SSE2

蓝咒 提交于 2020-01-02 07:11:22
问题 I'm trying to optimize pixel depth conversion from 565 to 888 using SSE2 with the basic formula: col8 = col5 << 3 | col5 >> 2 col8 = col6 << 2 | col6 >> 4 I take two 2x565 128-bit vectors and I'm outputing 3x888 128-bit vectors. After some masking, shifting and OR'ing I came to the point when I have two vectors with ((blue << 8) | red)* 8-bit colors stored in 16-bit words and a similar vectors with zero-green values. Now I need to combine them into 888 output. BR: BR7-BR6-...-BR1-BR0 0G: 0G7

Improve SSE (SSSE3) YUV to RGB code

懵懂的女人 提交于 2020-01-01 12:00:35
问题 I am looking to optimise some SSE code I wrote for converting YUV to RGB (both planar and packed YUV functions). I am using SSSE3 at the moment, but if there are useful functions from later SSE versions that's ok. I am mainly interested in how I would work out processor stalls and the like. Anyone know of any tools that do static analysis of SSE code? ; ; Copyright (C) 2009-2010 David McPaul ; ; All rights reserved. Distributed under the terms of the MIT License. ; ; A rather unoptimised set

YUV和RGB的区别(以及YUV444 YUV422 YUV411 YUV420的介绍)

余生颓废 提交于 2020-01-01 09:50:59
RGB是构成多种颜色的三基色(红绿蓝),也称为加成色。主要是图像的采集和显示。YUV是优化彩色视频信号的编码和传输,和rgb相比,YUV占用的带宽少。 YUV中Y表示的是亮度,是通过RGB输入信号确定的,方法是将RGB信号的特定部分叠加到一起。UV表示的是色度,定义了颜色的两个方面的色度和饱和度,分别使用Cr和Cb表示。其中,Cr是GB输入信号的红色部分和RGB信号的亮度的差异。而Cb反映的是RGB输入信号的蓝色部分和RGB的信号亮度值之间的差异。可以参考下面的RGB转YUV的公式。 RGB和YUV是可以相互转化的(根据不同的色域计算有所不同,bt.601-6): RGB转YUV: Y = 0.299*R + 0.587*G + 0.114*B; U = -0.169*R - 0.331*G + 0.5 *B ; V = 0.5 *R - 0.419*G - 0.081*B; YUV转RGB: R = Y + 1.4075 * V; G = Y - 0.3455 * U - 0.7169*V; B = Y + 1.779 * U; 参考: https://www.cnblogs.com/luoyinjie/p/7219319.html 下面介绍一下YUV。YUV分为YUV444,YUV422,YUV420等,含有不同色度分量的编码方式。 YUV444:UV三个信道的抽样率相同

Convert JPG image from grayscale to RGB using imagemagick

扶醉桌前 提交于 2020-01-01 08:05:23
问题 I am trying to convert gray scale images to RGB using the imagemagick command-line tools. It is working fine for PNG images, using: convert image.png -define png:color-type=2 result.png (taken from an answer to "How to convert gray scale png image to RGB from comand line using image magick") Although checking with identify -format %r result.png will still return DirectClass Gray , I can see it worked using gdalinfo as there are now 3 bands / channels listed: gdalinfo [successfully converted

Jet colormap to grayscale

↘锁芯ラ 提交于 2020-01-01 05:03:11
问题 I have a jet colormap: and I would like to know if there's some way to convert to a grayscale. I can't use average because maximum and minimum value goes to the same gray color. Or if there's some way to convert to another color palette. I can't find on Google a function to convert it. MATLAB uses some thing called rgb2ind but I would like to know the formula. 回答1: First let me create an indexed image using the Jet colormap: img = repmat(uint8(0:255), 100, 1); cmap = jet(256); imshow(img,

Given a finite palette, how to sort from Hot to Cold, i.e. Diverging

試著忘記壹切 提交于 2020-01-01 04:44:06
问题 Update (Original question below) Issue is partially solved. Still trying to figure out how to extend to other color combinations If I use this code hLIM <- rgb2hsv(col2rgb('#8000ff'))['h', ] sLIM <- rgb2hsv(col2rgb('#8000ff'))['s', ] vLIM <- rgb2hsv(col2rgb('#8000ff'))['v', ] rankorder <- order((hLIM-tHSVcol[,1] + (hLIM < tHSVcol[,1])), (sLIM-tHSVcol[,2] + (sLIM < tHSVcol[,2])), (vLIM-tHSVcol[,3] + (vLIM < tHSVcol[,3]))) orderType <- "HSV Ordering" I am able to sort this Unsorted Color

rawvideo and rgb32 values passed to FFmpeg

怎甘沉沦 提交于 2020-01-01 04:26:07
问题 I'm converting a file to PNG format using this call: ffmpeg.exe -vframes 1 -vcodec rawvideo -f rawvideo -pix_fmt rgb32 -s <width>x<height> -i infile -f image2 -vcodec png out.png I want to use a converter that can be linked or compiled into a closed-source commercial product, unlike FFmpeg , so I need to understand the format of the input file I'm passing in. So, what does rawvideo mean to FFmpeg ? Is FFmpeg determining what type of raw format the input file has, or does rawvideo denote

Converting image using matlab / octave from rgb to hsv back to rgb

北城以北 提交于 2019-12-31 05:43:45
问题 I'm trying to convert a color image from rgb to hsv (make changes) then back to rgb. As a test I made this code just to test how to go from rgb to hsv back to rgb but when I view the image it just shows up as black. What am I missing? *PS I'm using octave 3.8.1 which works like matlab Here are the octave 3.8.1 packages I have loaded: >>> pkg list Package Name | Version | Installation directory --------------+---------+----------------------- control *| 2.6.2 | /usr/share/octave/packages

Changing lsb value of image rgb value giving inconsistent value

可紊 提交于 2019-12-31 05:42:22
问题 I am trying to change the lsb value of image pixels such that it matches with the string "abc" but adding 1 or 0 to a pixel with odd value is returning 0. here is the code: public static void main(String[] args) { BufferedImage img = null; try { img = ImageIO.read(new File("a.jpg")); } catch (IOException ex) { } int pixel[] = img.getRGB(0, 0, img.getWidth(), img.getHeight(), null, 0, img.getWidth()); String s = "abc"; byte[] b = s.getBytes(); String f = ""; for (int i = 0; i < b.length; i++)

IllegalArgumentException: Color parameter outside of expected range: Red Green Blue

百般思念 提交于 2019-12-31 02:49:13
问题 when I tested my code with JUnit, the following error occured: java.lang.IllegalArgumentException: Color parameter outside of expected range: Red Green Blue Honestly, I don't know why. My code is not very long, so I would like to post it for better help. BufferedImage img = ImageIO.read(f); for (int w = 0; w < img.getWidth(); w++) { for (int h = 0; h < img.getHeight(); h++) { Color color = new Color(img.getRGB(w, h)); float greyscale = ((0.299f * color.getRed()) + (0.587f * color.getGreen())