Monday, December 19, 2011


I have implemented the real-time images from camera preview to a canvas as a Opengl texture. The only problem is that I could not successfully create and combine the self defined shader. I tried many ways and could not find where the problem lied. Hopefully I could figure it out soon.

Thursday, December 15, 2011

Sepia tone on Android phone

I can implement sepia tone on Android camera preview, to generate pretty decent old film effects. I believe many other effects could be generated in similar ways. However, since it is still on CPU, fps is as low as 4f/s. Trying hard to get glsl shaders working on the phone.


Monday, December 12, 2011

Could Modify View!

Just figured out how to modify the view on the canvas of the SurfaceView Class! So excited!

Instead of using onDraw() function directly in the CameraPreviewView(which inherits from SurfaceView), I used Handler to post the update() function in the ViewGroup, and the ViewGroup's update() function calls the update() function in CameraPreviewView class. Here, it calls postInvalidate() function which calls onDraw().

The pipeline is from this link(sorry it is in Chinese, but the code works well to display a blue box moving from the left to the right of the screen):

On the other hand, I created a Bitmap variable in the CameraPreviewView class and update it to the bitmap which comes from the camera's modified preview data. The class's onDraw() function directly draw this Bitmap to the UI. That works!

However, since all of the operations are based on CPU, the frame rate is still low. But here comes the core part!

Two question left: The algorithm I am using to convert camera preview data to Bitmap converts the data to RGBA, but the values for RGB are in the range of 0 to 262143, which is 512 * 512 - 1, instead of 0 to 256.

And, how does postDelayed() function work in the update?

Could anyone shed some light on them? Thanks! Cheers! Move On!

What is now on Android Phone

This is basically what I have now on the Android phone. Above the camera preview scene I can now embed a new bitmap. Now I am trying hard to convert the apple to the modified bitmap from the preview data. Cheer up and carry on!

Solving view problem

Although I could draw another surface view on the original one, it is really hard to display the images from the camera preview to the canvas of the new view. Still working on it. If I could't make it in one to two days, maybe I have to change some strategy. I'll try my best!

Thursday, December 8, 2011

SurfaceView Implemented

Implemented a SurfaceView over the default camera preview. Now working on modifying the SurfaceView with bitmap which comes from modified camera preview. This will use parallel computation with GPU.

Friday, December 2, 2011

Implemented Android Camera Preview

I have just implemented the camera preview setup using Java code. However there are still some bugs. For example, the app would crash down if we click on the "take photo" button. I am trying to modify the preview scene with old movie effects and dealing with the bugs at the same time.