1 Introduction
Virtual Reality is an emerging and promising comprehensive computer technology. Modern high technology with computer technology as the core is used to generate a virtual environment of a specific range that integrates realistic vision, hearing and touch. Stereoscopic display is one of the key technologies of virtual reality. It makes people feel more immersed in the virtual world. The introduction of stereoscopic display can make the simulation of various simulators more realistic. Research stereoscopic imaging technology and use the existing microcomputer platform, combined with the corresponding software and hardware systems to display stereoscopic scenes on flat-panel displays.
2 Overview of Stereo Vision
According to research, the human brain can obtain depth (distance) clues from the following four aspects: depth clues in static images, depth clues caused by movement, physiological depth clues, and binocular parallax clues. Here, only binocular parallax clues are studied. When looking at the same scene with both eyes, due to the different positions of the left and right eyes in space, the perspectives of the two eyes will be different, and the images seen will also be different, with parallax, as shown in Figure 1a. The binocular images with parallax are fused by the brain to produce a stereoscopic image containing stereoscopic depth information. Generally, a pair of two-dimensional images with parallax seen by both eyes is called a stereoscopic image pair. If this pair of plane images is simulated and technical measures are taken so that the left eye can only see the image on the right and the right eye can only see the image on the left, the human visual system will fuse a pair of slightly different images in the two-dimensional space, thereby generating an image with a stereoscopic perception. According to the relative positions between the projection surface, the human eye and the observed object, there can be positive parallax (Figure 1b), negative parallax (Figure 1c) and zero parallax (Figure 1d).
3 Dual-center projection algorithm
From the above research, we can know that the generation of stereo image pairs is due to the different perspective results of objects observed by the left and right eyes. Therefore, two virtual eyes are set in the visual simulation of stereo display, one to obtain the image of the left eye and the other to obtain the image of the right eye, and the images of the left and right eyes are transmitted to the corresponding eyes respectively. Therefore. In stereo display, it is necessary to adopt a perspective projection method involving two viewpoints, a dual-center projection algorithm. Figure 2 shows the dual-center projection.
The left viewpoint Leye and the right viewpoint Reye are both on the X-axis. The distance between the two viewpoints is e. The center of the line connecting the two viewpoints is the origin of the coordinate system. The coordinates of the left viewpoint are (-e/2, 0, 0) and the coordinates of the right viewpoint are (+e/2, 0, 0). The projection plane is parallel to the XY plane, and the distance to the left and right viewpoints is d. The coordinates of a point P (xp, yp, zp) in the left viewpoint projection are (xl, yl, zl), and the coordinates of a point P (xr, yr, zr) in the right viewpoint projection are (xr, yr, zr), then zl=zr=d. The parametric equations of point P (xp, yp, zp) and the Reye projection line are:
It can be seen that when zp>d, 0
4. OpenGL realizes stereoscopic display
OpenGL (Open Graphic Library) is a 3D computer graphics and model library. It is independent of the operating system and hardware environment and is suitable for a wide range of computer environments from personal computers to workstations.
OpenGL has excellent performance in the production of 3D realistic graphics. This graphics library can not only easily produce high-quality still color images, but also create high-quality animation effects. With the help of the Windows programming environment, the human-computer interaction of the model can also be controlled. Due to its openness and high reusability, it has become an industry standard.
4.1 Rendering of Stereo Image Pairs
After calculating the stereo image pair according to the above projection algorithm, OpenGL is used to draw the stereo image pair, and the images for the right eye and left eye are drawn in red and green respectively. Take a cube with a length of 10 cm and a center point at the origin as an example. Assume that the distance e between the two viewpoints is 5 cm, and the distance d between the projection surface and the observer is 40 cm. Consider a vertex (5, 5, 5) of the cube. According to the above projection algorithm, we can get: xr=32 cm, xl=48 cm, yl=yr=4040 cm, zr=zl=d=40 cm. After calculating the eight vertices respectively, connect the corresponding stereo perspective projection points to get the stereo image pair of the cube. Use array vertex[8][3] to store the vertices, array translatetexr[8][3] to store the coordinates after the right eye projection calculation, and array translatetexl[8][3] to store the coordinates after the left eye projection calculation. Perform projection calculations on the corresponding points:
double Near.Far;//The distance between the front and back clipping surfaces and the observer
int ratio=width/height; //Ratio of the width and height of the display
ViewHeight2=Near*tan(radians); //Calculate the height of the field of view
ViewWidth2=ViewHeight2*ratio; //Calculate the width of the field of view
Calculate the visual field of the right eye;
left=-ViewWidth2-0.5*e*0.3;
right=ViewWidth2-0.5*e*0.3;
Project and draw the model:
glFrustum(left, right, bottom, top, Near, Far);
glDrawBuffer(GL_BACK_RIGHT); //Use the back right buffer
gluLookAt(0+e/2.0,5.0+d/2,0,-5,0,1,0);
//Determine the right eye position
glColor3f(1.0, 0.0, 0.0); //Draw with red
draw(); // Calculate and draw a stereo image pair
Similarly, draw the image of the left eye, as shown in Figure 3.
4.2 Use of double buffer
OpenGL provides double buffering technology, which supports hardware or software with two complete color buffers. When drawing one buffer, the contents of the other buffer are displayed. The buffers are swapped after each frame is drawn; the buffer just displayed is used for drawing, and the buffer used for drawing is displayed. In this way, when the display is refreshed, the buffer areas are swapped and the picture will not flicker.
OpenGL also supports stereoscopic viewing, implementing left color buffer and right color buffer, which are used for left stereo images and right stereo images respectively. During initialization, the parameters PFD_DOUBLEBUFFER and PFD_STEREO_DONTCARE can be used to support stereo display and double buffering. When using double buffering, usually only the back buffer is drawn. The function glDrawBuffer() can also specify that the stereo image is rendered to a specific buffer.
For example, when drawing the right eye image, use the right back buffer glDrawBuffer(GL_BACK_RIGHT), and when drawing the left eye, use the left back buffer glDraw-Buffer(GL_BACK_LEFT).
4.3 Observation of Stereoscopic Images
A simple filter can be used to observe a three-dimensional image. The principle is: because the filter (red and green filters are used in the experiment) absorbs other light and only allows light of the same color to pass through, the left and right eyes each transmit light of different colors. When using filters to observe a pair of stereo images on a computer screen, you will see an image with a sense of depth. In the experiment, it was found that the refresh rate plays an important role in the formation of the three-dimensional effect of the image. If the refresh rate is too low, the image maintained by the human eye has disappeared, and the three-dimensional stereoscopic feeling cannot be obtained; if the refresh rate is too high, one eye will see two images. Set the display refresh rate appropriately, set the image refresh rate to 50 Hz in the program, and use red and green filters to observe the three-dimensional imaging of the model to obtain a more obvious three-dimensional visual effect.
5 Conclusion
According to the principle of stereoscopic display, the binocular parallax algorithm is used to display objects in stereoscopic form, and OpenGL is used to generate stereoscopic image pairs. With the help of red and green filter glasses, a good stereoscopic visual effect is obtained. The introduction of stereoscopic display technology enhances people's immersion in virtual environments and can be widely used in many occasions such as building and visual roaming, virtual war training grounds, and various simulation training.
When using OpenGL's perspective projection transformation, you need to set the distance between the front and rear clipping planes and the observer, as well as the width and height of the front clipping plane. The width of the front clipping plane is expressed as the ratio of the width to the height, which is the ratio of the width to the height of the display window.
Previous article:Application of LED dot matrix digital mixed display in sports stadiums
Next article:Design of a wireless switch system for intelligent home lighting control
- Popular Resources
- Popular amplifiers
- Mir T527 series core board, high-performance vehicle video surveillance, departmental standard all-in-one solution
- Akamai Expands Control Over Media Platforms with New Video Workflow Capabilities
- Tsinghua Unigroup launches the world's first open architecture security chip E450R, which has obtained the National Security Level 2 Certification
- Pickering exhibits a variety of modular signal switches and simulation solutions at the Defense Electronics Show
- Parker Hannifin Launches Service Master COMPACT Measuring Device for Field Monitoring and Diagnostics
- Connection and distance: A new trend in security cameras - Wi-Fi HaLow brings longer transmission distance and lower power consumption
- Smartway made a strong appearance at the 2023 CPSE Expo with a number of blockbuster products
- Dual-wheel drive, Intellifusion launches 12TOPS edge vision SoC
- Toyota receives Japanese administrative guidance due to information leakage case involving 2.41 million pieces of user data
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- How to enhance the anti-interference capability of the microcontroller reset pin?
- Ultra-comprehensive PCB failure analysis technology
- Learn about laser processing technology in one article
- Which technology is best? Wi-Fi 6 (802.11ax) or 5G?
- [Evaluation and experience of Zhongke Yihaiwei EQ6HL45 development platform] +03. Flowing light simulation and board test (zmj)
- [HC32F460 development board evaluation] 06 wm8731 driving TPA3116 two-channel digital amplifier
- A video of former Finance Minister Lou Jiwei talking about 5G
- 【BearPi-HM Nano, play Hongmeng "Touch and Go"】-2-Build the development environment (dissuaded at first glance, ten minutes of actual operation)
- Download the latest gate driver chip selection guide in 2019
- If you want to know whether an electric car battery is good, what tests do you need to do?