Automatic artistic image processing method and system

By automatically identifying and processing content in artistic images, using distortion eliminating transformation matrix for color and perspective correction, the problem of manual operation dependence in the existing technology is solved, efficiency and accuracy are improved, and a large number of art works suitable for art education institutions Handle requirements.

CN119067898AInactive Publication Date: 2024-12-03ARTRON ART GRP CO LTD +2
View PDF 12 Cites 0 Cited by

Patent Information

Application Number
CN202411003710.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-25
Publication Date
2024-12-03
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

When processing artistic images, the color correction and tailoring process relies on manual operations, which is inefficient and expensive. Especially under the demand for archiving and displaying a large number of art works in art education institutions and colleges, there is huge investment in manpower and material resources.

Method used

Using an automatic art image processing method and system, the art works and distortion correction reference units are automatically recognized through the image recognition module, the color channel feature values ​​are calculated, the imaging color channel value array is formed, and the distortion elimination transformation matrix is ​​used for automatic color correction and perspective. Correction, generates corrected artwork images.

Benefits of technology

It greatly saves manpower, improves the accuracy and consistency of color correction, significantly improves processing efficiency, and avoids the tedious process of manual pixel-by-pixel adjustment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119067898A_ABST
    Figure CN119067898A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an art image automatic processing method and system, and the method employs an image recognition module to automatically recognize the content, including art work imaging and distortion correction reference unit imaging, in a to-be-processed image, does not need manual intervention, and greatly saves the manpower. Besides, through automatic positioning and processing of distortion correction reference subunit imaging, the system can autonomously calculate color channel characteristic values and form an imaging color channel value array, and the requirement of manual operation is further reduced. Furthermore, the system can automatically determine a distortion elimination transformation matrix by aligning the imaging color channel value array to a standard color channel value array. In the process, manual color comparison and adjustment are not needed, and the accuracy and consistency of color correction are improved. The distortion elimination transformation matrix is used for automatically correcting the artistic work image, the tedious process of manually adjusting the color pixel by pixel is avoided, and the processing efficiency is remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to an automatic processing method and system for artistic images. Background Art

[0002] Artworks are usually converted into digital image files through camera or mobile phone shooting to meet multiple needs such as archiving, network dissemination, and publishing. When processing these captured image files, key tasks include color correction, perspective correction, and cropping to ensure that the image color can truly restore the work itself. However, due to various factors such as lighting environment, shooting equipment, and shooting techniques, the image files actually shot often deviate from the original color of the work.

[0003] To solve this problem, professional photographers use standard color cards as references when shooting, and assist in color judgment by observing the color deviation of the color cards. Currently, the color correction and cropping of image files are mainly done manually using Photoshop software, and this process is highly dependent on the skills and experience of the operator.

[0004] Especially for art education institutions and colleges, a large number of students' art works need to be archived, displayed and published in collections, which requires a lot of manpower and material resources for color correction, which is not only inefficient but also costly. Summary of the invention

[0005] The embodiments of the present application provide a method and system for automatically processing artistic images, so as to overcome or alleviate the above-mentioned technical problems existing in the prior art.

[0006] An automatic processing method for artistic images, comprising:

[0007] Based on the configured image input module, read the image to be processed;

[0008] Based on the configured image recognition module, at least one of the following steps is performed to determine a distortion elimination transformation matrix:

[0009] Recognizing the image to be processed to obtain an image recognition result;

[0010] According to the image recognition result, determining whether the image to be processed includes an artwork imaging and a distortion correction reference unit imaging;

[0011] In response to the image to be processed including an artwork imaging and a distortion correction reference unit imaging, taking the artwork imaging as an object to be corrected, and determining all distortion correction reference sub-unit imaging included in the distortion correction reference imaging;

[0012] Determine the center coordinates of each distortion correction reference subunit imaging, and select a number of target pixels from the corresponding distortion correction reference subunit imaging based on the center coordinates;

[0013] For each distortion correction reference subunit imaging, an imaging color channel value of each target pixel thereon is obtained, and based on the imaging color channel values ​​corresponding to the plurality of target pixels, a color channel characteristic value of the imaging of each distortion correction reference subunit is calculated to form an imaging color channel value vector;

[0014] Serializing the imaging color channel value vectors of all distortion correction reference sub-unit imaging to form an imaging color channel value array of distortion correction reference unit imaging;

[0015] Obtaining an array of standard color channel values ​​of the distortion correction reference unit imaging;

[0016] Registering the imaging color channel value array to the standard color channel value array to determine a distortion elimination transformation matrix;

[0017] Based on the set image correction module, the color channel values ​​of all pixels on the object to be corrected are obtained, and the color channel value of each pixel on the object to be corrected is corrected based on the distortion elimination transformation matrix to obtain the corrected color channel values ​​of all pixels on the object to be corrected;

[0018] An artwork contour recognition module, used to call a built-in contour search model, determine the contour of the object to be corrected to extract contour feature points therefrom, and create a blank image with the same size as the object to be corrected based on the contour feature points;

[0019] The image perspective module is used to project the corrected color channel values ​​of each pixel on the object to be corrected onto the blank image in a manner aligned with the pixel positions on the object to be corrected, so as to generate a new artwork image as a corrected artwork image.

[0020] An automatic processing method for artistic images, comprising:

[0021] Read the image to be processed;

[0022] Recognizing the image to be processed to obtain an image recognition result;

[0023] According to the image recognition result, determining whether the image to be processed includes an artwork imaging and a distortion correction reference unit imaging;

[0024] In response to the image to be processed including an artwork imaging and a distortion correction reference unit imaging, taking the artwork imaging as an object to be corrected, and determining all distortion correction reference sub-unit imaging included in the distortion correction reference imaging;

[0025] Determining a distortion elimination transformation matrix according to the color channel eigenvalues ​​of all the distortion correction reference subunit imaging;

[0026] The object to be corrected is corrected according to the distortion elimination transformation matrix to obtain a corrected artwork image.

[0027] An automatic art image processing system, comprising:

[0028] An image input module, used for reading the image to be processed;

[0029] The image recognition module is used to recognize the image to be processed to obtain an image recognition result, and determine whether the image to be processed includes an artwork imaging and a distortion correction reference unit imaging according to the image recognition result; in response to the image to be processed including the artwork imaging and the distortion correction reference unit imaging, take the artwork imaging as an object to be corrected, and determine all distortion correction reference sub-unit imaging included in the distortion correction reference imaging, so as to determine a distortion elimination transformation matrix according to color channel eigenvalues ​​of all the distortion correction reference sub-unit imaging, so as to correct the object to be corrected according to the distortion elimination transformation matrix to obtain a corrected artwork image.

[0030] An electronic device comprises a memory and a processor, wherein the memory is used to store a computer executable program, and the processor is used to run the computer executable program to implement any method described in the embodiments of the present application.

[0031] In the solution provided by the embodiment of the present application, an image recognition module is used to automatically identify the content in the image to be processed, including the imaging of the artwork and the imaging of the distortion correction reference unit, without the need for manual intervention, which greatly saves manpower. In addition, by automatically positioning and processing the imaging of the distortion correction reference subunit, the system can autonomously calculate the color channel eigenvalues ​​and form an imaging color channel value array, further reducing the need for manual operation. Furthermore, by aligning the imaging color channel value array to the standard color channel value array, the system can automatically determine the distortion elimination transformation matrix. This process does not require manual color comparison and adjustment, which improves the accuracy and consistency of color correction. The use of the distortion elimination transformation matrix to automatically correct the artwork image avoids the tedious process of manually adjusting the color pixel by pixel, significantly improving the processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1A schematic diagram of a flow chart of an automatic processing method for artistic images according to an embodiment of the present application.

[0033] Figure 2 Schematic diagram of the process for determining the distortion elimination transformation matrix.

[0034] Figure 3 This is a schematic diagram of the structure of an automatic art image processing system according to an embodiment of the present application.

[0035] Figure 4 A schematic diagram of a scenario in which a user uses an application program to automatically process an artistic image according to an embodiment of the present application;

[0036] Figure 5 This is a specific application example of the embodiment of the present application. DETAILED DESCRIPTION

[0037] In order to make the technical problems, technical solutions and advantages to be solved by the present application clearer, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.

[0038] Figure 1 A schematic diagram of a flow chart of an automatic processing method for artistic images according to an embodiment of the present application. Figure 2 This is a flow chart of determining the distortion elimination transformation matrix. Figure 1 , 2 As shown, it includes:

[0039] Based on the configured image input module, read the image to be processed;

[0040] Based on the configured image recognition module, perform at least one of the following steps (see Figure 2 As shown), to determine the distortion elimination transformation matrix:

[0041] Recognizing the image to be processed to obtain an image recognition result;

[0042] According to the image recognition result, determining whether the image to be processed includes an artwork imaging and a distortion correction reference unit imaging;

[0043] In response to the image to be processed including an artwork imaging and a distortion correction reference unit imaging, taking the artwork imaging as an object to be corrected, and determining all distortion correction reference sub-unit imaging included in the distortion correction reference imaging;

[0044] Determine the center coordinates of each distortion correction reference subunit imaging, and select a number of target pixels from the corresponding distortion correction reference subunit imaging based on the center coordinates;

[0045] For each distortion correction reference subunit imaging, an imaging color channel value of each target pixel thereon is obtained, and based on the imaging color channel values ​​corresponding to the plurality of target pixels, a color channel characteristic value of the imaging of each distortion correction reference subunit is calculated to form an imaging color channel value vector;

[0046] Serializing the imaging color channel value vectors of all distortion correction reference sub-unit imaging to form an imaging color channel value array of distortion correction reference unit imaging;

[0047] Obtaining an array of standard color channel values ​​of the distortion correction reference unit imaging;

[0048] Registering the imaging color channel value array to the standard color channel value array to determine a distortion elimination transformation matrix;

[0049] Based on the set image correction module, the color channel values ​​of all pixels on the object to be corrected are obtained, and the color channel value of each pixel on the object to be corrected is corrected based on the distortion elimination transformation matrix to obtain the corrected color channel values ​​of all pixels on the object to be corrected;

[0050] Based on the set artwork contour recognition module, calling the built-in contour search model, determining the contour of the object to be corrected to extract contour feature points therefrom, and establishing a blank image with the same size as the object to be corrected based on the contour feature points;

[0051] Based on the set image perspective module, the corrected color channel value of each pixel on the object to be corrected is projected onto the blank image in a manner aligned with the pixel position on the object to be corrected, so as to generate a new artwork image as the corrected artwork image.

[0052] In the solution provided by the embodiment of the present application, an image recognition module is used to automatically identify the content in the image to be processed, including the imaging of the artwork and the imaging of the distortion correction reference unit, without the need for manual intervention, which greatly saves manpower. In addition, by automatically positioning and processing the imaging of the distortion correction reference subunit, the system can autonomously calculate the color channel eigenvalues ​​and form an imaging color channel value array, further reducing the need for manual operation. Furthermore, by aligning the imaging color channel value array to the standard color channel value array, the system can automatically determine the distortion elimination transformation matrix. This process does not require manual color comparison and adjustment, which improves the accuracy and consistency of color correction. The use of the distortion elimination transformation matrix to automatically correct the artwork image avoids the tedious process of manually adjusting the color pixel by pixel, significantly improving the processing efficiency.

[0053] Optionally, the configuration-based image input module reads the image to be processed including:

[0054] The configured image input module accesses the configuration management interface to obtain image reading configuration parameters;

[0055] The configured image input module accesses the image reading library to parse the image reading configuration parameters to obtain a parsing result, so as to read the image to be processed according to the parsing result.

[0056] The following is a sample code showing how to read the image to be processed based on the configured image input module:

[0057]

[0058]

[0059] In this example, the ConfigBasedImageInputModule class is responsible for loading the configuration file and reading the image to be processed. It first loads the configuration file through the load_configuration method and parses the configuration parameters required for image reading (in this case, the path to the image). Then, the read_image method uses these configuration parameters to read the image to be processed and returns the image object. If an error occurs during the reading process, it prints an error message and returns None. Finally, in the usage example, a ConfigBasedImageInputModule instance is created, the configuration file is loaded, and the image to be processed is read and displayed.

[0060] Optionally, after the configuration-based image input module reads the image to be processed, the configuration-based image input module further comprises: performing the following steps:

[0061] Preprocessing the read image to be processed to obtain an enhanced image;

[0062] Performing image quality assessment on the enhanced image based on a set image quality assessment model to determine whether the enhanced image meets a set quality assessment standard;

[0063] If the condition is satisfied, the enhanced image satisfying the set quality assessment standard is input into the image recognition module so that when the image to be processed is recognized to obtain the image recognition result, the enhanced image satisfying the set quality assessment standard is recognized to obtain the image recognition result, and the preprocessing at least includes: at least one of denoising, cropping, scaling, and rotation;

[0064] Otherwise, the process jumps to continuing preprocessing the image to be processed to obtain an enhanced image, until the enhanced image that meets the set quality evaluation standard is obtained.

[0065] The following is an example code that shows how the configured image input module performs preprocessing and quality assessment after reading the image to be processed, and decides whether to perform subsequent recognition based on the assessment results:

[0066]

[0067]

[0068] In this example, the ConfigBasedImageInputModule class is responsible for loading, preprocessing, and evaluating image quality, and decides whether to perform subsequent recognition based on the evaluation results. The load_image method loads the image to be processed, the preprocess_image method preprocesses the image, the assess_image_quality method uses the image quality assessment model to assess the image quality, and the process_image method is responsible for the entire processing flow. In actual applications, it is necessary to implement the image recognition module and image quality assessment model according to specific needs.

[0069] Optionally, if the preprocessing includes denoising, the preprocessing of the read image to be processed to obtain an enhanced image includes:

[0070] Traversing all pixels in the image to be processed, and taking each element traversed each time as a denoising object;

[0071] Based on a set fixed window, a neighborhood range is defined with the denoising object as the center;

[0072] For each neighborhood pixel point within the neighborhood range, calculating the neighborhood interval and color difference between the neighborhood pixel point and the denoising object;

[0073] Calculating a first attenuation factor based on the neighborhood interval between each neighborhood pixel and the denoising object, and calculating a second attenuation factor based on the color difference, so as to calculate a denoising weight corresponding to each neighborhood pixel based on the first attenuation factor and the second attenuation factor;

[0074] According to the denoising weights corresponding to all the neighborhood pixels, the original pixel values ​​of the denoised object are denoised to obtain new pixel values ​​of the denoised object.

[0075] The following is an example code that shows how to preprocess the read image to be processed to obtain an enhanced image if the preprocessing includes denoising:

[0076]

[0077]

[0078] In this example, the denoise_image function is responsible for denoising the image. It traverses all pixels in the image, defines the neighborhood range of each pixel based on the set fixed window, calculates the denoising weight of each neighboring pixel in the neighborhood range, and finally denoises the original pixel value according to these weights to obtain the new pixel value.

[0079] Optionally, based on the following formula (1), a first attenuation factor is calculated based on the neighborhood interval between each neighborhood pixel and the denoising object, and a second attenuation factor is calculated based on the color difference, so as to calculate the denoising weight B(x, y) corresponding to each neighborhood pixel based on the first attenuation factor and the second attenuation factor:

[0080]

[0081] Among them, ||xy|| represents the neighborhood interval between each neighborhood pixel y and the denoising object x, σ s is the neighborhood interval domain standard deviation, σ r is the standard deviation of the color difference domain, σ r The larger the value, the more pixels with larger color differences will contribute to the value of the denoised object, while σ r The smaller the value, the more pixels with smaller color differences contribute to the value of the denoised object. s The larger the value, the more pixels with larger neighborhood intervals will contribute to the value of the denoised object, while σ s The smaller the value, the more pixels with smaller neighborhood intervals contribute to the value of the denoised object. represents the first attenuation factor, represents the second attenuation factor.

[0082] To this end, in the above scheme, two attenuation factors are obtained, and then the above steps are implemented based on the two attenuation factors, which has the following technical benefits:

[0083] (1) The spatial distance and intensity difference between pixels are taken into account when calculating the weights, which preserves the edge information while smoothing the image and avoids blurring near the edges.

[0084] (2) Due to the effect of the second attenuation factor, neighborhood pixels with similar intensities to the central pixel will receive higher weights, which helps to enhance the detailed features of the image.

[0085] (3) Since the first attenuation factor reduces the influence of pixels farther from the central pixel on the central pixel, this helps to suppress random noise in the image.

[0086] (4) By adjusting σ s and σ rThe value of can adapt to features of different scales, which is helpful for processing artistic images with multi-scale features. At the same time, it does not destroy the features of artistic images and plays a role in smoothing and enhancing the image.

[0087] Optionally, based on the following formula (2), according to the denoising weights corresponding to all neighborhood pixels, the original pixel value of the denoised object is denoised to obtain a new pixel value I′(x) of the denoised object:

[0088]

[0089] Therefore, the above denoising based on formula (2) has the following technical benefits:

[0090] (1) The intensity difference between pixels is taken into account when calculating the weights, which gives higher weights to pixels near the edge, thereby maintaining the clarity of the edge while denoising.

[0091] (2) Pixels in texture areas usually have similar intensity values, which makes them obtain higher cumulative weights in the denoising process, thereby preserving the texture information in the image.

[0092] (3) Based on the above denoising process, Gaussian attenuation in the spatial domain is implemented, and the noise points far away from the central pixel obtain lower weights, thereby effectively suppressing the noise.

[0093] (4) Each color channel can be processed independently to maintain color consistency and natural transition.

[0094] (5) The weight calculation is adaptive, automatically adjusting the influence of each pixel in the neighborhood according to the image content, which makes the denoising process more flexible and adaptable.

[0095] (6) It is highly robust to lighting changes, shadows, and nonlinear changes in images, and can work stably under complex lighting conditions.

[0096] (7) The processed image is visually smoother and more natural, avoiding the artifacts that may be caused by traditional filters, such as blockiness or ringing effects.

[0097] (8) By adjusting parameters, it is possible to process both large-scale and small-scale features in the image at the same time, which is suitable for images containing rich details and areas.

[0098] Optionally, the configuration-based image recognition module recognizes the image to be processed to obtain an image recognition result, including:

[0099] Based on the configured image recognition module, color feature extraction, texture feature extraction and shape feature extraction are performed on the image to be processed, so as to identify the image to be processed according to the extracted color features, texture features and shape features to obtain an image recognition result.

[0100] Optionally, the configuration-based image recognition module recognizes the image to be processed according to the extracted color features, texture features, and shape features to obtain an image recognition result, comprising the following steps:

[0101] Perform multi-head attention analysis on the extracted color features, texture features, and shape features to obtain multi-head attention weights;

[0102] The color features, texture features, and shape features are fused according to the multi-head attention weights to obtain semantic fusion features;

[0103] The semantic fusion feature is input into the trained regressor to predict the image content, so as to identify the image to be processed according to the predicted image content to obtain an image recognition result.

[0104] To this end, a multi-head attention mechanism is used to optimize the image recognition process, which has the following technical benefits:

[0105] (1) By performing multi-head attention analysis on multiple features such as color, texture, and shape, the model can dynamically adjust the degree of attention paid to different features and achieve effective feature fusion. This mechanism enables the model to focus more on key features when processing images with rich or complex visual information, thereby improving recognition performance.

[0106] (2) Using the multi-head attention mechanism to perform weighted fusion of features can generate more representative semantic fusion features, which is particularly important for distinguishing objects with subtle differences or in complex scenes, and helps to improve the accuracy of image recognition.

[0107] (3) Through the multi-head attention mechanism, the model learns how to adaptively adjust the importance of features according to the context, which helps the model make reasonable predictions when faced with unseen images or scenes, thereby enhancing the model’s generalization ability.

[0108] The following is an example code showing how to apply the multi-head attention mechanism for image feature fusion and recognition:

[0109]

[0110]

[0111] Optionally, the configuration-based image recognition module determines, according to the image recognition result, whether the image to be processed includes an artwork imaging and a distortion correction reference unit imaging, including:

[0112] The image recognition result is subjected to image segmentation based on the configured image recognition module to obtain a segmentation result, and it is determined whether the image to be processed includes an artwork imaging and a distortion correction reference unit imaging according to the segmentation result.

[0113] Optionally, the configuration-based image recognition module performs image segmentation on the image recognition result to obtain a segmentation result, including:

[0114] Performing regional feature analysis on the image recognition result based on the configured image recognition module to obtain regional key features;

[0115] Cluster analysis is performed on the key features of the region to obtain a number of cluster regions, and each of the cluster regions is used as a seed region for region growing, so as to perform image segmentation on the image recognition result to obtain a segmentation result.

[0116] Optionally, judging whether the image to be processed includes artwork imaging and distortion correction reference unit imaging according to the segmentation result includes:

[0117] Matching the segmentation result with a distortion correction reference unit model library to determine whether the image to be processed includes distortion correction reference unit imaging;

[0118] If included, based on the position area occupied by the distortion correction reference unit imaging on the image to be processed as the outer boundary, a target area for style transfer is laid out on the image to be processed, and the image content of the style transfer is fused with the configured artistic image style input to determine whether the image to be processed includes an artwork imaging.

[0119] To this end, the above-mentioned sophisticated image segmentation and matching technology achieves efficient analysis and recognition of complex image content, especially for complex scenes including artwork imaging and distortion correction reference unit imaging, with the following technical benefits:

[0120] (1) By performing regional feature analysis and clustering on the image recognition results, this method can more accurately segment different regions in the image, thereby more effectively identifying the artwork imaging and the distortion correction reference unit imaging. This refined segmentation method helps reduce misidentification and improves overall recognition accuracy.

[0121] (2) This method determines whether the image to be processed contains distortion correction reference unit imaging by matching the distortion correction reference unit model library. This step enhances the model's adaptability to different image scenes. Even when faced with images containing complex backgrounds or noise, the model can perform recognition more robustly.

[0122] (3) After determining the image containing the artwork, the method arranges the target area for style transfer based on the location area of ​​the distortion-corrected reference unit image, and integrates the image content with the artistic style. This approach not only improves the naturalness and accuracy of style transfer, but also makes the style transfer process more efficient because it only operates on specific areas in the image.

[0123] The following is an example code that shows how to segment an image and determine whether it contains specific imaging elements:

[0124]

[0125]

[0126] Optionally, the fusing the style-transferred image content with a configured artistic image style input to determine whether the image to be processed includes an artwork image includes:

[0127] Fusion of the style-transferred image content with a configured artistic image style input to obtain a style-fused image;

[0128] The style fusion image is subjected to inverse style migration to obtain a restored image, and based on the similarity between the restored image and the style migrated image content, if the similarity is greater than a set similarity threshold, it is determined that the image to be processed includes an artwork imaging, otherwise it is determined that it does not include.

[0129] To this end, through the process of style transfer and inverse style transfer, efficient recognition and verification of artwork imaging is achieved, which has the following technical benefits:

[0130] (1) It not only relies on image segmentation and feature matching to identify the image of the artwork, but also further verifies it through the process of style transfer and inverse style transfer. This dual verification mechanism helps reduce misidentification and improves overall recognition accuracy.

[0131] (2) Through style transfer and inverse style transfer, this method can more robustly identify artwork images in different image styles and backgrounds. It can also effectively identify images containing complex noise or deformation.

[0132] (3) This method allows users to configure different artistic image style inputs, thereby enabling the recognition of artworks of different styles. This flexibility makes this method applicable to a wider range of scenarios and applications.

[0133] The following is an example code showing how to perform style transfer, inverse style transfer, and similarity calculation:

[0134]

[0135] Optionally, in response to the image to be processed including an artwork imaging and a distortion correction reference unit imaging, the configuration-based image recognition module takes the artwork imaging as an object to be corrected, and determines all distortion correction reference sub-unit imaging included in the distortion correction reference imaging, including:

[0136] Based on the configured image recognition module, in response to the image to be processed including an image of an artwork and an image of a distortion correction reference unit, the image of the artwork is annotated to take the image of the artwork as an object to be corrected;

[0137] Processing the distortion correction reference imaging grayscale to obtain a grayscale image based on the configured image recognition module, and calculating a grayscale histogram of the grayscale image to determine the boundary between the distortion correction reference subunit imaging based on the grayscale histogram;

[0138] The distortion-corrected reference imaging is segmented based on boundaries between the distortion-corrected reference sub-unit imagings to determine all distortion-corrected reference sub-unit imagings.

[0139] To this end, through the above series of refined image processing steps, the processing of the artwork imaging is achieved, which has the following technical benefits:

[0140] (1) First, the artwork images in the processed image are marked as the object to be corrected. This step ensures the pertinence of the subsequent correction operation and avoids interference from irrelevant areas. By performing grayscale processing and histogram analysis on the distortion correction reference image, the boundaries between the distortion correction reference sub-unit images can be accurately determined, thereby accurately correcting the distortion.

[0141] (2) By preprocessing the image, such as grayscale processing and histogram analysis, the scheme can quickly locate the key area for distortion correction, avoiding unnecessary calculations on the entire image. This localized processing method significantly improves processing efficiency and enables the correction operation to be completed more quickly.

[0142] (3) The scheme is able to process images with complex backgrounds and noise. Even when faced with images with different degrees of distortion, the grayscale histogram analysis can accurately determine the boundaries between the distortion correction reference sub-unit imaging and perform effective correction. This strong robustness makes the scheme applicable to a wider range of image correction scenarios.

[0143] The following is an example code showing how to annotate the artwork image and perform grayscale processing and histogram analysis on the distortion-corrected reference image:

[0144] importnumpyasnp

[0145] fromPILimportImage

[0146] fromsome_image_processing_libraryimportgray_scale_conversion,histogram_calculation,image_segmentation

[0147] #original_image is the image to be processed, which contains the image of the artwork and the image of the distortion-corrected reference unit.

[0148] original_image=Image.open('path_to_original_image.jpg')

[0149] # Annotate the artwork images

[0150] #annotation_mask is an annotation mask of the same size as original_image, where the imaged areas of the artwork are annotated with 1

[0151] annotation_mask=np.array([[0,0,1,1],[0,0,1,1],[0,0,0,0],[0,0,0,0]])

[0152] # Grayscale processing of distortion correction reference imaging

[0153] gray_image=gray_scale_conversion(original_image)

[0154] #Calculate the grayscale histogram of the grayscale image

[0155] histogram=histogram_calculation(gray_image)

[0156] #Determine the boundary between the distortion correction reference subunit imaging based on the grayscale histogram

[0157] #boundaries is a list containing the distortion-corrected reference subunit imaging boundaries

[0158] boundaries = [(10,20),(30,40)] # boundary coordinates

[0159] #Segment the distortion correction reference image based on the boundary to determine all the distortion correction reference sub-unit imaging

[0160] segmented_images=image_segmentation(gray_image,boundaries)

[0161] Optionally, the configuration-based image recognition module determines the center coordinates of each distortion correction reference subunit imaging, and selects a number of target pixels from the corresponding distortion correction reference subunit imaging based on the center coordinates, including:

[0162] Determine the vertex coordinates of the region where each distortion correction reference subunit is imaged based on the configured image recognition module;

[0163] Based on the vertex coordinates, calculating the center coordinates of each distortion correction reference subunit imaging;

[0164] A neighborhood feature representation is obtained, and based on the center coordinates, the neighborhood feature representation is used as a constraint to perform local binary calculation on each pixel on the corresponding distortion correction reference subunit imaging to screen out a number of significant feature pixels as a number of target pixels.

[0165] To this end, by accurately calculating the center coordinates of the distortion correction reference subunit imaging and screening out pixels with significant features based on these coordinates, a solid foundation is provided for subsequent image correction and enhancement processing, which has the following technical benefits:

[0166] (1) By determining the center coordinates of each distortion correction reference subunit imaging, the scheme can more accurately locate the key area that needs correction. This precise positioning capability is crucial for subsequent correction algorithms because it ensures that the correction operation can be performed on the correct area, thereby improving the overall correction accuracy.

[0167] (2) By selecting pixels with significant features as target pixels, the amount of data in subsequent processing is reduced. This data dimension reduction strategy not only reduces the computational complexity, but also speeds up the processing speed, making the entire image correction process more efficient.

[0168] (3) By considering the neighborhood feature representation as a constraint, the scheme is more robust in screening target pixels. Even when faced with images containing complex noise or deformation, the scheme can accurately identify pixels with significant features, thereby enhancing the robustness of the entire correction process.

[0169] The following is an example code showing how to determine the center coordinates of the distortion-corrected reference subunit image and filter out target pixels based on these coordinates:

[0170] importnumpyasnp

[0171] fromPILimportImage

[0172] fromsome_image_processing_libraryimportfind_vertex_coordinates,calculate_center_coordinates,local_binary_computation

[0173] #segmented_image is the segmentation result of a distortion-corrected reference subunit imaging

[0174] segmented_image=Image.open('path_to_segmented_image.jpg')

[0175] #Determine the vertex coordinates of the area where the distortion correction reference subunit is imaged

[0176] vertex_coordinates=find_vertex_coordinates(segmented_image)

[0177] # Calculate the center coordinates of the distortion correction reference subunit imaging

[0178] center_coordinates=calculate_center_coordinates(vertex_coordinates)

[0179] #Get neighborhood feature description

[0180] #neighborhood_features is a feature map of the same size as segmented_image

[0181] neighborhood_features=np.random.rand(*segmented_image.size)

[0182] #Based on the center coordinates and neighborhood feature representation, perform local binary calculation on each pixel on the corresponding distortion correction reference subunit imaging

[0183] #To select several significant feature pixels as several target pixels

[0184] target_pixels=local_binary_computation(segmented_image,center_coordinates,neighborhood_features)

[0185] Optionally, the configuration-based image recognition module obtains the imaging color channel value of each target pixel on each distortion correction reference subunit imaging, and calculates the color channel feature value of each distortion correction reference subunit imaging based on the imaging color channel values ​​corresponding to the plurality of target pixels to form an imaging color channel value vector, including:

[0186] Based on the configured image recognition module, imaging is performed for each distortion correction reference subunit to obtain the imaging red channel value, imaging green channel value, and imaging red channel value of each target pixel thereon;

[0187] The color histogram, color moment, and color correlation of each distortion correction reference subunit imaging are calculated based on the imaging red channel value, imaging green channel value, and imaging red channel value of each target pixel to form an imaging color channel value vector, the color channel characteristic value color histogram, color moment, and color correlation.

[0188] To this end, by imaging each distortion correction reference subunit, obtaining the imaging color channel value of each target pixel thereon, and calculating the color channel characteristic value to form an imaging color channel value vector, there are the following technical benefits:

[0189] (1) By obtaining the red, green, and blue channel values ​​of each target pixel, the scheme can fully capture the color information in the image. This is crucial for subsequent image analysis, processing, and correction, because color information is often an important part of the image content.

[0190] (2) By calculating the color histogram, color moment, and color correlation, the scheme can accurately extract the color features of each distortion correction reference subunit imaging. These feature values ​​not only reflect the distribution of colors, but also reveal the correlation and difference between colors, providing a strong basis for subsequent color correction and enhancement.

[0191] (3) Based on accurate color feature extraction, the scheme can more accurately locate the color area that needs to be corrected and perform color correction in a targeted manner. This precise correction strategy not only improves the correction effect, but also reduces unnecessary color distortion and artifacts.

[0192] (4) By comprehensively considering multiple color features such as color histogram, color moment, and color correlation, the scheme shows stronger robustness when facing complex and changing image colors. Even if there are interference factors such as lighting changes, shadows, and noise in the image, the scheme can accurately extract stable color features.

[0193] (5) By forming an imaging color channel value vector, the scheme represents the color feature in the form of a vector, which is convenient for subsequent storage, transmission and processing. This vectorized processing method not only simplifies the data structure, but also improves the processing efficiency.

[0194] The following is an example code showing how to obtain the imaging color channel value of each target pixel and calculate the color channel feature value to form an imaging color channel value vector:

[0195] importnumpyasnp

[0196] fromPILimportImage

[0197] fromsome_image_processing_libraryimportcalculate_color_histogram,calculate_color_moments,calculate_color_correlation

[0198] #target_pixels is a list of several target pixels, each of which is a tuple containing red, green, and blue channel values

[0199] target_pixels=[(255,0,0),(0,255,0),(0,0,255)]

[0200] # Initialize the color channel feature value dictionary

[0201] color_channel_features={}

[0202] # Calculate the color histogram

[0203] color_histogram=calculate_color_histogram(target_pixels)

[0204] color_channel_features['color_histogram']=color_histogram

[0205] # Calculate color moment

[0206] color_moments=calculate_color_moments(target_pixels)

[0207] color_channel_features['color_moments']=color_moments

[0208] # Calculate color correlation

[0209] color_correlation=calculate_color_correlation(target_pixels)

[0210] color_channel_features['color_correlation']=color_correlation

[0211] #Forming an imaging color channel value vector

[0212] imaging_color_channel_vector=np.concatenate([color_histogram,color_moments,color_correlation])

[0213] Optionally, the color histogram, color moment, and color correlation of each distortion correction reference subunit imaging are calculated based on the imaging red channel value, imaging green channel value, and imaging red channel value of each target pixel to form an imaging color channel value vector, and the color channel characteristic value color histogram, color moment, and color correlation include:

[0214] According to the formula Calculate the color histogram of each distortion-corrected reference subunit imaging, H c(k) is the value of color channel c in the kth histogram bucket, n is the number of target pixels, and δ is the indicator function. i If it falls in the kth bucket, it takes 1, otherwise it takes 0;

[0215] According to the formula Calculate the color moment of each distortion-corrected reference subunit imaging, where μ c is the mean of color channel c, is the variance of color channel c, N is the total number of pixels in that color channel, is the color moment;

[0216] The color histogram, color moment, and color correlation of each distortion correction reference subunit imaging are calculated according to the following formula:

[0217]

[0218] Among them, Cov(R, G) represents the color correlation between the red and green channels, Cov(G, B) represents the color correlation between the green and blue channels, and Cov(R, B) represents the color correlation between the red and blue channels. i and G i are the red and green channel values ​​of the i-th pixel, μ R and μ G are the sample means of the red and green channel values, respectively, N is the total number of pixels in the image, and B i is the blue channel value of the ith pixel, μ B is the sample mean of the blue channel values.

[0219] To this end, the above formula is used to implement the process of calculating the color histogram, color moment, and color correlation based on the imaging color channel value of each target pixel to form an imaging color channel value vector, which has the following technical benefits:

[0220] (1) Color histogram, color moment and color correlation provide a comprehensive description of the color distribution of an image. The color histogram describes the distribution of colors, the color moment provides the shape and location information of the color distribution, and the color correlation describes the relationship between different color channels.

[0221] (2) These features are robust to illumination changes and noise. The color histogram is not affected by illumination intensity, while the color moment and color correlation resist noise interference to a certain extent.

[0222] (3) These methods are adaptable to different image contents and styles because they are based on statistics and can capture the overall characteristics of the image rather than relying on specific image textures or details.

[0223] (4) Color histograms and color moments can analyze images at different scales, which enables them to capture multi-scale information from local details to overall features.

[0224] The following is an example code to illustrate how to calculate the color histogram, color moment, and color correlation of an image based on the above algorithm logic and combine these features into a feature vector:

[0225]

[0226]

[0227] Optionally, the configuration-based image recognition module serializes the imaging color channel value vectors of all distortion correction reference sub-unit imaging to form an imaging color channel value array of distortion correction reference unit imaging, including:

[0228] The imaging color channel value vectors of all distortion correction reference subunit imaging are converted into a continuous digital array, and all digital arrays are connected in the order of distortion correction reference subunit imaging to form an imaging color channel value array of distortion correction reference unit imaging.

[0229] To this end, by serializing the imaging color channel value vectors of all distortion correction reference sub-unit imaging to form an imaging color channel value array of the distortion correction reference unit imaging, a convenient data structure is provided for subsequent image processing and analysis, which has the following technical benefits:

[0230] (1) Through serialization, the scheme converts the color channel value vectors of all distortion correction reference sub-unit imaging into a continuous digital array, forming a unified data structure. This data structure not only simplifies the complexity of subsequent processing, but also improves the efficiency of data processing.

[0231] (2) The serialized imaging color channel value array can be stored and transmitted as a whole, without considering the specific structure and size of the color channel value vector of the single distortion correction reference subunit imaging. This greatly reduces the complexity of data storage and transmission and improves data portability.

[0232] (3) After the imaging color channel value array of the distortion correction reference unit imaging is formed, the subsequent image processing and analysis algorithms can operate on the entire array more conveniently without the need for tedious data extraction and conversion for a single distortion correction reference sub-unit imaging.

[0233] (4) Since the serialized data structure is more compact and unified, the subsequent image processing algorithm can utilize computing resources more efficiently when processing the entire array, thereby improving processing efficiency.

[0234] (5) This scheme provides an extensible foundation for subsequent image processing and analysis. When it is necessary to add a new distortion correction reference subunit imaging or modify the existing imaging color channel value vector, it is only necessary to simply update the serialized array without making large-scale modifications to the entire image processing pipeline.

[0235] The following is an example code showing how to serialize the imaging color channel value vectors of all distortion-corrected reference subunit imaging to form an imaging color channel value array of distortion-corrected reference unit imaging:

[0236]

[0237]

[0238] Optionally, before the configuration-based image recognition module obtains the standard color channel value array of the distortion correction reference unit imaging, it includes:

[0239] Based on the configured image recognition module, for each distortion correction reference subunit standard, a standard red channel value, a standard green channel value, and a standard red channel value of each target pixel thereon are obtained;

[0240] Calculating the color histogram, color moment, and color correlation of the standard of each distortion correction reference subunit based on the standard red channel value, standard green channel value, and standard red channel value of each target pixel to form a standard color channel value vector, the color channel feature value color histogram, color moment, and color correlation;

[0241] The standard color channel value vectors of all distortion-corrected reference sub-unit imaging are serialized to form a standard color channel value array of distortion-corrected reference unit imaging.

[0242] To this end, a series of refined operations are performed before obtaining the standard color channel value array of the distortion correction reference unit imaging, which has the following technical benefits:

[0243] (1) By obtaining the standard red, green, and blue channel values ​​for each target pixel on each distortion correction reference subunit, the scheme can ensure accurate extraction of color information. This accuracy is crucial for subsequent color analysis and correction because it provides accurate basic data.

[0244] (2) By calculating the color histogram, color moment, and color correlation of each distortion correction reference subunit standard, the scheme can fully represent the distribution, shape, and correlation of colors. These color features are very helpful for understanding the color composition of the image and performing accurate color correction.

[0245] (3) By serializing the standard color channel value vectors of all distortion correction reference sub-unit imaging, the scheme forms a unified data structure, namely, the standard color channel value array of distortion correction reference unit imaging. This data structure simplifies the complexity of subsequent processing and improves the efficiency of data processing.

[0246] (4) After having the standard color channel value array imaged by the distortion correction reference unit, the scheme can conveniently compare it with the color channel value array of the actual imaging, thereby identifying the color deviation and correcting it.

[0247] (5) When it is necessary to add a new distortion correction reference subunit or modify the existing color standard, it is only necessary to simply update the standard color channel value array without making large-scale modifications to the entire image processing flow.

[0248] The following is a sample code showing how to obtain the standard color channel value array of the distortion correction reference unit imaging:

[0249]

[0250]

[0251] Optionally, the configuration-based image recognition module registers the imaging color channel value array to the standard color channel value array to determine a distortion elimination transformation matrix, including:

[0252] Performing gamma correction on the imaging color channel value array to obtain a corrected imaging color channel value array;

[0253] Convert the corrected imaging color channel value array and the standard color channel value array from the RGB space to the CIEXYZ space to obtain an imaging color channel value array and a standard color channel value array in the CIEXYZ space, respectively;

[0254] The imaging color channel value array in the CIEXYZ space is registered to the standard color channel value array in the CIEXYZ space to determine the distortion elimination transformation matrix.

[0255] To this end, the distortion elimination transformation matrix is ​​determined by aligning the imaging color channel value array to the standard color channel value array, which has the following technical benefits:

[0256] (1) Gamma correction is an important step that corrects the nonlinear brightness response of an image, making the brightness of the image more uniform and thus improving color accuracy.

[0257] (2) By converting the RGB color space to the CIEXYZ color space, the scheme can use a more accurate and standard color representation method to further improve color accuracy.

[0258] (3) Alignment in the CIEXYZ color space can more accurately match the color difference between the imaging color channel value array and the standard color channel value array.

[0259] (4) This registration method can take into account the overall distribution and shape of colors, rather than just the differences in a single color channel, thereby enhancing the registration effect.

[0260] (5) Through the registration process, the scheme can determine an accurate distortion elimination transformation matrix, which can be used to correct the color distortion in the image. This correction method can significantly improve the quality of the image, making the image clearer and more realistic.

[0261] The following is an example code showing how to register the imaging color channel value array to the standard color channel value array to determine the distortion elimination transformation matrix:

[0262] importnumpyasnp

[0263] fromsome_color_processing_libraryimportgamma_correction,rgb_to_ciexyz,calculate_transformation_matrix

[0264] #imaging_color_array and standard_color_array are imaging color channel value arrays and standard color channel value arrays respectively

[0265] #These arrays should be three-dimensional arrays in RGB color space, with shape (height, width, 3)

[0266] #Perform gamma correction on the imaging color channel value array

[0267] gamma_corrected_imaging_array=gamma_correction(imaging_color_array,gamma=2.2)

[0268] #Convert the corrected imaging color channel value array and the standard color channel value array from RGB space to CIEXYZ space

[0269] ciexyz_imaging_array=rgb_to_ciexyz(gamma_corrected_imaging_array)

[0270] ciexyz_standard_array=rgb_to_ciexyz(standard_color_array)

[0271] #Perform registration in CIEXYZ space to determine the distortion elimination transformation matrix

[0272] transformation_matrix=calculate_transformation_matrix(ciexyz_imaging_array,ciexyz_standard_array)

[0273] #transformation_matrix is ​​a matrix containing distortion elimination transformation information

[0274] Optionally, the step of registering the imaging color channel value array in the CIEXYZ space to the standard color channel value array in the CIEXYZ space to determine the distortion elimination transformation matrix includes:

[0275] Construct an image color matrix based on the pixel values ​​included in the imaging color channel value array in the CIEXYZ space;

[0276] Construct a standard color matrix based on the standard color channel value array in CIEXYZ space;

[0277] Based on the formula Performing singular value decomposition on the image color matrix to obtain a first unit orthogonal matrix, a second unit orthogonal matrix and a first diagonal matrix, wherein the column vector of the first unit orthogonal matrix is ​​a first left singular vector, the column vector of the second unit orthogonal matrix is ​​a first right singular vector, the elements on the first diagonal matrix are first singular values, U1 is the first unit orthogonal matrix, ∑1 is the first diagonal matrix, V1 is the second unit orthogonal matrix, and A is the image color matrix;

[0278] Based on the formula Performing singular value decomposition on the standard color matrix to obtain a third unit orthogonal matrix, a fourth unit orthogonal matrix and a second diagonal matrix, wherein the column vector of the third unit orthogonal matrix is ​​the second left singular vector, the column vector of the fourth unit orthogonal matrix is ​​the second right singular vector, the elements on the second diagonal matrix are the second singular values, U2 is the third unit orthogonal matrix, ∑2 is the second diagonal matrix, V2 is the fourth unit orthogonal matrix, and B is the standard color matrix;

[0279] Based on the formula A distortion elimination transformation matrix is ​​determined based on the third unit orthogonal matrix, the second diagonal matrix, and the first unit orthogonal matrix, wherein the third unit orthogonal matrix and the second diagonal matrix are used to maintain the directionality and scale of B, and the first unit orthogonal matrix is ​​used to adjust the directionality of A.

[0280] The technical process of correcting the color channel value of each pixel of an image using a distortion elimination transformation matrix has the following technical benefits:

[0281] (1) By aligning the image color matrix with the standard color matrix, the color distribution in the image is ensured to be consistent with the expected color distribution. This is very important for color management, image enhancement, and reproduction of artwork.

[0282] (2) The correction process can significantly improve the visual quality of the image, especially in terms of color accuracy. This is crucial for applications such as image editing, printing, and display.

[0283] (3) The constructed distortion elimination transformation matrix can adapt to different image contents and color distributions, making the correction process more flexible and accurate.

[0284] (4) The distortion elimination transformation matrix can not only be used for color correction, but can also be extended to other types of image correction, such as geometric correction, brightness correction, etc.

[0285] (5) In image comparison and matching tasks, color consistency is key. By correcting the image color, the accuracy of the comparison can be improved, which is very important for image retrieval and recognition systems.

[0286] (6) For digital reproduction and restoration of artworks, accurate color correction is crucial. This method can help preserve and restore the original colors of artworks.

[0287] Here is a sample code that shows how to use the distortion elimination transformation matrix to color correct an image:

[0288] importnumpyasnp

[0289] importcv2

[0290] #Read the image

[0291] image=cv2.imread('input_image.jpg')

[0292] lab_image=cv2.cvtColor(image,cv2.COLOR_RGB2Lab)

[0293] #Extract L, a, b channels

[0294] L,a,b=cv2.split(lab_image)

[0295] #Build image color matrix A

[0296] A=np.vstack((L.flatten(),a.flatten(),b.flatten())).T

[0297] # Perform SVD on A

[0298] U1,S1,V1t=np.linalg.svd(A)

[0299] V1=V1t.T

[0300] #B is the standard color matrix, and SVD is also performed

[0301] B=...#Standard color matrix

[0302] U2,S2,V2t=np.linalg.svd(B)

[0303] V2=V2t.T

[0304] #Build the distortion elimination transformation matrix T

[0305] T=U2@np.linalg.inv(U1.T)@S2

[0306] # Apply transformation matrix T for correction

[0307] A_corrected=T@A

[0308] #Reassemble the corrected color channel values ​​into an image

[0309] corrected_L=A_corrected[0].reshape(L.shape)

[0310] corrected_a=A_corrected[1].reshape(a.shape)

[0311] corrected_b=A_corrected[2].reshape(b.shape)

[0312] #Merge channels and convert back to RGB color space

[0313] corrected_lab_image=cv2.merge((corrected_L,corrected_a,corrected_b))

[0314] corrected_image=cv2.cvtColor(corrected_lab_image,cv2.COLOR_Lab2RGB)

[0315] #Display or save the corrected image

[0316] cv2.imwrite('corrected_image.jpg',corrected_image)

[0317] Optionally, the setting-based image correction module obtains color channel values ​​of all pixels on the object to be corrected, and corrects the color channel value of each pixel on the object to be corrected based on the distortion elimination transformation matrix to obtain corrected color channel values ​​of all pixels on the object to be corrected, including:

[0318] Based on the set image correction module, the color channel values ​​of all pixels on the object to be corrected are multiplied with the distortion elimination transformation matrix to correct the color channel value of each pixel on the object to be corrected, and the corrected color channel values ​​of all pixels on the object to be corrected are obtained.

[0319] Optionally, the setting-based image correction module performs a product operation on the color channel values ​​of all pixels on the object to be corrected and the distortion elimination transformation matrix to correct the color channel value of each pixel on the object to be corrected, and obtains the corrected color channel values ​​of all pixels on the object to be corrected, including:

[0320] The color channel value of each pixel is formed into a column vector, and the column vectors corresponding to the color channel values ​​of all pixels are concatenated to form a matrix P, where m is the total number of pixels:

[0321]

[0322] Based on the following formula, the color channel values ​​of all pixels on the object to be corrected are multiplied by the distortion elimination transformation matrix to correct the color channel value of each pixel on the object to be corrected, and the corrected color channel values ​​of all pixels on the object to be corrected are obtained:

[0323]

[0324] P′=T·P

[0325] Where P′ is the matrix composed of the corrected color channel values ​​of all pixels.

[0326] To this end, the color channel value of each pixel on the object to be corrected is corrected using the distortion elimination transformation matrix through the image correction module based on the settings, which has the following technical benefits:

[0327] (1) By using the distortion elimination transformation matrix, the scheme can accurately correct the color channel value of each pixel on the object to be corrected. This precise correction can eliminate color deviations caused by various factors in the imaging process (such as lens distortion, uneven lighting, etc.).

[0328] (2) The corrected color channel values ​​are more accurate, making the colors of the entire image more uniform and consistent. This helps improve the overall quality of the image, making it clearer, more realistic, and enhancing the visual effect.

[0329] (3) The scheme is setup-based, which means that the parameters and methods of image correction can be adjusted according to different application scenarios and requirements. This flexibility enables the scheme to adapt to a variety of different types of images and distortion situations.

[0330] (4) By performing a product operation using the distortion elimination transformation matrix, the scheme can correct the color channel value of each pixel on the object to be corrected in a simple and efficient manner.

[0331] The following is an example code showing how to use the distortion elimination transformation matrix to correct the color channel value of each pixel on the object to be corrected:

[0332] importnumpyasnp

[0333] #distortion_correction_matrix is ​​a 3x3 distortion elimination transformation matrix

[0334] #image is an image to be corrected, its shape is (height, width, 3), representing an RGB image

[0335] #Extract the color channel values ​​of the image to be corrected and reshape it into a two-dimensional array, where each row represents the RGB value of a pixel pixels = image.reshape(-1,3)

[0336] #Use the distortion elimination transformation matrix to correct the color channel value of each pixel

[0337] corrected_pixels=np.dot(pixels,distortion_correction_matrix.T)

[0338] #Reshape the corrected pixel values ​​back to the shape of the original image

[0339] corrected_image=corrected_pixels.reshape(image.shape)

[0340] #corrected_image is a corrected image whose color channel values ​​have been adjusted according to the distortion elimination transformation matrix

[0341] This code provides a basic framework that shows how to use the distortion elimination transformation matrix to correct the color channel values ​​of each pixel on the object to be corrected. In actual application, you need to ensure that distortion_correction_matrix is ​​a valid 3x3 transformation matrix and image is an image array containing valid RGB color channel values.

[0342] Optionally, the artwork contour recognition module is used to call a built-in contour search model to determine the contour of the object to be corrected to extract contour feature points therefrom, and to establish a blank image having the same size as the object to be corrected based on the contour feature points, including:

[0343] The built-in contour search model is called to perform multi-scale edge detection on the object to be corrected to obtain edge strength, and the set second-order derivative operator is used to perform local change rate statistics on the object to be corrected to determine the contour of the object to be corrected and select the local change rate greater than the set local change rate threshold and the edge strength greater than the set edge strength threshold as the contour feature points, so as to establish a blank image with the same size and matching the contour of the object to be corrected based on the contour feature points.

[0344] To this end, the artwork contour recognition module uses the built-in contour search model and multi-scale edge detection technology, as well as the second-order derivative operator to perform local change rate statistics to determine the contour of the object to be corrected and extract contour feature points from it. Based on these contour feature points, a blank image that matches the contour of the object to be corrected and has the same size is established, which has the following technical benefits:

[0345] (1) Through multi-scale edge detection and second-order derivative operators to perform local change rate statistics, the scheme can more accurately identify the contour of the object to be corrected. This method can capture subtle edge and contour changes in the image, thereby improving the accuracy of contour recognition.

[0346] (2) The scheme combines a variety of contour recognition techniques (multi-scale edge detection, local change rate statistics), making it robust to different types of images and distortions. Even if the contour of the object to be corrected is affected by noise, blur or other image quality issues, the scheme can still accurately extract contour feature points.

[0347] (3) Through the built-in contour search model, the solution can efficiently process images and quickly extract contour feature points. This helps to reduce image processing time and improve overall processing efficiency.

[0348] (4) The blank image created based on the contour feature points completely matches the contour of the object to be corrected and has the same size. This facilitates subsequent image correction, analysis, or other processing steps because they can be performed on a blank image with the same size and contour as the original image.

[0349] The following is an example code that shows how to use the contour finding model and multi-scale edge detection to determine the contour of the object to be corrected and extract contour feature points from it:

[0350]

[0351] It should be noted that the find_contour_features function is a custom function that combines the edge detection results and the output of the second-order derivative operator to determine the contour feature points. In actual applications, the specific implementation of this function will vary depending on specific needs and image characteristics. In addition, the lowThreshold, highThreshold, local_change_rate_threshold, and edge_strength_threshold in the sample code are all parameters that need to be set according to actual conditions.

[0352] Optionally, the image perspective module is used to project the corrected color channel value of each pixel on the object to be corrected onto the blank image in a manner aligned with the pixel position on the object to be corrected to generate a new artwork image as the corrected artwork image, including:

[0353] Selecting a number of reference pixels from the object to be corrected as reference points;

[0354] Determine the projection position on the blank image by aligning the corrected color channel values ​​of each reference point on the object to be corrected with the pixel-based position on the object to be corrected;

[0355] Calculate a perspective transformation matrix based on the position of the reference point on the object to be corrected and the corresponding projection position on the blank image;

[0356] Based on the perspective transformation matrix, the corrected color channel values ​​of each pixel on the object to be corrected are projected onto the blank image in a manner aligned with the pixel positions on the object to be corrected, so as to generate a new artwork image as a corrected artwork image.

[0357] To this end, the image perspective module is used to project the corrected color channel values ​​of each pixel on the object to be corrected onto the blank image in a manner aligned with the pixel position on the object to be corrected, thereby generating a new artwork image as the corrected artwork image, which has the following technical benefits:

[0358] (1) By selecting a number of reference pixels as reference points and determining the projection positions on the blank image by aligning the pixel positions, the scheme can accurately calculate the perspective transformation matrix. This precise perspective transformation ensures that each pixel on the object to be corrected can be correctly projected onto the blank image, thereby generating an accurate corrected artwork image.

[0359] (2) During the perspective transformation process, the scheme takes into account the position and color channel value of each pixel on the object to be corrected, ensuring that the details and features of the image are maintained when projected onto a blank image. This helps generate high-quality imaging of artworks and preserves important information in the original image.

[0360] (3) By adjusting the selection of reference points and the calculation of the perspective transformation matrix, the scheme can adapt to different types of objects to be corrected and correction requirements. This flexibility makes the scheme widely applicable to the correction and processing of various artwork images.

[0361] (4) This scheme achieves efficient image processing by calculating the perspective transformation matrix at one time and projecting all pixels on the object to be corrected onto a blank image. This helps to reduce processing time and improve the overall efficiency of artwork image correction.

[0362] (5) Through precise perspective transformation and detail preservation, the scheme can generate more realistic and three-dimensional images of artworks. This helps to enhance the visual effect of artworks and improve the audience's viewing experience.

[0363] The following is an example code that shows how to use the perspective transformation matrix to project the pixels of the object to be corrected onto a blank image:

[0364]

[0365] It should be noted that the ref_points and projected_points in the sample code need to be selected and determined according to the actual situation. In addition, the sample code sets the number of reference points to 4, which is a common case required to calculate the perspective transformation matrix, but the number of reference points may be different depending on the actual situation.

[0366] Furthermore, after obtaining the corrected artwork image, it can be cropped and processed.

[0367] In addition, the above solution also supports batch processing of images, so that multiple images to be processed can be processed simultaneously.

[0368] In addition, the embodiment of the present application also provides an automatic processing method for artistic images, which includes:

[0369] Read the image to be processed;

[0370] Recognizing the image to be processed to obtain an image recognition result;

[0371] According to the image recognition result, determining whether the image to be processed includes an artwork imaging and a distortion correction reference unit imaging;

[0372] In response to the image to be processed including an artwork imaging and a distortion correction reference unit imaging, taking the artwork imaging as an object to be corrected, and determining all distortion correction reference sub-unit imaging included in the distortion correction reference imaging;

[0373] Determining a distortion elimination transformation matrix according to the color channel eigenvalues ​​of all the distortion correction reference subunit imaging;

[0374] The object to be corrected is corrected according to the distortion elimination transformation matrix to obtain a corrected artwork image.

[0375] In this embodiment of automatic processing of artistic images, the exemplary technical processing process of each step can be found in the above Figure 1 The records are not repeated here.

[0376] Figure 3 FIG. 1 is a schematic diagram of the structure of an automatic art image processing system according to an embodiment of the present application. Figure 3 As shown, it includes:

[0377] An image input module, used for reading the image to be processed;

[0378] The image recognition module is used to recognize the image to be processed to obtain an image recognition result, and determine whether the image to be processed includes an artwork imaging and a distortion correction reference unit imaging according to the image recognition result; in response to the image to be processed including the artwork imaging and the distortion correction reference unit imaging, take the artwork imaging as an object to be corrected, and determine all distortion correction reference sub-unit imaging included in the distortion correction reference imaging, so as to determine a distortion elimination transformation matrix according to color channel eigenvalues ​​of all the distortion correction reference sub-unit imaging, so as to correct the object to be corrected according to the distortion elimination transformation matrix to obtain a corrected artwork image.

[0379] Optionally, the image recognition module is specifically configured to perform the following steps to determine a distortion elimination transformation matrix:

[0380] Determine the center coordinates of each distortion correction reference subunit imaging, and select a number of target pixels from the corresponding distortion correction reference subunit imaging based on the center coordinates;

[0381] For each distortion correction reference subunit imaging, an imaging color channel value of each target pixel thereon is obtained, and based on the imaging color channel values ​​corresponding to the plurality of target pixels, a color channel characteristic value of the imaging of each distortion correction reference subunit is calculated to form an imaging color channel value vector;

[0382] Serializing the imaging color channel value vectors of all distortion correction reference sub-unit imaging to form an imaging color channel value array of distortion correction reference unit imaging;

[0383] Obtaining an array of standard color channel values ​​of the distortion correction reference unit imaging;

[0384] The imaging color channel value array is registered to the standard color channel value array to determine a distortion elimination transformation matrix.

[0385] Optionally, the system further comprises:

[0386] An image correction module, used for acquiring color channel values ​​of all pixels on the object to be corrected, and correcting the color channel value of each pixel on the object to be corrected based on the distortion elimination transformation matrix to obtain corrected color channel values ​​of all pixels on the object to be corrected;

[0387] An artwork contour recognition module, used to call a built-in contour search model, determine the contour of the object to be corrected to extract contour feature points therefrom, and create a blank image with the same size as the object to be corrected based on the contour feature points;

[0388] The image perspective module is used to project the corrected color channel values ​​of each pixel on the object to be corrected onto the blank image in a manner aligned with the pixel positions on the object to be corrected, so as to generate a new artwork image as a corrected artwork image.

[0389] In the embodiment of the above system, the exemplary technical processing process of each functional module can be found in the above Figure 1 The records are not repeated here.

[0390] An embodiment of the present application further provides an electronic device, which includes a memory and a processor, wherein the memory is used to store a computer executable program, and the processor is used to run the computer executable program to implement any method described in the embodiment of the present application.

[0391] Figure 4 This is a schematic diagram of a scenario in which a user uses an application program to automatically process an artistic image according to an embodiment of the present application; Figure 4 As shown, the application scenario image processing system includes a terminal and an application server. The application server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal can be a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, etc., but is not limited to this. The terminal and the above-mentioned application server 102 can be directly or indirectly connected via wireless communication (such as a network), and this application is not limited here. An application is installed on the terminal for at least obtaining an image to be processed, and the application server is used to execute the method described in any of the above embodiments.

[0392] Figure 5 This is a specific application example of the embodiment of this application. Figure 5 As shown, for a specific image to be processed, the lower right corner of the artwork image is the distortion correction reference unit. Through a series of processes such as inputting the image to be processed, identifying the distortion correction reference unit image, correcting the distortion correction reference unit image, identifying the artwork contour, and performing image perspective, the corrected artwork image is obtained.

[0393] The above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims

1. A method for automatically processing artistic images, characterized in that: include: Based on the configured image input module, read the image to be processed; Based on the configured image recognition module, perform at least one of the following steps to determine a distortion elimination transformation matrix: Recognizing the image to be processed to obtain an image recognition result; determining, based on the image recognition result, whether the image to be processed includes an image of an artwork and an image of a distortion correction reference unit; In response to the image to be processed including an artwork imaging and a distortion correction reference unit imaging, taking the artwork imaging as an object to be corrected, and determining all distortion correction reference sub-unit imaging included in the distortion correction reference imaging; Determining the center coordinates of each distortion correction reference subunit imaging, and screening a number of target pixels from the corresponding distortion correction reference subunit imaging based on the center coordinates; For each distortion correction reference subunit imaging, an imaging color channel value of each target pixel thereon is obtained, and based on the imaging color channel values ​​corresponding to the plurality of target pixels, a color channel characteristic value of the imaging of each distortion correction reference subunit is calculated to form an imaging color channel value vector; Serializing the imaging color channel value vectors of all distortion correction reference sub-unit imaging to form an imaging color channel value array of the distortion correction reference unit imaging; Obtaining an array of standard color channel values ​​of the distortion correction reference unit imaging; Registering the imaging color channel value array to the standard color channel value array to determine a distortion elimination transformation matrix; Based on the set image correction module, color channel values ​​of all pixels on the object to be corrected are obtained, and the color channel value of each pixel on the object to be corrected is corrected based on the distortion elimination transformation matrix to obtain corrected color channel values ​​of all pixels on the object to be corrected; an artwork contour recognition module, configured to call a built-in contour search model to determine the contour of the object to be corrected to extract contour feature points therefrom, and to create a blank image having the same size as the object to be corrected based on the contour feature points; An image perspective module is configured to project the corrected color channel values ​​of each pixel on the object to be corrected onto the blank image in a manner aligned with the pixel positions on the object to be corrected, so as to generate a new artwork image as the corrected artwork image.

2. The method for automatically processing artistic images according to claim 1, characterized in that: The configuration-based image input module reads the image to be processed, including: The configured image input module accesses the configuration management interface to obtain image reading configuration parameters; The configured image input module accesses the image reading library to parse the image reading configuration parameters to obtain a parsing result, and reads the image to be processed according to the parsing result.

3. The method for automatically processing artistic images according to claim 1, characterized in that: After the configuration-based image input module reads the image to be processed, the configuration-based image input module further includes: performing the following steps: Preprocessing the read image to be processed to obtain an enhanced image; Performing image quality assessment on the enhanced image based on a set image quality assessment model to determine whether the enhanced image meets the set quality assessment criteria; If the conditions are met, the enhanced image meeting the set quality assessment criteria is input into the image recognition module so that when the image to be processed is recognized to obtain an image recognition result, the enhanced image meeting the set quality assessment criteria is recognized to obtain an image recognition result, wherein the preprocessing includes at least one of: denoising, cropping, scaling, and rotation; Otherwise, the process jumps to continuing preprocessing the image to be processed to obtain an enhanced image, until the enhanced image that meets the set quality evaluation standard is obtained.

4. The method for automatically processing artistic images according to claim 3, characterized in that: If the preprocessing includes denoising, the preprocessing of the read image to be processed to obtain an enhanced image includes: Traversing all pixels in the image to be processed, and taking each element traversed each time as a denoising object; Based on a set fixed window, a neighborhood range is defined with the denoising object as the center; For each neighborhood pixel point within the neighborhood range, calculating the neighborhood interval and color difference between the neighborhood pixel point and the denoising object; Calculating a first attenuation factor based on the neighborhood interval between each neighborhood pixel point and the denoising object, and calculating a second attenuation factor based on the color difference, so as to calculate a denoising weight corresponding to each neighborhood pixel point based on the first attenuation factor and the second attenuation factor; According to the denoising weights corresponding to all the neighboring pixels, the original pixel values ​​of the denoised object are denoised to obtain new pixel values ​​of the denoised object.

5. The method for automatically processing artistic images according to claim 1, characterized in that: The configured image recognition module recognizes the image to be processed to obtain an image recognition result, including: Based on the configured image recognition module, color feature extraction, texture feature extraction, and shape feature extraction are performed on the image to be processed, so as to identify the image to be processed according to the extracted color features, texture features, and shape features to obtain an image recognition result.

6. The method for automatically processing artistic images according to claim 5, characterized in that: The configuration-based image recognition module recognizes the image to be processed according to the extracted color features, texture features, and shape features to obtain an image recognition result, including the following steps: Perform multi-head attention analysis on the extracted color features, texture features, and shape features to obtain multi-head attention weights; The color features, texture features, and shape features are fused according to the multi-head attention weights to obtain semantic fusion features; The semantic fusion feature is input into the trained regressor to predict the image content, so as to identify the image to be processed according to the predicted image content to obtain an image recognition result.

7. The method for automatically processing artistic images according to claim 1, characterized in that: In response to the image to be processed including an artwork imaging and a distortion correction reference unit imaging, the configuration-based image recognition module uses the artwork imaging as an object to be corrected and determines all distortion correction reference sub-unit imaging included in the distortion correction reference imaging, including: In response to the image to be processed including an image of an artwork and an image of a distortion correction reference unit, the configured image recognition module labels the image of the artwork so as to use the image of the artwork as an object to be corrected; Processing the distortion correction reference imaging grayscale based on the configured image recognition module to obtain a grayscale image, calculating a grayscale histogram of the grayscale image, and determining boundaries between the distortion correction reference subunit imaging based on the grayscale histogram; The distortion-corrected reference imaging is segmented based on boundaries between the distortion-corrected reference sub-unit imagings to determine all distortion-corrected reference sub-unit imagings.

8. The method for automatically processing artistic images according to claim 1, characterized in that: The configuration-based image recognition module determines the center coordinates of each distortion correction reference subunit imaging, and screens out a number of target pixels from the corresponding distortion correction reference subunit imaging based on the center coordinates, including: Determining the vertex coordinates of the imaging area of ​​each distortion correction reference subunit based on the configured image recognition module; Based on the vertex coordinates, calculating the center coordinates of each distortion correction reference subunit imaging; A neighborhood feature representation is obtained, and based on the center coordinates, the neighborhood feature representation is used as a constraint to perform a local binary calculation on each pixel on the corresponding distortion correction reference subunit imaging to screen out a number of significant feature pixels as a number of target pixels.

9. A method for automatically processing artistic images, characterized in that: include: Read the image to be processed; Recognizing the image to be processed to obtain an image recognition result; determining, based on the image recognition result, whether the image to be processed includes an image of an artwork and an image of a distortion correction reference unit; In response to the image to be processed including an artwork imaging and a distortion correction reference unit imaging, taking the artwork imaging as an object to be corrected, and determining all distortion correction reference sub-unit imaging included in the distortion correction reference imaging; Determining a distortion elimination transformation matrix according to the color channel eigenvalues ​​of imaging of all the distortion correction reference subunits; The object to be corrected is corrected according to the distortion elimination transformation matrix to obtain a corrected artwork image.

10. An automatic processing system for artistic images, characterized in that: include: Image input module, used to read the image to be processed; An image recognition module is configured to recognize the image to be processed to obtain an image recognition result, determine whether the image to be processed includes an artwork image and a distortion correction reference unit image based on the image recognition result, and in response to the image to be processed including the artwork image and the distortion correction reference unit image, use the artwork image as an object to be corrected, determine all distortion correction reference sub-unit images included in the distortion correction reference image, determine a distortion elimination transformation matrix based on color channel eigenvalues ​​of all the distortion correction reference sub-unit images, and correct the object to be corrected based on the distortion elimination transformation matrix to obtain a corrected artwork image.

Citation Information

Patent Citations

  • Digital duplication color rendition method for painting and calligraphy artworks

    CN103587268A

  • Calligraphy and painting replication method

    CN107247569A

  • Color correction method and evaluation method for panorama camera

    CN108600723A

  • Fisheye image rapid correction method based on distortion stretching factor

    CN114331826A

  • Pork quality classification method based on reference color card image correction

    CN117934962A