Reputation: 81
I've currently made an android app that can display a live preview of the camera, but I'm looking for a way to perform live pixel manipulation (ie, make the image grayscale, sepia-toned, etc.). As of yet I haven't found any code for someone whose done this before.
Any help would be appreciated.
Upvotes: 8
Views: 4909
Reputation: 9710
I have answered this question here. In short, this tutorial gives you probably the best way, how to achieve this (by using OpenCV, a free Computer Vision library). You can download their example application from their website as well.
Upvotes: 0
Reputation: 4167
You could use the Camera.Parameters
to set the appropriate effect. Read more about it here.
If you want to do the manipulation by yours then use onPreviewFrame
of camera. This gives you raw byte[]
of YUV
format (its by default, you could set it to other formats also. Look here for setting the preview format).
Now you could able to perform any pixel manipulation you want on byte[]
.
Hope this helps!
Upvotes: 7