[Android] ready to take the image processing part of the summary and source sharing

Source: Internet
Author: User

with the arrival of winter vacation, finally have time to summarize under the Android this handy shot of the course work, at the same time to share my completed this part of the image processing experience it! You can combine demo to read this article, hope to help you.
If you are absolutely too wordy, you can download the demo directly. If you want to do Android image processing related apps, you may be a little inspired. If there are deficiencies in the article, please Haihan! Just want to share something.
Demo: Upload ing

I. Project structure and interface

The project engineering structure is as follows:

individual or more appreciate this layout, where Mainactivity.java is the main interface, Processactivity.java is the image processing interface, The remaining five Java corresponds to five different image processing algorithms: effectprocessimage (Image effect), frameprocessimage (add photo frame), increaseprocessimage (image enhancement), Personprocessimage (image interaction) and watchprocessimage (view picture).
At the same time layout has five XML sub-layout, in the form of Popupwindow display five different processing, at the same time, the demo is a good transplant, the file copied in succession and mainactivity to the child activity, can be called.
Some of the interfaces are as follows:

mainactivity Main interfaceAdd Picture Options Image Processing sub-interface (bottom five)

two. Image viewing function

Click on the main interface in the GridView "+" after adding a picture, you can choose to add or take photos from the album, loading the image to the processing interface, click the bottom "View" button it will have a selected effect (the icon color blue & background color deepened). Also popupwindow the following interface:


The dynamic diagram submitted after clicking "Rotate" is as follows:

refer to my previous blog:[Android] photo, save and display in the ImageView control
[Android] uses the matrix matrix class to scale, rotate, contrast, and brightness the image
[Android] touchscreen setontouchlistener for zooming, moving, drawing, and adding watermarks
Other effects are as follows, and there are several issues:
1. Image drawing Save I didn't do it.
2. Move and zoom the image, upload the original size
3. Add watermark function It doesn't feel easy.


three. Image enhancement function

The image enhancement is realized mainly through 3 progress bar Seekbar, can adjust the image saturation, brightness and hue. When the saturation equals 0 o'clock is the black and white two value image, three sliders can adjust each other. As shown in:



refer to my previous blog:
[Android] uses the matrix matrix class to scale, rotate, contrast, and brightness the image
[Android] Image processing integration processing ColorMatrix and intend pass path display image
[Android] Bottom menu layout +popupwindows implement popup menu function (beginner)
Also need to pay attention to a problem: Set the slider to set its interval, while the pop-up popupwindow attention to its width and different phone screen processing.
This part of the algorithm processing code as follows, each part of the algorithm called after the return value is bitmap, and then call Imageshow.setimagebitmap (mbmp), direct display.


Four. Image effect function

Popupwindow pop up the following interface, including: Nostalgia, emboss, lighting, sketching and sharpening processing.


The special effects and Effectprocessimage.java are as follows:
    
Refer to my blog:
[Android] Image nostalgia, emboss, blur, lighting, and sketch effects with menu
[Android] Image Processing series collection of articles (draft strong push)
At the same time, there are some problems in the algorithm, one is inefficient, a friend suggested C write algorithm to call, but the article is only classroom work, provide a way for everyone to reference. At the same time, the image sketch algorithm is not good, sharpening processing should also be wrong ( can refer to blog ), The lighting effect is mapped from the center to the edge, and the user can set the illumination diameter and direction.

Five. Image Photo Frame Add

Finally, the image frame is synthesized, as shown in. I used a post-photographic composite Image:


Add the frame function is mainly through the composition of two pictures, I have seen four pictures of the effect of the composite photo frame. But I prefer this two-picture compositing, loading transparent images in the assets folder. See:
[Android] Add picture frames, rounded rounded corners to images, image compositing knowledge

Six. Summary and Impressions

The process of the bottom five buttons to switch background and color see code Processactivity.java, mainly through the switch two pictures and background implementation. If each interface displays different content, it is recommended to use the fragment slide implementation. Reference:
[Android] Using the include layout +fragment swipe to toggle the screen
[Android] Add local pictures dynamically via GridView parody
Pat me is still more satisfied, which background database we use Sina SAE do, while the ListView refresh Pat also very good! The effect is as follows:


Uploaded demo I removed the publish feature, which uploads multiple images through the thread and process progress bar. While the ListView can refresh the most recently posted message, click on the image to see a larger image. You can comment on the release, pay attention to, praise and so on.
but because the whole project was done together, including the Network, Database (SAE), and ListView (citing open source), I could only share the part I did. Sorry ~ If you have time to write some articles about the Android network, This includes how to upload images (URL links are stored in a cloud disk), get database content, and more.
PS: It's really annoying lately,on the one hand this semester really busy become a dog, winter vacation also has a homework. But inOn the train I still quite calm-listen to naughty piano, look out of the window of the bustling, I do not know from when I have been like this 26 hours of solitude. Feeling a lot Ah! Another thing that really bothers me is that I went home soon to do a small finger surgery, today finished writing this article, the mood is slightly better! Suddenly looking back, I found that the most sorry in my life is actually my own, I hope that the coming year to myself a bit, especially for their own body. At the same time, have the opportunity to find an internship! But fortunately, often share some blog, complete some projects can bring me a happy.
Hope the article is helpful to everyone ~
Finally, with the recent "Old Man and the sea" end this article:
life always makes us black and blue, but then, the wounded places will become our strongest place.
(By:eastmount 2015-2-7 Night 11 o ' http://blog.csdn.net/eastmount/)

[Android] ready to take the image processing part of the summary and source sharing

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.