# An Optimized Digital Image Processing Algorithm for Digital Oil Painting

Authors: Jinyu Tang
Journal: Mobile Information Systems
 (2022)

---

## Abstract

Human civilization’s accomplishments have grown with the passage of time and the advancement of society. With the fast growth of computer networks and information technology, the conventional method of information transmission based on words cannot fulfill the demands of people in the current era. As a result, in this age of extensive information and image processing techniques, images as a means of information sharing are becoming increasingly popular. As we know, digital image processing knowledge has a far-reaching impact in the field of artistic creation, among which the creation of oil painting is facing severe challenges. Aiming at the problem that the effect of digital oil painting is not ideal, this paper aims to study digital oil painting by using digital image processing technology. This paper first uses the image edge recognition based on the improved Canny algorithm to detect the edge of the oil painting image, then uses the nonlinear image enhancement algorithm to enhance the effect of the oil painting image, then uses the improved genetic algorithm to segment the image, and finally enlarges the oil painting image to calibrate the color of the oil painting image. Experiments reveal that the proposed approach outperforms existing algorithms in terms of edge detection data integrity, high-quality coefficient index of image enhancement, picture segmentation running time, and the ability to successfully increase the visual effect of oil painting.


---

## Body

## 1. Introduction

Currently, the rapidly developing civilization is classified as an information society. It is capable of not only storing a huge quantity of data and information on a computer but also progressively infiltrating many segments of society through numerous computer technologies. This rapid advancement in information technology has expedited the promotion of digital products utilizing computer systems. In addition, it directly inspired the development of software design tools and strongly affected the area of artistic formation, particularly technology of computer graphics with its effective visuals and pictures. Because of this, the computation task has been enhanced to be more powerful and user-friendly. Normal individuals can also utilize it effectively after learning, enhancing their fluency [1]. Image analysis technology is a type of technology that is designed and applied in response to social demands and is widely employed in a variety of industries. The image processing and computer technologies are closely linked; they both provision and encourage one another. The used variety of picture detection methods based on the picture as an information transporter has grown with the fast expansion of data transfer rate [2, 3], processing speed, and storage capacity. There are several benefits to use the computer-based image detection technology. It also has high data processing capabilities, and thus it is extensively utilized in data analysis.In terms of study findings, current research on the interaction between the development of oil paintings and digital technology is still in its early stages. When experts examine Chinese oil paintings in China, they primarily analyze and investigate the application of imagery. By using image processing algorithms, we may easily change photographs as needed, transform conventional images into unexpected shapes, and appropriately combine various items that would be hard to present on the same screen. An oil painting production process has been devised using computer image analysis technologies. System testing reveals that the painting effect of the oil painting generating system is comparable to the fake painting effect. It concentrates on displaying the attributes of oil painting in terms of paintings and colors, which is greatly following people’s customization and creativity of oil painting. The sketching method works well with the hand-painting technique, the brushing movements are more natural, and the color has been appropriately adjusted, resulting in a softer overall trend. There are several points of convergence between the different disciplines of picture and painting. Traditional art principles are under significant challenges.According to the early work of [4], earlier the use of digital image innovation, oil painting formation mixed with computer technology mainly followed two creative concepts. The first method is to program the preparation of the picture processing of quantization using a computer programming language. The second technique is to directly process or produce pictures using mature image processing technology [5]. However, according to [6] contemporary picture art production concentrates solely on the technological innovation of realistic images, whereas digital image innovation for the oil painting process has yet to develop a level, and research outcomes are even more limited. Nevertheless, from some other angle, it is clear that the advancement of digital image technology and advanced optimized production has a massive development area and commercial possibilities, as is characteristic of the merger of Xinshida information technology and advanced art cultures [7, 8].By the gradual progress and development of digital picture handling skills, technology of image processing has an important effect on the area of the formation of art. Though digital image technology has much space for growth in the creation of oil paintings, it has yet to build a research scale, the research basis remains relatively poor, and there is a dearth of reference material [9]. Simultaneously, the creation of oil painting in the field of art is also facing severe challenges. In the procedure of creation of oil painting, the effective application of processing of digital image skills has to turn into a form of oil painting formation and has developed gradually into the way of oil painting creation reform and innovation and an inevitable trend. In the procedure of oil painting creation, the integration of computer digital image processing skills into oil painting creation can not only innovate oil painting knowledge but also make oil painting creation ideas more expanded and diversified. Because of these issues, this research paper aims to study digital oil painting by using digital image processing technology. To achieve the desired goals, this paper first uses image-based recognition based on the best Kenny algorithm to detect the edge of the oil painting image. Following that, it employs the nonlinear image enhancement method to increase the effect of the oil painting picture, followed by the enhanced genetic algorithm to segment the image. Finally, the oil painting picture is enlarged to calibrate the color of the oil painting image. The following are the publication’s contributory factors:(1)
This paper is primarily divided into four sections; in the first section, the detection of the edge of the oil painting picture is explained; in the second section, the image edge discovery based on an improved Canny algorithm is used; third, by nonlinear image improvement to improve the oil painting image information and segment the enhanced image; and finally, enlarge the picture of the oil painting and adjust the color.(2)
It discusses the edge detection of an oil painting picture, the enhancement of an oil painting image, the segmentation of an oil painting image, the enlargement of an oil painting image, and the color calibration of an oil painting image.(3)
Finally, the findings indicate that the technique planned in this paper is better than other methods, which is of great significance to the subsequent oil painting creation.The remaining of this paper is organized as follows. Section2 consists of related work, Section 3 analyzes the digital oil painting using digital image handling technique, Section 4 explains the generation of digital oil painting, and Section 5 analyzes the experimental results.


## 2. Related Work

Currently, the software progress of digital oil painting systems in the market is quiet in the primary step, and there is not much investigation on the methods of digital optimization production. As a result, research on digital oil painting skill offers comprehensive economic value and application opportunities. The following is an analysis of the existing digital image processing methods. In this regard, the early work of [10] pointed out that edge wrapping often occurs in the application of conventional algorithms based on Gaussian or modular sharpening and oil painting image enhancement, and there will be obvious edge wrapping of dark light and bright light on the targets with a strong contrast with the neighborhood. Most methods do not deal with the existing edge wrapping phenomenon, resulting in obvious edge wrapping of some scene targets in oil painting. An analysis of the causes of the problem of edge wrapping reveals that when obtaining a high-frequency image of oil painting, a Gauss method for weight calculation is mainly used on the position difference. When obtaining the high-frequency details of the image, the weight method is adjusted by increasing the gray difference to obtain the image details, or the processing form of high-frequency details is used; although this method can improve the edge wrapping problem of the enhanced image, it cannot efficiently improve the color effect of the oil painting image.The author of [11] has taken the moving target tracking algorithm based on the template matching in the image as an example, the tracking performance of the MATLAB prototype algorithm is effectively reviewed, and the process of multi-level optimization of the algorithm is introduced in detail. The two aspects are continually optimized beginning with the MATLAB prototype method. In terms of increasing the speed of real-time processing, utilizing C language to accelerate, and merging processes, the basic multi-template method is utilized to increase accuracy. The test structure demonstrates that the algorithm’s speed is greatly increased, as is the accuracy of picture tracking, but it does not cause the image to have a diverse effect. The work of [12] proposed a decomposition algorithm of two-dimensional local values. The decomposition algorithm of two-dimensional local value can decompose the oil painting source image into many components of the two-dimensional production function. The basic concept is to utilize the variable neighborhood approach to retrieve the image’s extreme points throughout the degradation process. Then, using the fractal theory, interpolate the oil painting image to extract data information such as the mean surface. In addition, in the screening operation, assess and count the extreme points that do not coincide on the plane projection among the nearby surfaces, and provide the stop conditions that satisfy the attributes of the oil painting picture. This ensures that the deconstructed picture components accurately represent the true image feature information. Finally, a two-dimensional local value decomposition technique is presented, and studies indicate that, while this approach effectively decomposes the oil painting picture, it results in the loss of image features throughout the decomposition process.Similarly, the author in [13] pointed out that while determining the threshold, it is important to avoid premature local optimization of the bird’s swarming method. A genetic variation-based bird swarm oil painting image separation method was proposed here. The selection and variation of the genetic algorithm are merged after the iteration of the bird’s swarm algorithm to strengthen the local search energy of the best solution and prevent slipping into the local optimal solution. The filter is used to process the noise picture from an oil painting to reduce noise pollution. The experimental findings are compared with several picture segmentation techniques, with the highest inter-class variance serving as a function. The experimental results show that the validity of the bird’s swarm algorithm based on genetic variation is improved over other approaches; however, this method results in a picture with no discernible color effect. Inspired by the achievements of the aforementioned scholars, this paper aims to study digital oil painting by using digital image processing technology by using the image edge recognition based on the improved Canny algorithm to detect the edge of the oil painting image. In addition, it uses the nonlinear image enhancement algorithm to enhance the effect of the oil painting image, then uses the improved genetic algorithm to segment the image, and finally enlarges the oil painting image to calibrate the color of the oil painting image.


## 3. Analysis of Digital Oil Painting Based on Digital Picture Processing Technology

### 3.1. Image Edge Recognition Based on Enhanced Canny Algorithm

The improved Canny edge detection algorithm begins with the median filtering algorithm, which is used to remove noise from images and indicators. The median filter is quite important in image analysis because it is well recognized for preserving edges throughout the removal of noise. The Gaussian filtering approach is then used to minimize the amount of noise in the image by enhancing edge detection precision. Finally, the pixel convolution is presented, which allows for multiplying together two arrays of numbers, often of various sizes but of the same dimensions, to form a third array of numbers of the same dimension. In other words, it adaptively determines the lower and higher thresholds based on picture pixel information. The main flow of the image edge detection algorithm of the improved Canny algorithm is revealed in Figure1.Figure 1
Flow of improved Canny algorithm.Any oil painting image edge detection algorithm cannot work well on the data without processing. When using Canny algorithm to identify the edge of oil painting image, the first thing is to smooth the oil painting image. Because the median filter algorithm has better effect on image edge protection and Gaussian filter has better effect on noise removal, a combination of the two methods is adopted [14, 15].


#### 3.1.1. Adaptive Median Filtering Algorithm

We offer an adaptive median filter technique for removing impulsive noise in X-ray pictures and scattering in ultrasound images. The standard median filter distorts or loses fine features in a picture. In addition, a major portion of the original data in the image has been changed. Traditional Gaussian filtering cannot effectively take into account the preservation of image edge information and image noise smoothing. Adaptive median filtering can not only reduce noise but also retain image edge information. The flowchart of the median filtering algorithm is explained in Figure2.Figure 2
Flowchart of median filtering algorithm.The specific steps are as follows.Firstly, setfi,j as the image gray value of oil painting pixel points i,j, wi,j represents the current gray window size, set the initial window size w=3, fmin denotes the minimum value of gray in the window, fmed represents the median value of gray in the window, and fmax represents the maximum value of gray in the window:Whenfmin≺fmed≺fmax, you can go to the next step, otherwise increase the size of wi,j. If the size of wi,j is less than wmax, you can repeat the operation, otherwise output fi,j:Iffmin≺fmed≺fmax, fi,j can be output, otherwise fmed can be output.


#### 3.1.2. Adaptive Gaussian Filtering Algorithm

Within image processing and computer vision, Gaussian filtering has been extensively researched. Gaussian filters are used to reduce noise and smooth it out. The signal is likewise distorted at the same time. Edge location displacement, edge disappearances, and phantom edges can all be caused by using Gaussian filters as preprocessing for edge detection.The oil painting image processed by median filter is processed by adaptive Gaussian filter to remove Gaussian noise in oil painting image [16]. Firstly, Gaussian kernel is generated through two-dimensional Gaussian filter function given in(1)fi,j=12πσ2e−i−k−1/2σ2.In above equation,k represents the radius of Gaussian kernel and σ represents the standard deviation. When the image convolution window slides, the weight of the Gaussian kernel coefficient is proportional to the variance, and the standard deviation of the Gaussian kernel can be obtained according to the variance σ. The calculation method of variance in a certain area of oil painting image is given in(2)Di,j=∑i,j∈Sx,yxij−x¯2i×j,(3)x¯=∑i,j∈Sx,yxiji×j.In the above equation,Si,j represents the convolution window of the image center point i,j. The greater the variance Di,j value, the greater the degree of dispersion of the pixel value of the oil painting image in the SIJ area, and the smaller the value is selected σ The greater the coefficient weight of generating Gaussian kernel, the smaller the impact on this area of the image [9, 10]. According to this characteristic, the variance σ is compared with the filter function fi,j of two-dimensional Gaussian, and the function can be obtained (4)Ri,j=Di,jfi,j.In equation (4), Di,j is a constant, while Ri,j is the Gaussian kernel radius k and standard deviation is σ. It can be represented by (5)R≈Dσ2keσ2.WhenR=1, the size of the parameter weight in the kernel of Gaussian is closest to the pixel value weight, where the standard deviation is σ. It is calculated from the variance D of pixel values in Sx,y image area. In this way, repeated iterations are carried out to form an adaptive Gaussian filter. Finally, the processing of Gaussian filter is completed after all the pixels of oil painting image are convoluted.


### 3.2. Nonlinear Adaptive Oil Painting Image Enhancement Algorithm

Three steps make up the nonlinear adaptive oil painting picture enhancement algorithm. A Red_Green_Blue (RGB) color picture is first converted to an intensity image, after which the intensity image is subjected to adaptive intensity modification with contrast enhancement based on the immediate neighborhood, and finally, the colors are reconstructed to provide the enhanced result. The primary stage is adaptive intensity modification with contrast enhancement depending on the immediate neighborhood. Because the contrast in the intensity-adjusted picture may be decreased, a contrast enhancement technique is conducted concurrently to improve the visual impression. Finally, an improved color image is created by running a linear color restoration method on the source image’s chromatic information.If the size of the oil painting imageW×H, A represents the average value of the histogram of the oil painting image, that is, A=W×H/256, and the value of threshold Δ=0.3A is more appropriate. Like this, the ratio of signal to noise of the oil painting image after acquisition and processing is very high, the noise is removed very clean, the image difference is also significantly enhanced, and the visual effect of human eyes is also better. Modify the histogram to(6)W×H⋅A=W×H256Δ=0.3A,his′r=hisrhisr≥Δ,0hisr≺Δ.The gray-level number of the image withhis′=0 is Lr.The amount of effective gray stages within the range of gray0.255 of the whole image is Le:(7)Le=255−Lr.The amount of idle gray-level LR counted in the earlier phase is assigned as per the size of the gray-level generation frequency. The empty gray-level allocation here is only related to the size of the generation frequency of higher gray levels. The gray-level allocation of oil painting images with higher generation frequency is less, and the gray-level allocation of oil painting images with lower generation frequency is more [17]. In this method, the interval between gray levels of picture target features with low generation frequency may be prolonged. Furthermore, the detail section of the oil painting picture may be enlarged, and the different image segments with a high generation frequency of gray level can merge with the target with a low generation frequency of gray level in the image histogram equalization technique.It is assumed that the function of probability density of image gray level is expressed as follows:(8)Pk=nkn.In equation (8), n represents the total number of pixels in the oil painting image, and nk denotes the frequency of pixels whose gray level is rk.The amount of idle gray levelsLk of the image assigned to the gray level is calculated as follows:(9)LkLr=1−Pk∑i=02551−Pi,Lk=1−Pk∑i=02551−Pi.Therefore, the gray level of the gray levelrk of the oil painting image occupies the number of gray levels Lk′, which is expressed as follows:(10)Lk′=1−Lk.These nonzero gray levels are nonlinear stretched and arranged within the overall gray range, and the function of image transformation is expressed as follows:(11)sk=Trk=∑i=0kLi′.The above content completes the enhancement of digital oil painting image, so that the oil painting image has higher contrast and visual effect.


### 3.3. Image Segmentation Algorithm Based on Improved Genetic Algorithm

A genetic algorithm is a sophisticated heuristic method that simulates genes [18]. The genetic algorithm, that is a search-based enhancement approach based on the evolutionary notions of natural selection and the concept of genetics, was invented by John Holland and is highly regressive and investigated in [19, 20]. It is commonly used to solve tough issues by finding optimum or near-optimal approaches. For issue resolution, the genetic algorithm replicates the survival of the fittest among individuals over a sequential generation. Each generation is made up of a population of special characters that function similarly to chromosomes. The genetic algorithm inspires one community of the chromosomal to an initial demographic through an evolutionary process. Individuals battle for resources and mates in a population. Those who are the greatest will have more children than those that are the worst. Figure 3 depicts the operation of a basic genetic algorithm.Figure 3
Flowchart of the operation of a basic genetic algorithm.The very first initial population can be created by selecting solutions to problems at random. It can also be thought of as a collection of chromosomes. Random and heuristic initializations are the two main ways of starting a population. Following that, the fitness value advises about how to fit an individual. A fitness function is a form of the objective function or parameter estimation in which GA has been used to enhance the final output by modifying the parameters of an image preprocessing segmentation algorithm. The selection step is the process of selecting the fittest people or chromosomes from a group and allowing them to pass on their genetics to the next generations. Similarly, the crossover is a genetic operator that merges the genetic information of two people or parents to continue producing children. Each pair of parents is taken for mating by the crossover operator. The intersection point is picked at random. The mutation is utilized to preserve and add genetic variety to the population while also preventing immature mixing. When a crossover is trapped in a local minima situation, mutation should enable the algorithm to circumvent it by stopping the chromosome from populating by inverting the gene. The procedure of modifying the gene codes in a chromosome is known as mutation. When a GA run ends or the merging requirement is met, the expiry condition of the genetic algorithm is calculated.In addition to improving the aforementioned oil painting picture, the optimal answer, which is the oil painting image threshold, may be found using the evolutionary algorithm. A good choice of threshold rate and variability rate is critical when utilizing genetic algorithms to compute the maximum threshold. This method significantly influences the convergence of [21]. The adaptive genetic algorithm can effectively adjust the probabilities of crossover and mutation as per the ability in the adaptive genetic algorithm. Furthermore, pc and pm are adjusted as per(12)pc=k1fmav−f′fmav−favg,k2,(13)pm=k3fmav−ffmav−favg,k4.In the above equation,fmav denotes the chief ability value in the oil painting image group, favg denotes the average fitness value of each generation group, f′ represents the larger fitness value in the individual to be crossed, f represents the individual fitness value to be mutated, and k1, k2, k3, and k4 represent the adjusted coefficient.As can be seen from equations (12) and (13), when the fitness value of the image individual is close to the highest fitness value, the probabilities of crossover and mutation are relatively small. When the fitness value of the image individual is equal to the maximum value, the crossover probability and mutation probability are close to zero. This easily leads to the evolution trend of local optimization of oil painting images [22]. Therefore, the improved genetic algorithm can be used to make the algorithm jump out of the local optimal solution and obtain the global optimal solution of the image.(14)pc=pc1⋅ef′−favg\/fmav−favgpc1,,pm=pm1⋅ef−favg\/fmav−favg,pm1.In the above equation,pc1 denotes the maximum crossover probability of the image, and pm1 represents the maximum mutation probability of the image. The improved genetic algorithm can get the optimal solution and the optimal oil painting image segmentation threshold.


## 3.1. Image Edge Recognition Based on Enhanced Canny Algorithm

The improved Canny edge detection algorithm begins with the median filtering algorithm, which is used to remove noise from images and indicators. The median filter is quite important in image analysis because it is well recognized for preserving edges throughout the removal of noise. The Gaussian filtering approach is then used to minimize the amount of noise in the image by enhancing edge detection precision. Finally, the pixel convolution is presented, which allows for multiplying together two arrays of numbers, often of various sizes but of the same dimensions, to form a third array of numbers of the same dimension. In other words, it adaptively determines the lower and higher thresholds based on picture pixel information. The main flow of the image edge detection algorithm of the improved Canny algorithm is revealed in Figure1.Figure 1
Flow of improved Canny algorithm.Any oil painting image edge detection algorithm cannot work well on the data without processing. When using Canny algorithm to identify the edge of oil painting image, the first thing is to smooth the oil painting image. Because the median filter algorithm has better effect on image edge protection and Gaussian filter has better effect on noise removal, a combination of the two methods is adopted [14, 15].


### 3.1.1. Adaptive Median Filtering Algorithm

We offer an adaptive median filter technique for removing impulsive noise in X-ray pictures and scattering in ultrasound images. The standard median filter distorts or loses fine features in a picture. In addition, a major portion of the original data in the image has been changed. Traditional Gaussian filtering cannot effectively take into account the preservation of image edge information and image noise smoothing. Adaptive median filtering can not only reduce noise but also retain image edge information. The flowchart of the median filtering algorithm is explained in Figure2.Figure 2
Flowchart of median filtering algorithm.The specific steps are as follows.Firstly, setfi,j as the image gray value of oil painting pixel points i,j, wi,j represents the current gray window size, set the initial window size w=3, fmin denotes the minimum value of gray in the window, fmed represents the median value of gray in the window, and fmax represents the maximum value of gray in the window:Whenfmin≺fmed≺fmax, you can go to the next step, otherwise increase the size of wi,j. If the size of wi,j is less than wmax, you can repeat the operation, otherwise output fi,j:Iffmin≺fmed≺fmax, fi,j can be output, otherwise fmed can be output.


### 3.1.2. Adaptive Gaussian Filtering Algorithm

Within image processing and computer vision, Gaussian filtering has been extensively researched. Gaussian filters are used to reduce noise and smooth it out. The signal is likewise distorted at the same time. Edge location displacement, edge disappearances, and phantom edges can all be caused by using Gaussian filters as preprocessing for edge detection.The oil painting image processed by median filter is processed by adaptive Gaussian filter to remove Gaussian noise in oil painting image [16]. Firstly, Gaussian kernel is generated through two-dimensional Gaussian filter function given in(1)fi,j=12πσ2e−i−k−1/2σ2.In above equation,k represents the radius of Gaussian kernel and σ represents the standard deviation. When the image convolution window slides, the weight of the Gaussian kernel coefficient is proportional to the variance, and the standard deviation of the Gaussian kernel can be obtained according to the variance σ. The calculation method of variance in a certain area of oil painting image is given in(2)Di,j=∑i,j∈Sx,yxij−x¯2i×j,(3)x¯=∑i,j∈Sx,yxiji×j.In the above equation,Si,j represents the convolution window of the image center point i,j. The greater the variance Di,j value, the greater the degree of dispersion of the pixel value of the oil painting image in the SIJ area, and the smaller the value is selected σ The greater the coefficient weight of generating Gaussian kernel, the smaller the impact on this area of the image [9, 10]. According to this characteristic, the variance σ is compared with the filter function fi,j of two-dimensional Gaussian, and the function can be obtained (4)Ri,j=Di,jfi,j.In equation (4), Di,j is a constant, while Ri,j is the Gaussian kernel radius k and standard deviation is σ. It can be represented by (5)R≈Dσ2keσ2.WhenR=1, the size of the parameter weight in the kernel of Gaussian is closest to the pixel value weight, where the standard deviation is σ. It is calculated from the variance D of pixel values in Sx,y image area. In this way, repeated iterations are carried out to form an adaptive Gaussian filter. Finally, the processing of Gaussian filter is completed after all the pixels of oil painting image are convoluted.


## 3.1.1. Adaptive Median Filtering Algorithm

We offer an adaptive median filter technique for removing impulsive noise in X-ray pictures and scattering in ultrasound images. The standard median filter distorts or loses fine features in a picture. In addition, a major portion of the original data in the image has been changed. Traditional Gaussian filtering cannot effectively take into account the preservation of image edge information and image noise smoothing. Adaptive median filtering can not only reduce noise but also retain image edge information. The flowchart of the median filtering algorithm is explained in Figure2.Figure 2
Flowchart of median filtering algorithm.The specific steps are as follows.Firstly, setfi,j as the image gray value of oil painting pixel points i,j, wi,j represents the current gray window size, set the initial window size w=3, fmin denotes the minimum value of gray in the window, fmed represents the median value of gray in the window, and fmax represents the maximum value of gray in the window:Whenfmin≺fmed≺fmax, you can go to the next step, otherwise increase the size of wi,j. If the size of wi,j is less than wmax, you can repeat the operation, otherwise output fi,j:Iffmin≺fmed≺fmax, fi,j can be output, otherwise fmed can be output.


## 3.1.2. Adaptive Gaussian Filtering Algorithm

Within image processing and computer vision, Gaussian filtering has been extensively researched. Gaussian filters are used to reduce noise and smooth it out. The signal is likewise distorted at the same time. Edge location displacement, edge disappearances, and phantom edges can all be caused by using Gaussian filters as preprocessing for edge detection.The oil painting image processed by median filter is processed by adaptive Gaussian filter to remove Gaussian noise in oil painting image [16]. Firstly, Gaussian kernel is generated through two-dimensional Gaussian filter function given in(1)fi,j=12πσ2e−i−k−1/2σ2.In above equation,k represents the radius of Gaussian kernel and σ represents the standard deviation. When the image convolution window slides, the weight of the Gaussian kernel coefficient is proportional to the variance, and the standard deviation of the Gaussian kernel can be obtained according to the variance σ. The calculation method of variance in a certain area of oil painting image is given in(2)Di,j=∑i,j∈Sx,yxij−x¯2i×j,(3)x¯=∑i,j∈Sx,yxiji×j.In the above equation,Si,j represents the convolution window of the image center point i,j. The greater the variance Di,j value, the greater the degree of dispersion of the pixel value of the oil painting image in the SIJ area, and the smaller the value is selected σ The greater the coefficient weight of generating Gaussian kernel, the smaller the impact on this area of the image [9, 10]. According to this characteristic, the variance σ is compared with the filter function fi,j of two-dimensional Gaussian, and the function can be obtained (4)Ri,j=Di,jfi,j.In equation (4), Di,j is a constant, while Ri,j is the Gaussian kernel radius k and standard deviation is σ. It can be represented by (5)R≈Dσ2keσ2.WhenR=1, the size of the parameter weight in the kernel of Gaussian is closest to the pixel value weight, where the standard deviation is σ. It is calculated from the variance D of pixel values in Sx,y image area. In this way, repeated iterations are carried out to form an adaptive Gaussian filter. Finally, the processing of Gaussian filter is completed after all the pixels of oil painting image are convoluted.


## 3.2. Nonlinear Adaptive Oil Painting Image Enhancement Algorithm

Three steps make up the nonlinear adaptive oil painting picture enhancement algorithm. A Red_Green_Blue (RGB) color picture is first converted to an intensity image, after which the intensity image is subjected to adaptive intensity modification with contrast enhancement based on the immediate neighborhood, and finally, the colors are reconstructed to provide the enhanced result. The primary stage is adaptive intensity modification with contrast enhancement depending on the immediate neighborhood. Because the contrast in the intensity-adjusted picture may be decreased, a contrast enhancement technique is conducted concurrently to improve the visual impression. Finally, an improved color image is created by running a linear color restoration method on the source image’s chromatic information.If the size of the oil painting imageW×H, A represents the average value of the histogram of the oil painting image, that is, A=W×H/256, and the value of threshold Δ=0.3A is more appropriate. Like this, the ratio of signal to noise of the oil painting image after acquisition and processing is very high, the noise is removed very clean, the image difference is also significantly enhanced, and the visual effect of human eyes is also better. Modify the histogram to(6)W×H⋅A=W×H256Δ=0.3A,his′r=hisrhisr≥Δ,0hisr≺Δ.The gray-level number of the image withhis′=0 is Lr.The amount of effective gray stages within the range of gray0.255 of the whole image is Le:(7)Le=255−Lr.The amount of idle gray-level LR counted in the earlier phase is assigned as per the size of the gray-level generation frequency. The empty gray-level allocation here is only related to the size of the generation frequency of higher gray levels. The gray-level allocation of oil painting images with higher generation frequency is less, and the gray-level allocation of oil painting images with lower generation frequency is more [17]. In this method, the interval between gray levels of picture target features with low generation frequency may be prolonged. Furthermore, the detail section of the oil painting picture may be enlarged, and the different image segments with a high generation frequency of gray level can merge with the target with a low generation frequency of gray level in the image histogram equalization technique.It is assumed that the function of probability density of image gray level is expressed as follows:(8)Pk=nkn.In equation (8), n represents the total number of pixels in the oil painting image, and nk denotes the frequency of pixels whose gray level is rk.The amount of idle gray levelsLk of the image assigned to the gray level is calculated as follows:(9)LkLr=1−Pk∑i=02551−Pi,Lk=1−Pk∑i=02551−Pi.Therefore, the gray level of the gray levelrk of the oil painting image occupies the number of gray levels Lk′, which is expressed as follows:(10)Lk′=1−Lk.These nonzero gray levels are nonlinear stretched and arranged within the overall gray range, and the function of image transformation is expressed as follows:(11)sk=Trk=∑i=0kLi′.The above content completes the enhancement of digital oil painting image, so that the oil painting image has higher contrast and visual effect.


## 3.3. Image Segmentation Algorithm Based on Improved Genetic Algorithm

A genetic algorithm is a sophisticated heuristic method that simulates genes [18]. The genetic algorithm, that is a search-based enhancement approach based on the evolutionary notions of natural selection and the concept of genetics, was invented by John Holland and is highly regressive and investigated in [19, 20]. It is commonly used to solve tough issues by finding optimum or near-optimal approaches. For issue resolution, the genetic algorithm replicates the survival of the fittest among individuals over a sequential generation. Each generation is made up of a population of special characters that function similarly to chromosomes. The genetic algorithm inspires one community of the chromosomal to an initial demographic through an evolutionary process. Individuals battle for resources and mates in a population. Those who are the greatest will have more children than those that are the worst. Figure 3 depicts the operation of a basic genetic algorithm.Figure 3
Flowchart of the operation of a basic genetic algorithm.The very first initial population can be created by selecting solutions to problems at random. It can also be thought of as a collection of chromosomes. Random and heuristic initializations are the two main ways of starting a population. Following that, the fitness value advises about how to fit an individual. A fitness function is a form of the objective function or parameter estimation in which GA has been used to enhance the final output by modifying the parameters of an image preprocessing segmentation algorithm. The selection step is the process of selecting the fittest people or chromosomes from a group and allowing them to pass on their genetics to the next generations. Similarly, the crossover is a genetic operator that merges the genetic information of two people or parents to continue producing children. Each pair of parents is taken for mating by the crossover operator. The intersection point is picked at random. The mutation is utilized to preserve and add genetic variety to the population while also preventing immature mixing. When a crossover is trapped in a local minima situation, mutation should enable the algorithm to circumvent it by stopping the chromosome from populating by inverting the gene. The procedure of modifying the gene codes in a chromosome is known as mutation. When a GA run ends or the merging requirement is met, the expiry condition of the genetic algorithm is calculated.In addition to improving the aforementioned oil painting picture, the optimal answer, which is the oil painting image threshold, may be found using the evolutionary algorithm. A good choice of threshold rate and variability rate is critical when utilizing genetic algorithms to compute the maximum threshold. This method significantly influences the convergence of [21]. The adaptive genetic algorithm can effectively adjust the probabilities of crossover and mutation as per the ability in the adaptive genetic algorithm. Furthermore, pc and pm are adjusted as per(12)pc=k1fmav−f′fmav−favg,k2,(13)pm=k3fmav−ffmav−favg,k4.In the above equation,fmav denotes the chief ability value in the oil painting image group, favg denotes the average fitness value of each generation group, f′ represents the larger fitness value in the individual to be crossed, f represents the individual fitness value to be mutated, and k1, k2, k3, and k4 represent the adjusted coefficient.As can be seen from equations (12) and (13), when the fitness value of the image individual is close to the highest fitness value, the probabilities of crossover and mutation are relatively small. When the fitness value of the image individual is equal to the maximum value, the crossover probability and mutation probability are close to zero. This easily leads to the evolution trend of local optimization of oil painting images [22]. Therefore, the improved genetic algorithm can be used to make the algorithm jump out of the local optimal solution and obtain the global optimal solution of the image.(14)pc=pc1⋅ef′−favg\/fmav−favgpc1,,pm=pm1⋅ef−favg\/fmav−favg,pm1.In the above equation,pc1 denotes the maximum crossover probability of the image, and pm1 represents the maximum mutation probability of the image. The improved genetic algorithm can get the optimal solution and the optimal oil painting image segmentation threshold.


## 4. Generation of Digital Oil Painting

This section discusses the history and growth of oil painting, the use of digital picture skill in the area of painting, and various ways for improving the quality of oil painting by processing it using image processing technique.


### 4.1. Enlarged Image of Oil Painting

When the oil painting picture is expanded, the image is the input and the image is the output. The generated image also satisfies all of the requirements of an oil painting image. As a result, the bigger the output image, the more care should be taken to prevent image distortion. The less distortion there is, the greater the picture amplification effect. As a result, the closest neighbor interpolation approach is used in this research to expand the picture.The function of interpolation convolution is expressed in(15)hx=1,x≺0.5,0,elsewhere.As shown in Figure4, it is assumed that i,j, i,j+1, i+1,j, i+1,j+1 are 4-point neighborhoods before image interpolation using the nearest neighbor interpolation method, and their gray values are gi,j, gi,j+1, gi+1,j, and gi+1,j+1.Figure 4
Nearest neighbor interpolation.The nearest neighbor interpolation method takes the image gray value of the point close tou,v as the gray value of the point for the distance between u,v point and i,j, i,j+1, i+1,j, and i+1,j+1. The distance between two points is expressed as Du,v,i,j, so we use equation (16) to the nearest distance between u,v point and i,j, i,j+1, i+1,j, and i+1,j+1:(16)u,v,i,j,i,j+1,i+1,j,i+1,j+1,Du,v,i,j=minDu,v,i,j,Du,v,i,j+1,Du,v,i+1,j,Du,v,i+1,j+1.After obtaining a pointi′,j′ in the image, it is closest to the i′,j′ point and u,v point, so the nearest neighbor interpolation method is obtained to obtain the gray value of the point:(17)i′,ji′,j′u,v,gu,v=gi′,j.The adjacent neighbor interpolation method is used to ensure that the edge image of the interpolated image is clear and fast operation can be carried out [23].


### 4.2. Image Color Calibration

Image-based color calibration is being used to adjust for image variations caused by lighting conditions. It is the most typical strategy used in commercial photography to keep the same color tone throughout all scenarios. In the enlarged image, the corresponding numbers are marked in the oil painting image with color, so that the corresponding places can be filled with color according to the color after the drawing is completed. Firstly, define the centroid of the color block of image, mark the position of the centroid, and mark the color and corresponding number at the position of the image centroid.If we haven particles, the masses are m1,m2,…,mn. According to the knowledge related to mechanics, the coordinates of the center of mass of the particle system are obtained by(18)x¯=MyM=∑i=1nmixi∑i=1nmi,y¯=MxM=∑i=1nmiyi∑i=1nmi.Suppose that there is a flat sheet, and the mass of the sheet is expressed in(19)M=∫∫Dμx,ydσ.The sheet occupies the closed regionD of the image plane, and the density at the point x,y is μx,y, if μx,y is continuous on the closed region D. We just need to find out the centroid coordinates of the sheet, which is the particle. Therefore, the centroid coordinates of the sheet are expressed as(20)x¯=MyM=∫∫Dxμx,ydσ∫∫Dμx,ydσ,y¯=MxM=∫∫Dyμx,ydσ∫∫Dμx,ydσ.According to the above theory, the coordinates of the centroid of the color block of the oil painting image can be obtained, and the corresponding numbers can be marked at the coordinates [24].


## 4.1. Enlarged Image of Oil Painting

When the oil painting picture is expanded, the image is the input and the image is the output. The generated image also satisfies all of the requirements of an oil painting image. As a result, the bigger the output image, the more care should be taken to prevent image distortion. The less distortion there is, the greater the picture amplification effect. As a result, the closest neighbor interpolation approach is used in this research to expand the picture.The function of interpolation convolution is expressed in(15)hx=1,x≺0.5,0,elsewhere.As shown in Figure4, it is assumed that i,j, i,j+1, i+1,j, i+1,j+1 are 4-point neighborhoods before image interpolation using the nearest neighbor interpolation method, and their gray values are gi,j, gi,j+1, gi+1,j, and gi+1,j+1.Figure 4
Nearest neighbor interpolation.The nearest neighbor interpolation method takes the image gray value of the point close tou,v as the gray value of the point for the distance between u,v point and i,j, i,j+1, i+1,j, and i+1,j+1. The distance between two points is expressed as Du,v,i,j, so we use equation (16) to the nearest distance between u,v point and i,j, i,j+1, i+1,j, and i+1,j+1:(16)u,v,i,j,i,j+1,i+1,j,i+1,j+1,Du,v,i,j=minDu,v,i,j,Du,v,i,j+1,Du,v,i+1,j,Du,v,i+1,j+1.After obtaining a pointi′,j′ in the image, it is closest to the i′,j′ point and u,v point, so the nearest neighbor interpolation method is obtained to obtain the gray value of the point:(17)i′,ji′,j′u,v,gu,v=gi′,j.The adjacent neighbor interpolation method is used to ensure that the edge image of the interpolated image is clear and fast operation can be carried out [23].


## 4.2. Image Color Calibration

Image-based color calibration is being used to adjust for image variations caused by lighting conditions. It is the most typical strategy used in commercial photography to keep the same color tone throughout all scenarios. In the enlarged image, the corresponding numbers are marked in the oil painting image with color, so that the corresponding places can be filled with color according to the color after the drawing is completed. Firstly, define the centroid of the color block of image, mark the position of the centroid, and mark the color and corresponding number at the position of the image centroid.If we haven particles, the masses are m1,m2,…,mn. According to the knowledge related to mechanics, the coordinates of the center of mass of the particle system are obtained by(18)x¯=MyM=∑i=1nmixi∑i=1nmi,y¯=MxM=∑i=1nmiyi∑i=1nmi.Suppose that there is a flat sheet, and the mass of the sheet is expressed in(19)M=∫∫Dμx,ydσ.The sheet occupies the closed regionD of the image plane, and the density at the point x,y is μx,y, if μx,y is continuous on the closed region D. We just need to find out the centroid coordinates of the sheet, which is the particle. Therefore, the centroid coordinates of the sheet are expressed as(20)x¯=MyM=∫∫Dxμx,ydσ∫∫Dμx,ydσ,y¯=MxM=∫∫Dyμx,ydσ∫∫Dμx,ydσ.According to the above theory, the coordinates of the centroid of the color block of the oil painting image can be obtained, and the corresponding numbers can be marked at the coordinates [24].


## 5. Analysis of Experimental Results

Table1 displays the experimental platform’s relevant data. This research study was carried out using hardware and software. This work employed Windows 7 as an operating system and MATLAB 2015a as a programming environment, as well as a 4-core 2.5 GHz CPU and 8 gigabytes of RAM. Visual Studio 2005, which offers visual functions and effects, is the primary development tool. These development platforms and technologies have the potential to create a reliable framework for digital oil painting.Table 1
Experimental platform parameters.
The name of theThe numericalThe operating systemWindows 7CPU4-core 2.5 GHzRAM/GB8Programming environmentMATLAB 2015aFor its experimental work, this research used two images. These are photos of local dogs, which can be seen in Figures5(a) and 5(b). These images are employed in the experimental study, which results in the desired outcome of this paper’s technique.Figure 5
Experimental photos.
(a)(b)Table2 shows the numerical comparison of image sharpness between the method in this paper and the method in reference [10]. From this table, it is clear that the clarity of the proposed method is high as compared to the other, which is 8.62 and 9.10 for Figures 5(a) and 5(b), respectively.Table 2
Comparison of clarity values.
Serial numberThe original imageLiterature [10]In this paper methodFigure 3(a)3.828.318.62Figure(b)4.297.249.10Table3 shows the comparison of the contrast value of images between the method in this paper and the method in reference [10]. From this table, it is clear that the contrast value of the proposed method is high as compared to the other, which is 1.31 and 4.49 for Figures 5(a) and 5(b), respectively.Table 3
Comparison of contrast values.
Serial numberThe original imageLiterature [10]In this paper methodsFigure (a)0.410.951.31Figure (b)0.212.124.49The comparison of Tables2 and 3 shows that the clarity and contrast of oil painting pictures produced by this approach are superior to those suggested in the literature [10]. Figure 6 shows the comparison of image information integrity between the classical Canny operator and Soble operator and image edge detection based on the improved Canny operator in this paper.Figure 6
Information integrity detected by different algorithms.Through the analysis of Figure6, it can be seen that the integrity of image information in the initial image of image edge detection based on the Soble operator is still very high, but with the increase in detection times, the information integrity decreases. Although it is also improved in the end, on the whole, the integrity of image information is not very high. The detection of image edge based on classical Canny operator is not very high in the initial image information integrity and has not been significantly improved with the continuous increase of detection times. However, the image information integrity of the image edge detection based on the improved Canny operator planned in this paper is higher than the other 2 approaches from the beginning and has been very stable with the increase of detection times. This shows that the technique planned in this paper can effectively ensure the integrity of the edge information of the oil painting image, to improve the visual effect of the oil painting image.


### 5.1. Quality Coefficient

Quality coefficientρ as an index of oil painting image enhancement detail evaluation is(21)ρ=1maxn0,nd∑i=1nd11+κdi2.In equation (21), n0 represents the edge pixel of the enhanced image, nd represents the pixel of the edge of the original image, κ∈0,1 represents the adjusted coefficient, and di represents the distance of the edge line after the enhancement of the edge of point i of the original oil painting image. The smaller P = (0, 1), the worse the effect of image enhancement. After 50 simulations, the average value is taken. Figure 7 shows the index comparison of the high-quality coefficient between the image enhancement algorithm based on histogram equalization, the image improvement algorithm based on edge sharpening, and the image improvement algorithm in this paper.Figure 7
Comparison of quality coefficients of different methods.By analyzing Figure7, it can be seen that the high-quality coefficient index of the image enhancement algorithm suggested in this paper is always better than the image enhancement algorithm based on histogram equalization and the image improvement algorithm based on edge sharpening. The average value of the high-quality coefficient index of the image improvement algorithm based on the nonlinear adaptive proposed in this paper has been stable between 0.9 and 0.95 without much fluctuation. The high-quality coefficient index of the image enhancement algorithm based on edge sharpening is not more than 0.8 at the highest and has always been at the lowest. Although the high-quality coefficient of the image improvement algorithm based on histogram equalization is relatively higher than that of the image enhancement algorithm based on edge sharpening, it is still not higher than the algorithm proposed in this paper. Therefore, the image enhancement effect of the image algorithm proposed in this paper is better.Experiments show that the proposed algorithm can effectively shorten the image segmentation time, in which the maximum threshold is 135 and the minimum threshold is 116. The threshold range has been stable within 9 pixels, but it can effectively shorten the time. Figure8 shows the comparison of the accuracy of image segmentation based on an improved genetic algorithm and image segmentation based on the genetic algorithm proposed in this paper.Figure 8
Comparison of accuracy of different image segmentations.Table4 compares the average running time of the genetic algorithm to that of the proposed enhanced genetic algorithm. This graph shows that the average running time of the genetic algorithm is 15.2/ms, whereas the suggested enhanced genetic algorithm is 10.15/ms.Table 4
Comparison of average running time of different algorithms.
The method usedAverage time of 40 segmentation processes/msGenetic algorithm15.2Improved genetic algorithm10.15From Table4 and Figure 8, it is cleared that the process time of the image segmentation based on the improved genetic algorithm suggested in this paper is significantly faster than that based on the genetic algorithm in 40 segmentation processes, and the accuracy of the image segmentation based on the improved genetic algorithm suggested in this paper is also significantly higher than that based on the genetic algorithm, which shows that the algorithm proposed in this paper can reasonably segment the image, so as to ensure the visual effect of oil painting image.Figure9 compares image sharpness between the original image, the literature [10], and our proposed method. In this case, the sharpness of the original image in figure (a) is 3.82, while that of figure (b) is 4.29. In the literature [10], the picture sharpness for the figure (a) is 8.31 and for the figure (b) is 7.24, respectively. Similarly, the image sharpness of our proposed methods for the figure (a) and figure (b) is 8.62 and 9.10, respectively. This picture shows that the image sharpness for both figures is great in our proposed method as compared to the aforementioned literature. This demonstrates the efficacy and reliability of our proposed methodology [10].Figure 9
Comparison of image sharpness between the method in this paper and the method in reference.Figure10 compares the image contrast value between the literature [10] and our proposed method. In this case, the contrast value of literature [10] for the figure (a) is 0.95 and for the figure (b) is 2.12, respectively. Similarly, the image contrast value of our proposed methods for the figure (a) and figure (b) is 1.31 and 4.49, respectively. When compared to the aforementioned literature, this shows that the picture contrast value for both figures is high in our proposed method. This proved that our method is superior to others.Figure 10
Comparison of image contrast value.


## 5.1. Quality Coefficient

Quality coefficientρ as an index of oil painting image enhancement detail evaluation is(21)ρ=1maxn0,nd∑i=1nd11+κdi2.In equation (21), n0 represents the edge pixel of the enhanced image, nd represents the pixel of the edge of the original image, κ∈0,1 represents the adjusted coefficient, and di represents the distance of the edge line after the enhancement of the edge of point i of the original oil painting image. The smaller P = (0, 1), the worse the effect of image enhancement. After 50 simulations, the average value is taken. Figure 7 shows the index comparison of the high-quality coefficient between the image enhancement algorithm based on histogram equalization, the image improvement algorithm based on edge sharpening, and the image improvement algorithm in this paper.Figure 7
Comparison of quality coefficients of different methods.By analyzing Figure7, it can be seen that the high-quality coefficient index of the image enhancement algorithm suggested in this paper is always better than the image enhancement algorithm based on histogram equalization and the image improvement algorithm based on edge sharpening. The average value of the high-quality coefficient index of the image improvement algorithm based on the nonlinear adaptive proposed in this paper has been stable between 0.9 and 0.95 without much fluctuation. The high-quality coefficient index of the image enhancement algorithm based on edge sharpening is not more than 0.8 at the highest and has always been at the lowest. Although the high-quality coefficient of the image improvement algorithm based on histogram equalization is relatively higher than that of the image enhancement algorithm based on edge sharpening, it is still not higher than the algorithm proposed in this paper. Therefore, the image enhancement effect of the image algorithm proposed in this paper is better.Experiments show that the proposed algorithm can effectively shorten the image segmentation time, in which the maximum threshold is 135 and the minimum threshold is 116. The threshold range has been stable within 9 pixels, but it can effectively shorten the time. Figure8 shows the comparison of the accuracy of image segmentation based on an improved genetic algorithm and image segmentation based on the genetic algorithm proposed in this paper.Figure 8
Comparison of accuracy of different image segmentations.Table4 compares the average running time of the genetic algorithm to that of the proposed enhanced genetic algorithm. This graph shows that the average running time of the genetic algorithm is 15.2/ms, whereas the suggested enhanced genetic algorithm is 10.15/ms.Table 4
Comparison of average running time of different algorithms.
The method usedAverage time of 40 segmentation processes/msGenetic algorithm15.2Improved genetic algorithm10.15From Table4 and Figure 8, it is cleared that the process time of the image segmentation based on the improved genetic algorithm suggested in this paper is significantly faster than that based on the genetic algorithm in 40 segmentation processes, and the accuracy of the image segmentation based on the improved genetic algorithm suggested in this paper is also significantly higher than that based on the genetic algorithm, which shows that the algorithm proposed in this paper can reasonably segment the image, so as to ensure the visual effect of oil painting image.Figure9 compares image sharpness between the original image, the literature [10], and our proposed method. In this case, the sharpness of the original image in figure (a) is 3.82, while that of figure (b) is 4.29. In the literature [10], the picture sharpness for the figure (a) is 8.31 and for the figure (b) is 7.24, respectively. Similarly, the image sharpness of our proposed methods for the figure (a) and figure (b) is 8.62 and 9.10, respectively. This picture shows that the image sharpness for both figures is great in our proposed method as compared to the aforementioned literature. This demonstrates the efficacy and reliability of our proposed methodology [10].Figure 9
Comparison of image sharpness between the method in this paper and the method in reference.Figure10 compares the image contrast value between the literature [10] and our proposed method. In this case, the contrast value of literature [10] for the figure (a) is 0.95 and for the figure (b) is 2.12, respectively. Similarly, the image contrast value of our proposed methods for the figure (a) and figure (b) is 1.31 and 4.49, respectively. When compared to the aforementioned literature, this shows that the picture contrast value for both figures is high in our proposed method. This proved that our method is superior to others.Figure 10
Comparison of image contrast value.


## 6. Conclusions

The mixture of digital image processing skills and oil painting has gradually become a creative firm with the characteristics of the new era, which makes oil painting have a new form and vitality. As a result, this study primarily provides digital oil painting research methodologies constructed on digital image processing techniques. Current period is one of the fast progresses, which has presented significant difficulties to individuals from different walks of life. If we want to continue to expand development in this period, we must innovate and reform, as well as import the era’s growth concept. Therefore, to better study digital oil painting, this work first used the image edge recognition based on the improved Canny algorithm to detect the edge of the oil painting image. After that, it used the nonlinear image enhancement algorithm to enhance the effect of the oil painting image, then used the improved genetic algorithm to segment the image, and finally enlarged the oil painting image to calibrate the color of the oil painting image. Finally, the simulation experiment proves that the technique suggested in this paper can efficiently improve the passion for oil painting creation and the visual effect of oil painting.



---

*Source: 4956839-2022-05-31.xml*