Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
312 views
in Technique[技术] by (71.8m points)

android - How can I add thermal effect to YUV image

After googling a lot. I find a way to change Preview of a single frame. Correct me if i am wrong.

camera.setPreviewCallback(new PreviewCallback() 

callBack let you get the frame of a Camera in byte. Now you can save it or modify it.

First of all i only want to add thermal or night effect to these byte. How can i add these color(Effects) to YUV Image or byte[] data.

camera.setPreviewCallback(new PreviewCallback() {
                    @Override
                    public void onPreviewFrame(byte[] data, Camera camera) {
                        // TODO Auto-generated method stub
                        Camera.Parameters parameters = camera.getParameters();
                        Size size = parameters.getPreviewSize();
                        YuvImage image = new YuvImage(data, ImageFormat.NV21,
                                size.width, size.height, null);
                        /*Rect rectangle = new Rect();
                        rectangle.bottom = size.height;
                        rectangle.top = 0;
                        rectangle.left = 0;
                        rectangle.right = size.width;
                        ByteArrayOutputStream out2 = new ByteArrayOutputStream();
                        image.compressToJpeg(rectangle, 100, out2);
                        DataInputStream in = new DataInputStream();
                        in.write(out2.toByteArray());*/

                        }
                    }

                });

How to apply filter/effect to YUVImage or byte[] .

And for taking a picture i should use android.hardware.Camera.PictureCallback or setOneShotPreviewCallback()

Edit

I think i find some useful links which help to filter bitmap image.

setPixel Explanation

getPixel and setPixel not working Properly

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...