Android Phone Glasses 3D technology principles and programming implementation

Source: Internet
Author: User

1. The open-glasses 3D mobile phone has been popular since last year. As a selling point or gimmick, for the phone's input and output to provide a touch of smart color. Glasses 3D can be in two-dimensional mobile phone screen do not need to wear VR glasses or Google carton can show the effect of three-dimensional world, generally to provide users with a good experience, the need for software hardware combination. Hardware generally need to support the naked eye 3D mobile phone or ordinary mobile phone affixed with the naked eye 3D film.

2. Currently used on mobile phones, the naked eye 3D technology is called cylindrical lens technology, also known as a double-convex lens or a micro-cylindrical lenses. The principle is to add a cylindrical lens to the front of the LCD screen, so that the image plane of the LCD is located on the focal plane of the lens, so that the pixels of the images below each column lens are divided into sub-pixels, and the lens can project each sub-pixel in different directions. While the eyes look at the display from different angles, they see different sub-pixels. After the brain processing, it will form a 3D picture. This principle and the principle of Google box similar, may be said to be basically the same, Google Box software development we will be the picture or video resources into the left eye and the right eye two different pictures, the main difference between two pictures is a few columns of parallax simplicity, And the naked eye 3D is the use of 3D screen or 3D mobile phone film to the Google left and right eyes of the image by pixel on both sides of the cylindrical lens, because the micro-cylindrical lens of light refraction effect, will make the eyes of different vision. Whether it is a 3D screen or 3d film generally only supports horizontal viewing, at the same time the viewing angle has certain requirements, the general line of sight should be close to the vertical screen, this is because the cylindrical lens is generally in the mobile phone screen is horizontal arrangement, and the left and right eye pixels to form parallax needs a certain width, and left and right eye merge will lose about

3. Below is a cylindrical lens from the outer cuff. We will synthesize the left and right eye images on both sides of the cylindrical lens. In fact, the ordinary plane image or video can also be converted to the left and right eye 3D or naked, as long as the picture is divided into two, leaving the parallax, you can form the left and right eye, 3D with VR glasses or Google paper tray can get 3D effect, and then the left and right eye image according to the open-hole 3D synthesis law, A 3D-like effect can be achieved with the naked 3D phone.

4. Left and right eye 3D software implementation, generally need to consider three points, one is the parallax of the two eyes, the second is the interval of the cylindrical lens, three is the screen size. Parallax is not correct, shape is not 3D vision, cylindrical lens spacing determines the distance between the left and right eye pixels, the general density is probably half the screen pixels high, so that a column corresponding to a row of the left eye, a row of eyes, evenly distributed. Three is the screen size, the composition of the image to match the screen size or less than the loss of pixels due to automatic system scaling, resulting in inconsistent left and right eye pixels, resulting in the inability to form a 3D effect.


5. The following is the left and right eye visual synthesis of the naked eyes, synthetic pictures in the computer or ordinary mobile phone looks a little blurry and ghosting, this indicates that the synthesis is correct, the left eye due to the existence of parallax, see the image will have a very small difference, these differences by the pixel column in the same picture, you can clearly see the difference, Under the refraction of the micro-cylindrical lens, the left and right eye can not see the pixels, thus creating a 3D visual effect.


6. Simple implementation Code included

Public Bitmap create3dimg () {    //bitmap BM = Bitmapfactory.decoderesource (This.getresources (), r.drawable.bb);    Bitmap BM = getbitmapbywidth (r.drawable.bb, 0);    int w = bm.getwidth ();    int h = bm.getheight ();    Bitmap Bitmap1 = Bitmap.createbitmap (W/2, H, Bitmap.Config.RGB_565);    Canvas canvas = new canvas (BITMAP1);    Rect msrcrect = new Rect (0, 0, W/2, h);    Rect mdestrect = new Rect (0, 0, W/2, h);    Paint paint = new paint ();    Paint.setalpha (+);    Canvas.drawbitmap (BM, msrcrect, mdestrect, null);    int ww = 1;    for (int i = 0; I < (((W/2)/WW)/2); i++) {        rect mrightsrcrect = new Rect ((W/2) +i*ww*2, 0, (W/2) +I*WW*2+WW, H );        Rect mDestRect2 = new Rect ((i+1) *ww*2, 0, (i+1) *ww*2+ww, h);        Canvas.drawbitmap (BM, mrightsrcrect, mDestRect2, null);    }    return BITMAP1;}




Android Phone Glasses 3D technology principles and programming implementation

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.