color-channel

Converting RGBA to YUV422 format using c++ - not getting proper output

99封情书 提交于 2019-12-24 07:17:06
问题 I want to convert an image from RGBA to YUV422 format. Below is my code: #include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" #include <iostream> #include <stdio.h> #include <stdlib.h> using namespace cv; using namespace std; #define CLIP(X) ( (X) > 255 ? 255 : (X) < 0 ? 0 : X) #define RGB2Y(R, G, B) CLIP(( ( 66 * (R) + 129 * (G) + 25 * (B) + 128) >> 8) + 16) #define RGB2U(R, G, B) CLIP(( ( -38 * (R) - 74 * (G) + 112 * (B) + 128) >> 8) + 128) #define RGB2V(R, G, B)

Convert Color32 array to byte array to send over network

陌路散爱 提交于 2019-12-11 02:29:10
问题 I have been working on webcam streaming for video and photo capture on Android devices within Unity3D. Most of the examples I have found in order to capture webcam feeds use a specific WebCamTexture object in order to get access to the devices camera hardware. I currently am able to capture the camera input but the WebCamTexture stores the data as a Color32[]. I found this solution below for converting a Color32[] to a byte[] but it seems to be swapping the red and blue color channels. https:

What is the difference between the ways to read an Image file in Java?

别来无恙 提交于 2019-12-07 03:48:12
问题 There are various ways of reading an image file in java such as BufferedImage and ImageIcon to name a few. I want to know what is the difference between these cases? Are they context dependent that in a particular case only one of them can be used? What would be the best way of reading a image selected by JFileChooser by the user and separating the color channels of an image? 回答1: A good way is to use the different ImageIO.read methods, which return BufferedImage objects. Image is an abstract

What is the difference between the ways to read an Image file in Java?

时光毁灭记忆、已成空白 提交于 2019-12-05 05:56:25
There are various ways of reading an image file in java such as BufferedImage and ImageIcon to name a few. I want to know what is the difference between these cases? Are they context dependent that in a particular case only one of them can be used? What would be the best way of reading a image selected by JFileChooser by the user and separating the color channels of an image? Alexis Dufrenoy A good way is to use the different ImageIO.read methods, which return BufferedImage objects. Image is an abstract class, so I think the real question is which subclass is more efficient for your program.

Android Edit Bitmap Channels

对着背影说爱祢 提交于 2019-11-28 16:26:30
It's possible to access the alpha channel of a given bitmap with extractAlpha() , but I haven't been able to find any way to actually set the alpha channel of a bitmap. How can multiple greyscale images be recombined as channels into a Bitmap with Android? It is quite possible to re-combine separate channels back into an ARGB image. You just need the grayscale channel images and an image with the alpha channel you want - note that this is not an opaque grayscale image, but an image with the alpha you want. You then draw each channel with a Paint using the appropriate PorterDuffXfermode onto a

How to set given channel of a cv::Mat to a given value efficiently without changing other channels?

房东的猫 提交于 2019-11-28 00:46:16
How to set given channel of a cv::Mat to a given value efficiently without changing other channels? For example, I want to set its fourth channel (alpha channel) value to 120 (i.e. half transparent), something like: cv::Mat mat; // with type CV_BGRA ... mat.getChannel(3) = Scalar(120); // <- this is what I want to do P.S.: My current solution is first split the mat into multiple channels and set the alpha channel, and then merge them back. P.S.2: I know that I can do this quickly if I also want to change other channels as well by: mat.setTo(Scalar(54, 154, 65, 120)); Update with generalized

Android Edit Bitmap Channels

╄→尐↘猪︶ㄣ 提交于 2019-11-27 09:42:14
问题 It's possible to access the alpha channel of a given bitmap with extractAlpha() , but I haven't been able to find any way to actually set the alpha channel of a bitmap. How can multiple greyscale images be recombined as channels into a Bitmap with Android? 回答1: It is quite possible to re-combine separate channels back into an ARGB image. You just need the grayscale channel images and an image with the alpha channel you want - note that this is not an opaque grayscale image, but an image with

How to set given channel of a cv::Mat to a given value efficiently without changing other channels?

我是研究僧i 提交于 2019-11-26 23:27:25
问题 How to set given channel of a cv::Mat to a given value efficiently without changing other channels? For example, I want to set its fourth channel (alpha channel) value to 120 (i.e. half transparent), something like: cv::Mat mat; // with type CV_BGRA ... mat.getChannel(3) = Scalar(120); // <- this is what I want to do P.S.: My current solution is first split the mat into multiple channels and set the alpha channel, and then merge them back. P.S.2: I know that I can do this quickly if I also