16 August 2017 Virtual experiment of optical spatial filtering in Matlab environment
Author Affiliations +
Proceedings Volume 10452, 14th Conference on Education and Training in Optics and Photonics: ETOP 2017; 1045266 (2017) https://doi.org/10.1117/12.2269917
Event: 14th Conference on Education and Training in Optics and Photonics, ETOP 2017, 2017, Hangzhou, China
The principle of spatial filtering experiment has been introduced, and the computer simulation platform with graphical user interface (GUI) has been made out in Matlab environment. Using it various filtering processes for different input image or different filtering purpose will be completed accurately, and filtering effect can be observed clearly with adjusting experimental parameters. The physical nature of the optical spatial filtering can be showed vividly, and so experimental teaching effect will be promoted.
Yunjing, Chunyong, Yang, Jiancheng, Qinghua, Jing, and Zhonghua: Virtual Experiment of Optical Spatial Filtering in Matlab Environment



Optical information processing technology is widely used in many fields, such as information storage, image enhancement, feature recognition, and so on. Optical information processing is based on photon transfer information[1], optical or optoelectronic devices to operate the operation, the use of light transmission, interference and diffraction and other optical phenomena to achieve a variety of input information conversion or processing.

Optical spatial filtering experiment is an important experiment in optical information processing, can help students better understand the Abbe imaging principle, Fourier transform, more in-depth grasp of the basic concept such as spectrum and spatial frequency, more intuitive and vivid display “spectrum decomposition and synthesis”. However, due to the limitation of hardware conditions, the actual effect of optical spatial filtering experiment is not very good. With the help of the image display function and data processing function of an electronic computer, by changing flexibly experimental conditions, by producing a variety of filters In the virtual environment, the process and the effect of the experiment[2,3] can be more image display, complex physical images can also be dynamically rendered, and abstract concepts can be more vivid, boring content can be more interesting. Obviously, this method has positive significance to improve the students’ interest in experiment.

In the Matlab software environment, the virtual platform of optical spatial filtering experiment with graphical user interface (GUI) is established. For different forms of input image, it can set the filter with different structure and parameters, the image after filtering can be more vivid, so that students can get a good effect of experimental learning



In 1873, E. Abbe, a German scientist, presented a new concept of imaging in the study of microscopic imaging, He believes that the imaging process can be divided into two steps[4]: Firstly, the light waves emitted from the object (xi, yi coordinate) spread forward, and the Fraunhofer diffraction phenomenon occurs, The first diffraction image is obtained on the back focal plane of the objective lens (also known as Fourier plane or spectral plane); Secondly, As a new coherent light source, the secondary wavelet generated by the diffraction image spread forward, and the image is formed on the image plane (coordinate system), it is called the second diffraction image. This theory is usually referred to as Abbe principle of second image formation, which is one of the basic principles of optical information processing. As shown in Figure 1, Σi̖ Σξ̖ Σo corresponding to the plane of the object, the spectral plane, image plane.

Fig. 1

Schematic diagram of Abbe imaging


According to Fourier analysis, it is found that the distribution of light field on spectrum plane is closely related to the structure of the object[4]. In general, The low frequency information, that is, the Fourier low frequency component, is located near the origin; And far away from the origin, the higher frequency spectrum occupied. Therefore, in accordance with Abbe principle of second image formation, all the diffracted light must be involved in the imaging process to obtain an identical image with the object. However, because of the limited size of the objective lens, the higher order diffraction light (High spatial frequency component) can not be collected by the objective lens, which results in the loss of the high frequency component of the spatial frequency of the focal plane of the objective lens, so the details of the image are also lost. Therefore, by changing the spatial frequency spectrum of the object, we can transform the image to meet the requirements of different situations



Optical spatial filtering experiment is an experiment to verify the Abbe imaging theory. In the experiment, the 4f image-forming system is usually used. by placing filter with different type and structure on the spectrum plane, and the spatial frequency components on the spectral plane are artificially selected to pass or not pass, or changed, and then images that reflect the different features of objects can appear in the image plane. As shown in Figure 2, the filter is placed in the back focal plane of the lens L1 (i.e., the spectral plane).

Fig. 2

Optical spatial filtering 4f system


Here, if the aperture limitation is not taken into account, light field distribution of the object plane ui (x, y), and the light field distribution of the spectral plane is:


After two step imaging process, the light field distribution in the image plane is obtained:


This formula shows that a real image, with the same thing but stand upside down as the object image, appears in the image plane Σo.

If the filter H(ξ, η) is placed on the frequency plane, then the light field distribution in the image plane is:


where h(x, y) is also known as impulse response function of H(ξ, η).

Above show that, in the frequency domain, the output image spectrum is the product of the input image spectrum function and the filter transfer function, and in spatial domain, the light field distribution of the output image is the convolution of the input image and the filter impulse response function. The degree of similarity between the output image and the input image depends entirely on how much of the frequency spectrum of the input image is passed through the filter to the image plane. For this reason, we can design a variety of filters placed on the frequency plane, which are used to extract (or abandon) certain frequency bands, that is, to actively change the distribution of the frequency spectrum, so as to achieve the purpose of transforming the output image.



In the process of computer simulation, we use an image instead of the object. The image can be generated by the image processing software or be acquired by reading an existing image, as shown in Figure 3

Fig. 3

Image waiting for filtering


According to Abbe imaging theory, the structure of the image and the distribution of the spatial frequency spectrum are one-to-one correspondence. Analysis of the image shown in Figure 3 a can be seen, as the grid is an image with periodic function, the corresponding spectrum should be a regular array of discrete lattice, and the grid has the characteristics of short period and high frequency, and its spectrum distribution will be extended further; However, Chinese character Inline-1.jpg is an image with non periodic function, its spectrum distribution is continuous rather than discrete. At the same time, compared with the grid, strokes of the Chinese character Inline-1.jpg is thicker, indicating that the proportion of low frequency components in the spatial spectrum distribution is more, and the frequency spectrum will be mainly concentrated near zero frequency. That is to say, the information of Chinese character Inline-1.jpg is mainly distributed in the region near the center of the spectrum, but there is little information about the grid. In order to verify the above theory, the image after filtering is investigated through the Fourier transform to the image shown in Figure 3. To this end, a circular low-pass filter and a slit filter are set respectively to be able to adjust the parameters, by adjusting the filter window size, the students can more easily observe the filtering effect and more accurate understanding of Abbe's theory of image formation.

According to the principle of Abbe-Potter spatial filtering experiment, if the low-pass filter is set on the frequency spectrum, the low frequency information can pass through the imaging system to the image plane and the high frequency information will be cut off; That is, the filtered image is composed of low frequency components and lack of high frequency components. Moreover, the smaller the size of the low-pass filter, the less the spatial frequency spectrum of the image plane, and the lower the cut off frequency. Figure 4 shows several low-pass filters of different sizes and the filtering results with image shown in Figure 3. Among them, a, b, c, three kinds of circular low-pass filter; d, e, f, respectively, the corresponding filtering results. As shown in Figure 4 (a), (d), because of the low-pass filter size is too small(Fig.4a), so that only the zero frequency information can pass while the remaining spectrum cut-off in this case, the grid and the Chinese characters of Inline-1.jpg almost disappeared, and a fuzzy black spot appears in the position of Inline-1.jpg, but the structure of original image can not be seen completely; Because the spatial spectrum of the Chinese character Inline-1.jpg is mainly distributed near the center, it can pass through the filter as shown in Figure 4 (b) when the filter window of the low-pass filter is enlarged, however the spectrum of the grid still can not pass through the filter, so after filtering the Chinese character Inline-1.jpg appears while the grid is still disappear, as shown in Figure 4 (e); Continue to enlarge the low-pass filter window as shown in Figure 4 (c), the size of the filter is large enough, most of the spectrum information of the Chinese characters “light” and the grid can pass through the filter to image plane, just because of the loss of some high frequency components, so that the sharpness of the edge is reduced, so the grid and the Inline-1.jpg seem to be a bit fuzzy [5]

Fig. 4

Several low-pass filters of different sizes and filtering effect for the image(Inline-1.jpg + grid)


Figure 5 shows the different width of the slit filter and filter effect for Figure 3. Among them, a, b and c are three kinds of horizontal slit filters with different widths, respectively. d, e, f are the corresponding filtering results. When the slit width is relatively narrow, as shown in Figure 5 (a), only those frequency spectrum just right located near the horizontal center line can pass through the filter, therefore only vertical structure of the grid appears on the image plane, and the Chinese character Inline-1.jpg is completely gone, as shown in Figure 5 (d).

Fig. 5

Several slit filters with different width and filtering effect for the image(Inline-1.jpg + grid)


Increase the slit width, as shown in Figure 5 (b), in this case, not only those frequency spectrum near the horizontal center line can pass through the filter, because of the spectrum of the Chinese character Inline-1.jpg is mainly distributed in the near zero frequency, most of the information of the Inline-1.jpg can be through the filter; Therefore, there are not only vertical stripes in the image, but also the image of the Inline-1.jpg, however, due to the loss of the spectral components are more, at this time, the Inline-1.jpg is ambiguous, as shown in Figure 5 (e). Continue to increase the width of the slit, as shown in Figure 5 (c), slit width at this time is wide enough, all frequency components of the image (Inline-1.jpg + grid) can be almost unimpeded, so the filtered image and the original image is almost the same, the grid and the Chinese character Inline-1.jpg are clearly presented, as shown in Figure 5 (f).



In order to use the convenient interface needs to be established, which can realize different functions, such as loading images for processing, selecting the filter type, setting and adjusting the parameters of the filter, or achieve filtering, display, preservation and other basic functions, and students can also choose to display the experimental principle and Abbe imaging principle and experiment of optical path. That can help students to understand the principle and process of filtering. Obviously, the use of virtual experiment interface, the filtering effect under different experimental conditions can be very convenient to show up, students can be more intuitive and vivid understanding of the relationship between the spatial frequency and the image structure, can know well the Abbe imaging principle.



According to the Abbe-Potter spatial filtering experiment, a relatively complete graphical user interface (GUI) with the computer simulation platform was built, which can be completed under the different conditions of filtering requirements, it's very convenient to observe the difference of experimental results caused by different filters. Through the simulation experiment platform, students can not only more flexibly changing experimental conditions, and observe a richer and clearer experimental phenomenon than the real experiment, but also to understand more deeply the Abbe imaging principle, realize the fun of more optical experiments, stimulate further research enthusiasm.



Chen Jiabi, Su Xianyu. “Principle and application of optical information technology”. Beijing: Higher Education Press, 2002Google Scholar


Xie Jianing, Zhao Jianlin. “Computer simulation of optical spatial filtering process”. Journal of photonics, 31 (7): 847~850(2002)Google Scholar


He Yu. “Abbe imaging principle and spatial filtering experiment and computer simulation experiment”. physics and engineering, (2): 19~23(2006)Google Scholar


Su Xianyu, Li Jitao, Cao Yiping, Zhang Qican. “Information optics (Second Edition)”. Beijing: Science Press, 2011Google Scholar


Pan Bogen. “Study on simulation software of information optics”. Anhui: HeFei University of Technology, 2010Google Scholar

© (2017) COPYRIGHT Society of Photo-Optical Instrumentation Engineers (SPIE). Downloading of the abstract is permitted for personal use only.
Yunjing Ji, Yunjing Ji, Chunyong Wang, Chunyong Wang, Yang Song, Yang Song, Jiancheng Lai, Jiancheng Lai, Qinghua Wang, Qinghua Wang, Jing Qi, Jing Qi, Zhonghua Shen, Zhonghua Shen, } "Virtual experiment of optical spatial filtering in Matlab environment", Proc. SPIE 10452, 14th Conference on Education and Training in Optics and Photonics: ETOP 2017, 1045266 (16 August 2017); doi: 10.1117/12.2269917; https://doi.org/10.1117/12.2269917

Back to Top