Regardless of the language used, anyone who has used Windows's GDI + is familiar with colormatrix, And I have mentioned many times in my blog articles, I also gave a detailed explanation of the functions of the colormatrix in the article "GDI + for VCL basics-Color adjustment matrix colormatrix". Although I think that I am quite familiar with
The recent learning process to see the content of the Android color matrix, previously seen this part of the content is basically skipped, not carefully read.The excuses you find for yourself are:1, freshman study of the matrix content has long forgotten clean, when learning is very annoying, so now also simply skip don't look at it, anyway, I do not do image processing and other tasks.2,android in color, there are ready-made setsaturation-set saturation ,setscale-color scaling, setrotate-color
The process of converting an image from a color to a gray scale is called grayscale or de-colored. The grayscale principle of color images is very simple, that is, the R, G, and B components of each pixel of the image can be obtained into the same value by some calculation method. There are several calculation methods: 1. The values of R, G, and B of each pixel are the average values of R, G, and B of the pixel; 2. The R, G, and B values of each pixel are the maximum values in R, G, and B. 3. Ba
Learn how to remove colors from images by using android, return grayscale images, and use the setSaturation method in ColorMatrix (34 ),
Source image:
:
To achieve the above results is actually very simple, directly go to the Code:
public class MainActivity extends Activity {private Button btn_start;private ImageView img;private Bitmap bitmap;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setConten
CreateBitmap () method can achieve what you want, different parameters effect is not the same, I think in the final analysis of which true affects everythingBut some effects without the CreateBitmap () method with the true parametersuch as black and white photo effects:Turn the picture into black and whitepublic static Bitmap Tograyscale (Bitmap bmporiginal) {int width, height;Height = bmporiginal.getheight ();width = Bmporiginal.getwidth ();Bitmap Bmpgrayscale = bitmap.createbitmap (width, hei
Recently, I learned about Android Image Processing in the system (I collected some information on the Internet and compiled my own testing program.) Here I will summarize:
I. colormatrix class
Colormatrix is a 5x4 matrix. The first line indicates the r Red component, the second line indicates the G green component, the third line indicates the B blue component, and the fourth line indicates the transparency
First of all, the Assembly of the head to give two articles of the friendly reply, as well as netizens fisherman together to discuss ColorMatrix Topic Express Thanks!
ColorMatrix (color matrix) class is located in the System.Drawing.Imaging namespace first look at the following code
ColorMatrix cm = new ColorMatrix (
The ColorMatrix (color matrix) class is located in the System. Drawing. Imaging namespace.Let's take a look at the following code:
ColorMatrix cm = new ColorMatrix (new float [] [] {newFloat [] {0.5f, 0.5f, 0.5f, 0, 0 },New float [] {0.5f, 0.5f, 0.5f, 0, 0 },NewFloat [] {0.5f, 0.5f, 0.5f, 0, 0 },New float [] {0, 0, 1, 0, 0 },NewFloat [] {0, 0, 0, 1, 0 },New float
Android ColorMatrix brightness matrix contrast matrix black/white Matrix
Color matrix M is a 5*4 matrix. In android, the color matrix M is a one-dimensional array m = [a, B, c, d, e, f, g, h, I, j, k, l, m, n, o, p, q, r, s, t] storage.
Each line of the matrix is:R [a B c d e]G [f g h I j]B [k l m n o]A [p q r s t]The RGBA value of the image is stored in a 5*1 color component matrix C. To change the color effect of an image, you only need to change th
the color matrix to {, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }. The custom view control can be defined in the XML layout file by referring to the following method.
1 Custom View Control --> 2 Com. example. android_colormatrix.myview 3 Android: ID = "@ + ID/myview" 4 Android: layout_width = "480dp" 5 Android: layout_height = "180dp" > 6 Com. example. android_colormatrix.myview >
Note that the custom control must contain the complete package name
The color matrix M is a matrix of 5*4, and the color matrix m in android is stored in a one-dimensional array m=[a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t] way.Each line of the matrix is:R[a b c D E]G[f G h i j]B[k l m N O]A[p Q R S t]The RGBA value of the image is stored in a 5*1 color component matrix C, in order to change the color effect of a picture, only need to change the image of the color component matrix.In the Colormatrixfilter filtering time, the incoming parameter
, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }. The custom View control can be defined in the xml layout file by referring to the following method.
1 2 3 android: id = "@ + id/myView"4 android: layout_width = "480dp"5 android: layout_height = "180dp">6 Note that the custom control must contain the complete package name. The code above shows that the custom control is implemented in MyView. Next, let's take a look at how the custom View control is implemented in MyView.
2.2 Implementation of custom View Con
Android ColorMatrix brightness matrix contrast matrix black/white matrix, androidcolormatrix
Color matrix M is a 5*4 matrix. In android, the color matrix M is a one-dimensional array m = [a, B, c, d, e, f, g, h, I, j, k, l, m, n, o, p, q, r, s, t] storage.
Each line of the matrix is:R [a B c d e]G [f g h I j]B [k l m n o]A [p q r s t]The RGBA value of the image is stored in a 5*1 color component matrix C. To change the color effect of an image, you o
Colormatrix (color matrix) is a matrix used in GDI + to adjust the color of an image.What is a matrix? To put it bluntly, it is a two-dimensional array in C.So what is the principle of Color adjustment in this matrix? How does it adjust the color? This should begin with the multiplication of matrices in linear algebra.Readers who have learned linear algebra in the following sections can skip this section. Here I will use my own understanding to descri
Original::To achieve the above effect is actually very simple, directly on the code:public class Mainactivity extends Activity {private Button btn_start;private ImageView img;private Bitmap Bitmap; @Overrid eprotected void onCreate (Bundle
GDI + provides image and bitmap classes for storing and manipulating images. The Image and bitmap objects store the color of each pixel with a 32-digit number: red, green, blue, and Alpha 8 bits. The values for these four components are 0 to 255,
Android Image Processing
The following describes how to process Android images.
RGBA model: red green blue alpha
1. Change the color image, transparency, and brightness.
2. Use color matrix to process images
3. Change pixel processing image
1. Use ColorMatrix to change the color, transparency, and brightness.
To obtain a new image, follow these steps:
(1) Create a New BitMap and use the createBitmap () method.
(2) Use a
By doing this, I also confirmed that GDI + can directly display transparent images in PNG, GIF, and TIF formats.
// Red and green rotate around blue (R is radian) colormatrix: tcolormatrix = (COS (R), sin (R), 0.0, 0.0, 0.0 ), (-sin (R), cos (R), 0.0, 0.0, 0.0), (0.0, 0.0, 1.0, 0.0, 0.0), (0.0, 0.0, 0.0, 1.0, 0.0), (0.0, 0.0, 0.0, 0.0, 1.0); // rotate green and blue (R is a radian) colormatrix: tcolormatr
respect for the original, reproduced please indicate the source http://blog.csdn.net/abcdef314159Before talking about the use of Android paint, where the Setcolorfilter (Colorfilter filter) method does not speak, today to simple analysis, in Android Colorfilter a total of 3 sub-categories, Colormatrixcolorfilter,lightingcolorfilter,porterduffcolorfilter, let's take a look at the first colormatrixcolorfilter today. The Colormatrixcolorfilter method is simple, one is an incoming array, and the o
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.