Machine vision-based online detection method and system for wood grain texture of injection molded products

CN122820537APending Publication Date: 2026-09-25GUANGZHOU JIGU ELECTRIC APPLIANCE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610651017.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-12
Publication Date
2026-09-25

AI Technical Summary

Technical Problem

[0003]现有技术在该类场景中通常采用人工目检、固定阈值图像处理、标准模板比对或一般性的表面缺陷识别方式进行检测,其中人工方式依赖经验且难以适应高速节拍,固定阈值方法容易把木纹自身的正常深浅变化和真实异常混为一体,模板比对方式又很难兼顾不同批次材料波动、模具状态变化以及木纹自然不均匀性,因而在误检、漏检和稳定性方面都存在明显局限

Benefits of technology

本申请首先对注塑产品木纹纹理图像进行定向增强、姿态统一和标准化表达,使木纹条带在统一视场中呈现稳定的方向结构;随后基于木纹条带沿主方向的连续变化、法向层次差异以及区域合并关系构建纹理区域图,使木纹检测对象由传统的像素级差异提升为具有区域归属和边界关系的结构单元;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122820537A_ABST
    Figure CN122820537A_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of image detection, in particular to a method and system for online detection of wood grain texture of injection molding products based on machine vision, a direction response graph is extracted, pixel enhancement is performed on the wood grain detection area image based on the direction response graph, each pixel position in the direction response graph corresponds to a main direction, the main direction with the highest frequency is taken as the main direction of the whole graph to construct a standardized texture image, the local main direction and the wood grain strip seed response value are calculated, the strip seed and the initial micro area are constructed, the initial micro area and the adjacent area are merged to construct the final area by comparing the calculation of the merging cost with the preset threshold value, the final area is subjected to thinning treatment to generate a texture area graph, the neighborhood reference gray scale of the texture area graph is calculated, the neighborhood is subjected to abnormal grading to generate an abnormal state table, the corresponding spatial aggregation degree is calculated, the comprehensive abnormal degree of the current injection molding product is calculated, and the online detection result is generated based on the comparison result of the comprehensive abnormal degree and the preset threshold interval.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image detection technology, and more particularly to an online detection method and system for wood grain texture of injection molded products based on machine vision. Background Technology

[0002] Online detection of wood grain texture on the surface of injection-molded products is a long-standing but difficult-to-solve quality control problem in the mass production of wood grain-look plastic parts. For injection-molded parts, such as the shell of an integrated wood grain anti-scalding electric kettle, the wood grain appearance is not an independent decorative layer attached to the surface. Rather, it is a simulated wood grain structure with a certain main direction, strip width, layer transition, and light and dark variations, formed on the surface of the plastic part under the combined effects of mold texture, material ratio, melt flow state, local cooling conditions, and molding parameters. From an aesthetic perspective, this type of texture requires natural continuity, harmonious colors, clear boundaries, and overall consistency. However, from a molding mechanism perspective, it exhibits obvious process coupling characteristics. Therefore, actual defects are not simply manifested as single point flaws, but rather as complex anomalies such as dragging, blurring, local bulging, layer drift, abnormal boundary reinforcement, and interruption of the skeleton structure.

[0003] Existing technologies for this type of scenario typically employ manual visual inspection, fixed-threshold image processing, standard template comparison, or general surface defect identification methods for detection. Manual methods rely on experience and are difficult to adapt to high-speed production cycles. Fixed-threshold methods easily confuse normal variations in wood grain depth with genuine anomalies. Template comparison methods struggle to account for variations in material batches, mold conditions, and the natural inhomogeneity of wood grain, resulting in significant limitations in terms of false positives, false negatives, and stability. More importantly, while many existing solutions can determine the presence or absence of defects, they fail to establish a detection object based on the regional structure of the wood grain strips themselves. This leads to the detection process remaining at the level of pixel differences or local brightness differences, failing to incorporate structural factors that truly determine wood grain quality, such as texture direction, strip width, regional adjacency relationships, and skeletal continuity, into a unified analysis. Furthermore, it is difficult to further aggregate regional anomalies into online processing criteria for the entire product. For injection-molded wood grain products, the production line truly needs more than just identifying anomalies in a specific location; it needs to determine, based on the wood grain regional structure, whether the anomaly is sufficient to affect the overall product's appearance consistency and to provide online processing results indicating whether it is acceptable, questionable, or unacceptable. Therefore, it is necessary to establish a machine vision inspection solution that is compatible with the real form of injection-molded wood grain texture, so that image acquisition, texture region construction, regional defect identification and online processing of the whole product form a continuous technical chain, thereby transforming the visual information of the wood grain surface into quality information that can directly serve the production line's judgment and execution. Summary of the Invention

[0004] To address the aforementioned issues, this invention provides a machine vision-based online detection method and system for wood grain texture in injection molded products.

[0005] To achieve the above objectives, this invention proposes an online detection method for wood grain texture in injection molded products based on machine vision, comprising: High-contrast contours are extracted from the original image. Preset cropping boxes are corrected based on the high-contrast contours. Wood grain detection region images are extracted based on the corrected preset cropping boxes. The wood grain detection region images are input into a convolutional network to extract orientation response maps. Pixel enhancement is performed on the wood grain detection region images based on the orientation response maps. Each pixel position in the orientation response map corresponds to a main direction. The main direction with the highest frequency is taken as the main direction of the whole image. A standardized texture image is constructed based on the main direction of the whole image and the pixel-enhanced wood grain detection region images. For the standardized texture image, the local principal direction is calculated pixel by pixel. Based on the local principal direction, the wood grain strip seed response value at each pixel position is calculated. Strip seed points are constructed based on the wood grain strip seed response values. Initial micro-regions are constructed based on the strip seed points. By comparing the merging cost with a preset threshold, the initial micro-regions are merged with adjacent regions to construct the final region. The final region is then refined to generate a texture region map. Calculate the neighborhood reference grayscale of the texture region map, calculate the defect response value of the neighborhood based on the neighborhood reference grayscale, and classify the neighborhood into anomalies by combining a preset threshold range to generate an anomaly status table. For each abnormal region in the abnormal status table, its corresponding spatial clustering degree is calculated. Based on the spatial clustering degree and the defect response value, the overall abnormality degree of the current injection molded product is calculated. Based on the comparison result of the overall abnormality degree with the preset threshold range, an online detection result is generated.

[0006] In some embodiments, the pixel enhancement of the wood grain detection region image based on the orientation response map specifically includes: For each pixel position in the directional response map, the average value of its corresponding main direction neighborhood is calculated using a mean function; Based on the average value of the neighborhood along the main direction, the enhanced pixel value of each pixel position is calculated using the enhancement function.

[0007] In some embodiments, constructing a normalized texture image based on the main direction of the entire image and the enhanced pixel values ​​specifically includes: The rotational deviation of the wood grain detection area image is obtained by comparing the main direction of the entire image with the standard reference direction pre-recorded during the equipment debugging phase. Based on the rotation deviation, the wood grain detection area map after pixel enhancement is rotated and corrected, and then the rotated wood grain detection area map is normalized to finally output a standardized texture image.

[0008] In some embodiments, calculating the local principal direction pixel-by-pixel on the standardized texture image specifically includes: Calculate the gradients in the horizontal and vertical directions in the standardized texture image; Then, the gradient is accumulated in the neighborhood of each pixel location to form a local covariance matrix; The eigenvector corresponding to the largest eigenvalue of the local covariance matrix is ​​defined as the local principal direction of the pixel position.

[0009] In some embodiments, the step of extracting high-contrast contours from the original image and modifying the preset cropping box based on the high-contrast contours specifically includes: Extract high-contrast contours of the top and side edges from the original image; The preset cropping frame is corrected based on the intersection position of the high-contrast contours.

[0010] In some embodiments, performing a thinning process on the final region to generate a texture region map specifically includes: Obtain the region skeleton of each final region, and calculate the longest connected main skeleton length, total skeleton length, region main direction consistency ratio, and normal width sampling sequence of the region skeleton; The average gray level of a region is calculated from the set of pixels in that region, and the adjacency list and shared boundary length are calculated from the region's contact boundary. A texture region map is constructed based on the longest connected main skeleton length, total skeleton length, region main direction consistency ratio, normal width sampling sequence, region average gray level, adjacency list, and shared boundary length.

[0011] In some embodiments, the wood grain stripe seed response value is generated by calculating a response function, the parameters of which include the pixel position of the current pixel in the normalized texture image, the discrete length of sampling along the local principal direction, the center line sampling point, the auxiliary sampling point, the pixel value of the center line sampling point, and the pixel value of the auxiliary sampling point.

[0012] In some embodiments, the merging cost is generated by calculating a cost function, the parameters of which include the normalized result of the average brightness difference between two adjacent micro-regions, the normalized result of the main direction difference between two adjacent micro-regions, the normalized result of the normal width difference between two adjacent micro-regions, the direction term weight, and the width term weight.

[0013] In some embodiments, the defect response value is generated by calculating a defect response function, the parameters of which include the average gray value of the defect region, the neighborhood reference gray value, the main direction consistency ratio of the region, the width fluctuation coefficient of the region, the skeleton integrity ratio of the region, the weights of the direction disorder term, the width fluctuation term, and the skeleton fracture term.

[0014] To achieve the above objectives, another aspect of the present invention proposes an online detection system for wood grain texture of injection molded products based on machine vision, comprising: A standardized texture image construction module is used to extract high-contrast contours from the original image, correct a preset cropping box based on the high-contrast contours, extract a wood grain detection region image based on the corrected preset cropping box, input the wood grain detection region image into a convolutional network to extract a direction response map, perform pixel enhancement on the wood grain detection region image based on the direction response map, where each pixel position in the direction response map corresponds to a main direction, the most frequent main direction is taken as the main direction of the whole image, and a standardized texture image is constructed based on the main direction of the whole image and the pixel-enhanced wood grain detection region image. The wood grain texture region map construction module is used to calculate the local principal direction pixel by pixel in the standardized texture image, calculate the wood grain strip seed response value at each pixel position based on the local principal direction, construct strip seed points based on the wood grain strip seed response values, construct an initial micro-region based on the strip seed points, and merge the initial micro-region with adjacent regions by comparing the calculated merging cost with a preset threshold to construct the final region. The module then performs a thinning process on the final region to generate a texture region map. An abnormal state identification module is used to calculate the neighborhood reference grayscale of the texture region map, calculate the defect response value of the neighborhood based on the neighborhood reference grayscale, and classify the neighborhood into anomalies by combining a preset threshold range to generate an abnormal state table. The anomaly detection and handling module is used to calculate the spatial clustering degree of each abnormal area in the anomaly status table, calculate the comprehensive anomaly degree of the current injection molded product based on the spatial clustering degree and the defect response value, and generate online detection results based on the comparison result of the comprehensive anomaly degree with the preset threshold range.

[0015] The beneficial effects of this invention are as follows: This application first performs directional enhancement, pose unification, and standardized representation on the wood grain texture image of the injection molded product, so that the wood grain strips present a stable directional structure in a unified field of view; then, based on the continuous change of the wood grain strips along the main direction, the difference in normal hierarchy, and the region merging relationship, a texture region map is constructed, so that the wood grain detection object is improved from the traditional pixel-level difference to a structural unit with region affiliation and boundary relationship; Based on this, the system further combines regional average grayscale, neighboring reference grayscale, main direction consistency ratio, normal width fluctuation coefficient, and skeleton integrity ratio to calculate the defect response of each texture region. This enables unified identification of anomalies such as color difference, flow marks, bubble disturbance, and texture breakage, and generates a current anomaly status table. Finally, the regional anomaly records are aggregated according to area proportion and spatial clustering relationship to form the comprehensive anomaly degree of the entire product, outputting online handling results of qualified, suspicious, or unqualified, and directly linking alarms, sample retention records, and sorting interception actions.

[0016] Therefore, this invention forms a complete closed-loop solution from standardized texture images to texture region maps, from regional defect identification to online processing results. Its innovation lies not in strengthening a single identification model, but in transforming injection-molded wood grain, an object with a special molding background and special appearance rules, into a detection system that can be structured, regionally judged, and processed as a whole. This allows the detection results to accurately reflect the quality status of the wood grain texture itself and directly meet the actual needs of the production line for online judgment and online execution. Attached Figure Description

[0017] Figure 1 This is a flowchart of a specific embodiment of the present invention; Figure 2 This is a system block diagram in a specific embodiment of the present invention. Detailed Implementation

[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0019] refer to Figure 1 As shown, one aspect of this application embodiment proposes an online detection method for wood grain texture of injection molded products based on machine vision, including: S1: Extract high-contrast contours from the original image; refine a preset cropping box based on the high-contrast contours; extract a wood grain detection region image based on the refined preset cropping box; input the wood grain detection region image into a convolutional network to extract a direction response map; perform pixel enhancement on the wood grain detection region image based on the direction response map, where each pixel position in the direction response map corresponds to a main direction; select the most frequent main direction as the main direction of the entire image; and construct a standardized texture image based on the main direction of the entire image and the pixel-enhanced wood grain detection region image, specifically including: In this step, an industrial camera, fixedly installed above the inspection station on the injection molding production line, performs online imaging of the integrated wood grain anti-scalding electric kettle casing. A photoelectric switch outputs a trigger signal when the product enters the inspection station, and the camera completes a single-frame exposure and transmits the original image of the entire field of view. The image is transmitted to the industrial control computer. Since the image simultaneously includes the wood grain surface, product edges, parts of the fixture, and the environmental background, multiple frames of qualified product images are first acquired during the equipment debugging phase. Engineers then mark the wood grain detection range on the operating interface and record the positional relationship of this range relative to the outer contour of the teapot. During formal operation, the system first... The high-contrast contours of the upper and side edges of the teapot body are extracted. Then, the preset cropping frame is slightly shifted and corrected based on the intersection of these contours. Finally, the wood grain detection area image is extracted according to the corrected cropping frame, denoted as... .at this time The image content has been focused on the wood grain surface to be detected, establishing a unified field of view for subsequent texture processing. In actual production lines, this processing is particularly suitable for the curved shell of the teapot, because a slight offset of the same product on the conveyor belt will directly cause a change in the texture position, and once the wood grain detection range drifts, subsequent area division will mistakenly treat boundary shadows or transition zones of the teapot as texture anomalies.

[0020] After obtaining the wood grain detection region, further processing is performed focusing on the continuous extension features of the wood grain stripes. Injection-molded wood grain typically appears in images as distinctly directional light and dark stripes. Directly applying ordinary mean smoothing or uniform sharpening can easily mix the stripe direction information with local reflections and random noise. Therefore, a three-layer convolutional network is first used to extract pixel-level direction responses. This convolutional network is deployed within an industrial control computer or edge computing unit. The first convolutional layer receives the truncated... The first layer extracts local edges, the second convolutional layer connects adjacent edges into a longer, continuous directional structure, and the third layer integrates channels and outputs a directional response map. Each pixel in the directional response map corresponds to a dominant directional category, which is obtained by comparing the response intensity of each directional channel, such as horizontal, vertical, left-slanted, or right-slanted. After the directional response map is determined, a length of [missing information] is selected along its dominant direction at each pixel location. The average value of the neighborhood along the main direction is calculated using a mean function within the continuous neighborhood. The mean function is calculated based on the classic mean filtering formula, but instead of the traditional omnidirectional sampling within a fixed window, it is rewritten as directional sampling along the main direction of the wood grain. The expression for the mean function is: ; in, Indicates position The average value of the neighborhood in the main direction; This indicates the coordinates of the current pixel to be processed within the wood grain detection area, which is directly given by the image matrix index; This indicates the number of pixels in the neighborhood that participate in the average calculation in the main direction. This value is set during the device debugging phase based on the typical width of the wood grain strip. Indicates the first The index of each neighboring sampling point, with a value range from... arrive ; Indicates the first in the main direction The original pixel value of each sampling point is directly taken from the cropped wood grain detection area image. ; and They represent the first The horizontal and vertical offsets of each sampling point relative to the current position are given by the main direction discrete sampling rule corresponding to the direction response map. For example, when the main direction is the left diagonal direction, the offsets are taken sequentially from the upper left to the lower right direction.

[0021] Based on the average value of the neighborhood along the main direction, an enhanced image is then constructed following the classic desharpening approach. Its original form comes from the "weighted superposition of the difference between the original image and the smooth background". This application replaces the smooth background with the neighborhood average value obtained along the main direction of the wood grain through an enhancement function, so that the enhancement result is more consistent with the real extension relationship of the wood grain stripes. The specific expression of the enhancement function is as follows: ; in, Indicates position Enhanced pixel values; Represents the original pixel value at the current position; This represents the average value of the neighborhood along the main direction obtained from the previous equation; This represents the enhancement coefficient, which was obtained and fixed in the parameter table during the equipment debugging phase through trial adjustments using qualified sample images. Therefore, it can be seen that when the current position is at the boundary of a clear wood grain strip, and There are significant differences between them, and the enhanced stripe boundary is highlighted; when the current position maintains a smooth transition with the neighborhood in the same direction, the enhancement amplitude is correspondingly reduced. Taking a set of commonly used ratio values ​​in actual debugging as an example, if the position of a certain wood grain pixel satisfies... Its main direction is the left diagonal direction, and it is selected along the left diagonal direction. Five consecutive sampling points, with five pixel values ​​as follows: , , , , Substituting this into the first equation, we get... The average result of these five pixels, i.e. If the equipment parameter table is set Substituting this into the second equation, we get... The actual output is rounded according to the established rules of the image processing module. If another location is affected by highlights... Rise to The average value of the neighborhood in the same direction is still [value missing]. The system then combines the directional response map to determine the directional consistency at that location. When the brightness suddenly increases but the directional response does not increase accordingly, it is treated as a candidate point for reflection, and the neighborhood average value is used to replace the enhancement result, so that the wood grain strip boundary and the specular highlight present different response modes in the image.

[0022] After pixel enhancement, the system continues to statistically analyze the main direction distribution across the entire wood grain detection area. The direction with the highest frequency of occurrence is selected as the main direction for the entire image, and compared with the standard reference direction pre-recorded during equipment debugging to determine the rotation deviation of the current image. A small-angle rotation correction is then applied to the enhanced image to ensure the overall wood grain trend remains consistent across frames. The rotated image then undergoes uniform normalization processing to ensure that wood grain images acquired in different batches and time periods fall within the same range in terms of overall brightness distribution, ultimately outputting a standardized texture image. .Should From the original image of the entire field of view The image of the wood grain detection area was obtained after position correction and wood grain detection area extraction. Afterwards, through direction extraction, orientation enhancement, reflection filtering, posture correction and normalization, the wood grain strips are obtained. This process retains the continuous structure of the wood grain strips while suppressing interference caused by surface reflection and micro-position offset. It can be directly used as input for the next step of constructing the wood grain texture area map.

[0023] S2: Calculate the local principal direction pixel-by-pixel for the standardized texture image. Based on the local principal direction, calculate the wood grain stripe seed response value at each pixel location. Construct stripe seed points based on the wood grain stripe seed response values. Construct initial micro-regions based on the stripe seed points. By comparing the merging cost with a preset threshold, merge the initial micro-regions with adjacent regions to construct the final region. Perform a thinning process on the final region to generate a texture region map. Specifically, this includes: S2 is the normalized texture image output by S1. The task of this up-expansion method is to transform a wood grain image that has already undergone orientation enhancement, reflection suppression, and pose unification into a texture region map with a well-defined structure. This step is set up separately because defects in the injection-molded wood grain appearance are not isolated pixel brightness anomalies, but rather structural changes occurring within the strips, at strip boundaries, or between adjacent strips. For products like integrated wood grain anti-scalding electric kettle shells, the wood grain typically extends along a stable direction while maintaining a limited width laterally. Under normal molding conditions, the strips undulate slowly along the main direction, while maintaining a layered difference with adjacent strips in the normal direction. However, when flow marks, cold material dragging, local bubble disturbances, or insufficient texture transfer occur, this "vertical continuity, horizontal layering" relationship is disrupted. Based on this scenario characteristic, this step adopts a continuous processing route of "local strip response calculation—seed generation—micro-region expansion—region merging." S1 has already output a standardized texture image. Therefore, this step is directly in The local principal direction is calculated pixel-by-pixel, and the wood grain strip response value is constructed around the local principal direction. The local principal direction is obtained using the classic approach of the gradient local covariance matrix: first in... The horizontal and vertical gradients are calculated, and then the gradient product terms are accumulated in the neighborhood of each pixel to form a local covariance matrix. The eigenvector corresponding to the largest eigenvalue is the principal direction at that position. The principal direction obtained in this way is a local refinement of the structure of the output image of S1. It reflects the actual extension direction of the wood grain strips at the current position, providing a basis for subsequent sampling along the strip direction.

[0024] After obtaining the local principal direction, around each pixel Three discrete sampling lines of equal length are selected: one located at the center line of the main direction, and two located on either side of the center line parallel to the normal direction. The center line describes the continuous variation of the wood grain strips along the extension direction, while the two parallel lines describe the stability of the strip's lateral width and hierarchical relationship. The core quantities here come from a combination of two classic approaches: one is the one-dimensional total variation form, used to measure the smooth fluctuations of the sequence along the direction; the other is the lateral consistency constraint of the strip region, used to ensure stable stratification between the central strip and the normally adjacent region. Based on these two sources, in this step, the one-dimensional total variation along the main direction and the mean constraint of the auxiliary lines on both sides are combined into the wood grain strip seed response value through the response function. The expression of the response function is: ; in, Indicates position The seed response value of the wood grain stripe; Indicates the current pixel in the normalized texture image The coordinates within the image are directly given by the image matrix index; This indicates the discrete length of the sample taken along the local main direction, which is set during the equipment debugging phase based on the typical extension scale of the wood grain stripe on the outer shell of this type of kettle; This indicates the first position obtained from the current position along the local principal direction. Each centerline sampling point has its specific coordinates obtained by superimposing the current position with the distance step size in the main direction; and Relative to The first one obtained after offsetting by a fixed bandwidth on both sides of the normal direction One auxiliary sampling point; , , These sampling points represent the normalized texture image. The pixel values ​​on the screen are all directly derived from the output of S1; The weight of the lateral stability term is set during the equipment debugging phase using qualified sample images. The first term of the formula comes from the discrete form of the one-dimensional total variation, reflecting the strength of fluctuations in the center line pixel sequence along the strip direction; the second term originates from the neighborhood consistency approach in region regularization, used to compare the average hierarchical difference between the center line and the auxiliary lines on both sides of the normal direction. After combining the two, both the left and right sides of the formula represent a weighted accumulation of pixel value differences, maintaining a consistent calculation scale, thus allowing for direct numerical comparison. The derivation logic can be understood as follows: if a wood grain strip is properly formed, the pixel values ​​along the main direction will change smoothly, resulting in a smaller total variation. Simultaneously, a relatively stable hierarchical difference is maintained between the center line and the auxiliary lines on both sides, leading to a smaller second term. Lower; if the current position falls within the flow mark incision zone or local fracture zone, the center line will abruptly change, and the normal layer relationship will also become unstable, causing both terms to increase simultaneously. Increase. Taking a common set of values ​​used in debugging as an example, let... The pixel values ​​of the center line at a certain location are as follows: , , , , , , Then the first item is ; If the pixel values ​​of the auxiliary lines on both sides of the normal direction are respectively and The total mean of the auxiliary lines on both sides is The mean of the center line is ,Pick When, the second item is ,then If another location is within the flow mark disturbance area, the centerline pixel value becomes... , , , , , , Then the first item is If the mean of the auxiliary lines on both sides is still approximately The mean of the center line is The second item is ,but This allows for a clear distinction between stable locations and abrupt structural changes within a strip in the image, enabling the selection of low-response locations as strip seed points and the retention of high-response locations as candidate locations for region boundaries.

[0025] After obtaining the seed points, the system expands around these seed points alternately along the principal direction and the normal direction, forming several initial micro-regions. During expansion, three statistics for each micro-region are recorded: average brightness of the region, principal direction of the region, and normal width of the region. The average brightness of the region is determined by the brightness of all pixels within that region. The average results are given above. The main direction of the region is given by the mode of the local main directions within the region, and the normal width of the region is obtained by averaging the continuous spans measured from multiple representative center points within the region to both sides of the normal direction. Whether adjacent micro-regions are merged depends on their consistency in brightness level, extension direction, and strip width. The merging function used here is derived from the inter-group distance in classical hierarchical clustering and the edge weight approach in graph segmentation. Based on this, the brightness difference, direction difference, and width difference are organized into a weighted cost corresponding to the wood grain stripe pattern. The expression of the merging function is written as follows: ; in, Representing adjacent micro-regions With micro-regions The cost of the merger; This represents the normalized result of the average brightness difference between two micro-regions. The average brightness is determined by the pixel values ​​within each region in the normalized texture image. The average value is obtained from the above. This represents the normalized result of the difference between the principal directions of two micro-regions, where the principal directions are obtained by statistical analysis of the local principal directions within the region. This represents the normalized result of the difference in normal width between two micro-regions. The normal width is obtained by averaging the normal spans of several representative center points within the region. and These represent the weights of the direction and width terms, respectively, set during the equipment debugging phase based on the morphological stability of the wood grain stripes in qualified products. All three terms in this formula have been uniformly normalized; therefore, both the left and right sides represent dimensionless region merging costs, and the three terms can be directly weighted and added together. Its derivation is consistent with the previous seed response value formula: the first formula determines at the pixel level "where is suitable as an internal seed for the same strip, and where it resembles a boundary," while the second formula determines at the region level "which micro-regions should be classified into the same strip, and which micro-regions should maintain their boundaries." In other words, the first formula addresses the continuity within the stripe, and the second formula addresses the structural affiliation between stripes; together, they complete the construction of the texture region map. Taking the actual merging of two sets of adjacent micro-regions as an example, if the micro-regions... With micro-regions The average brightness normalized difference is The normalized difference in the main direction is Normalized difference of normal width is ,Pick , ,but When the system merging threshold is set to At this time, these two micro-regions merge into the same wood grain region. If another pair of micro-regions are located on both sides of the flow mark, the normalized difference in brightness is... Directional normalization difference is The width normalized difference is ,but This value is higher than the threshold, so the boundary is preserved. Through this process, the smooth and stable micro-regions within the strip will naturally merge, while the flow mark incision, local breakage, and abnormal layer jumps will maintain clear boundaries.

[0026] After pixel-by-pixel seed response calculation, seed point generation, micro-region expansion, and region merging, each final region undergoes further refinement to obtain the region skeleton. The longest connected main skeleton length, total skeleton length, region main direction consistency ratio, and normal width sampling sequence are then calculated. Simultaneously, the region average grayscale is calculated from the region pixel set, and the adjacency list and shared boundary length are calculated from the region contact boundaries. Subsequently, the region number, region pixel set, region adjacency list, shared boundary length, region average grayscale, region main direction, main direction consistency ratio, normal width sampling result, skeleton connection result, and the calculated normal width fluctuation coefficient and skeleton integrity ratio are all written into the texture region map. . Each pixel location is assigned a region identifier, derived from the final result of region expansion and merging. Pixels within the same region maintain consistency in stripe direction, brightness level, and horizontal width, while region boundaries correspond to the actual boundaries between wood grain stripes, flow mark entry points, or stripe structure transition points. This results in... It already includes the region structure attributes and adjacency relationships required by S3, and can be directly used for subsequent defect identification.

[0027] S3: Calculate the neighborhood reference grayscale of the texture region map, calculate the defect response value of the neighborhood based on the neighborhood reference grayscale, and classify the neighborhood into anomalies according to a preset threshold range to generate an anomaly status table, specifically including: Texture region map output by S3 from S2 The wood grain unfolds continuously. At this stage, the wood grain surface no longer exists as scattered pixels, but is organized into multiple texture regions with stripe affiliation, adjacency relationships, and morphological attributes. Each region... Each region contains a region ID, region pixel set, region adjacency list, shared boundary length with adjacent regions, region average grayscale, region main direction, main direction consistency ratio, normal width sampling result, and skeleton connection result. This information is generated and written synchronously during the S2 region construction process. Therefore, the identification object of S3 is the structural state of the region itself and the relationship between regions. For products like injection-molded wood grain electric kettle shells, flow marks usually manifest as a narrowing of a section of wood grain strip accompanied by abrupt boundary changes; color difference usually manifests as the overall layer of a certain area deviating from the surrounding wood grain layer; bubble disturbance usually manifests as local boundary bulging and internal instability; and texture breakage manifests as the main skeleton of the strip being truncated and the same wood grain losing spatial continuity. Based on these appearance patterns directly corresponding to the scene, this step adopts a processing method of "first constructing a neighborhood reference, then calculating the regional defect response, and finally generating anomaly records based on the response composition," further transforming the structured region formed by S2 into a current anomaly state table. .

[0028] First, regarding the region Constructing neighborhood reference grayscale The original source of this quantity comes from the weighted neighborhood average formula in graph theory. The basic idea is that neighbors with stronger connections to the current node have a greater reference value for the current node's state. (In the wood grain region graph...) In this context, the strength of the connection between regions is most directly reflected in the length of the shared boundary. A longer shared boundary indicates more spatial contact between the two regions, and the more accurately their hierarchical relationship represents the normal wood grain transition at the current location. Therefore, the classic weighted neighborhood average is rewritten as a neighborhood reference grayscale formula with the shared boundary length as the weight and the average grayscale of adjacent regions as the weighted quantity, resulting in: ; in, Indicates the area The neighborhood reference gray level; Representation and region Adjacent region set, which is composed of texture region map The region adjacency list in the database can be read directly; Indicates the area With the region The length of the shared boundary, which has been counted and stored during the region expansion and region merging phases of S2. ; Indicates adjacent regions The average gray value, which is determined by the region. The pixel set is statistically obtained from the normalized texture image output by S1, and constructed in S2. The region attributes are written in time. The derivation process of this formula from the classic weighted average to this scenario is clear: in the classic weighted average, the weight reflects the degree of contribution of neighbors to the target quantity; in the wood grain region map, the shared boundary length precisely reflects the degree of reference of adjacent regions to the current region hierarchy, therefore, it is used... Replace general weights; the weighted object is replaced by the average gray level of the wood grain region instead of general node attributes. This yields a reference grayscale value suitable for determining the layering of wood grain areas. The numerator represents the cumulative value of grayscale values ​​from all adjacent areas, weighted by spatial contact, while the denominator represents the total contact intensity. Therefore, both sides represent the same type of grayscale value, maintaining a consistent numerical scale. Taking a specific area as an example, if the area... The shared boundary lengths with the three adjacent regions are respectively , , The average gray levels of the three adjacent regions are respectively , , Then there is , ,therefore This value reflects the "weighted hierarchy of the wood grain area most closely related to the current spatial area," which is more consistent with the local reality of the striped distribution of injection-molded wood grain than simply taking the average of the entire map.

[0029] After obtaining the neighborhood reference grayscale, the regional defect response values ​​are then constructed. The original source of this quantity comes from the multi-feature linear discrimination approach, which combines multiple anomalous components with clear physical meanings into a total response value according to weights, used to characterize the degree to which the target deviates from the normal state. For the injection-molded wood grain scenario, this step selects four complementary components: the deviation between the region's average grayscale and the neighboring reference grayscale to characterize color difference; the deviation of the region's main direction consistency ratio to characterize internal direction disorder; the region's normal width fluctuation coefficient to characterize the deformation of the strip being narrowed by flow marks or bulging bubbles; and the deviation of the region's skeleton integrity ratio to characterize texture breakage. Thus, the classic multi-feature linear combination is rewritten into a defect response function suitable for wood grain region defect identification, its expression being: ; in, Indicates the area The defect response value; Indicates the area The average gray value, which is obtained statistically from the set of pixels in region S2 and written into... ; This represents the neighborhood reference gray level calculated by the previous formula; Indicates the area The proportion of pixels whose main direction is consistent with the main direction of the region is obtained by statistically analyzing the proportion of pixels whose local main direction is consistent with the main direction of the region, and recorded as a region attribute in S2. Indicates the area The normal width fluctuation coefficient is calculated from multiple normal width sequences sampled at equal intervals along the main direction of the region. Specifically, it is the result of dividing the difference between the maximum and minimum width values ​​by the average width. This process has been completed and stored in S2. ; Indicates the area The complete skeleton proportion, which is obtained by dividing the length of the longest connected main skeleton in the region skeleton by the total skeleton length, is also written as a region attribute of S2. ; , and These represent the weights of the directional disorder term, width fluctuation term, and skeleton fracture term, respectively, and are entered into the parameter table after joint calibration using qualified samples and typical defective samples during the equipment commissioning phase. The logical relationship between this formula and the previous formula is continuous: the previous formula first calculates the local reference value of the "surrounding normal layer". The current formula then combines the deviation of the current region relative to the reference value, as well as the region's own deviations in direction, width, and skeleton, into a total response value. The first term is directly linked to the neighboring reference grayscale, resolving the distinction between color difference and tonal drift; the latter three terms all originate from the region structural attributes already formed by S2, resolving the distinction between structural disorder, width anomalies, and skeleton breakage. All four terms participate in the combination using normalized or proportionalized region attributes, and therefore can be directly linearly added. Their numerical meaning is also clear: The larger the value, the more severe the deviation from the normal wood grain pattern in that area.

[0030] By combining a set of common data from actual debugging, we can see the calculation process and judgment effect of this formula. Still using the aforementioned area... For example, let's set up a region. Average gray level The neighborhood reference gray level has been calculated using the previous formula. Then the first item is If the proportion of the main directions within the region is consistent Then the second term is At that time If the region normal width fluctuation coefficient Then the third item is At that time If the regional skeleton is complete in proportion Then the fourth item is At that time ; ultimately obtained Let's look at another normal area. If its average gray level... It is obtained from the neighborhood reference gray formula. Then the first item is ;like Then the second term is ;like Then the third item is ;like Then the fourth item is ;final In the same batch of debugging records, the qualified sample area Mostly concentrated arrive The range, while areas with flow marks and localized cracks are usually higher than the range. In several batches of samples collected continuously during the trial production phase, the main increase in the flow mark area, calculated according to this formula, typically comes from... The main increase in color difference areas comes from The cracked area will simultaneously exhibit and The significant decrease in these phenomena is consistent with the results of manual review, so a grading threshold can be set accordingly and regional-level judgments can be stably implemented.

[0031] In the regional response value After the calculation is completed, the system classifies the regions into anomaly levels according to the threshold range determined during the debugging phase, and generates a current anomaly status table. The specific approach is: if a certain area If the value is below the normal threshold, it is considered normal; if it is above the normal threshold, it enters the anomaly detection stage. The anomaly type is determined by the dominant component among the four components. When the proportion of the total response value is the highest, it is recorded as a color difference anomaly; when When the proportion is the highest and the boundary of the region shows a continuous stretching trend, it is recorded as an abnormal flow mark or bubble disturbance; when and When both constitute a significant proportion, it is classified as a texture breakage anomaly. The anomaly level is then determined based on... The threshold range for falling into the anomaly is given, for example, three levels: mild, moderate, and severe. The final output is a table of the current anomaly status. Each record is recorded using a region as the unit, and each record must include at least the region number, region center location, defect response value, anomaly type, anomaly level, and region area percentage. The area code is directly inherited from... The region identifier; the region center position is calculated from the centroid of the region's pixel coordinates; the defect response value is the value obtained in this step. The anomaly type and anomaly level are obtained from the above rules; the area percentage of the region. The result is obtained by dividing the number of pixels in this area by the total number of pixels in the entire wood grain detection area, and is written along with the anomaly record. This is how it was obtained. The wood grain structure region constructed by S2 has been transformed into abnormal state information for online detection and handling. Subsequent steps can be directly based on this information. Perform alarm, log, and intercept actions.

[0032] S4: For each abnormal region in the abnormal status table, calculate its corresponding spatial clustering degree. Based on the spatial clustering degree and the defect response value, calculate the overall abnormality degree of the current injection molded product. Based on the comparison result of the overall abnormality degree with a preset threshold range, generate online detection results, specifically including: S4 uses the current abnormal status table output by S3. Expanding from the input, the wood grain surface of each injection-molded product is now represented as a set of regional anomaly records. Each record in the table includes at least the region number, region center location, and defect response value. Exception type and exception level. Due to the S3... The four types of information—color difference, orientation disorder, width fluctuation, and skeleton breakage—have already been compressed into region-level responses. Therefore, S4 no longer performs repetitive image analysis but focuses on "how to transform region-level anomaly records into online processing results that can be executed on the production line." For products like wood grain injection molded shells, whether the entire product needs an alarm, sample retention, or interception depends not only on the intensity of the anomaly in a particular region but also on whether the anomaly regions are concentrated near the same wood grain strip, whether they have formed a patchy expansion, and whether the total area of ​​the anomaly regions has reached a level that affects the consistency of appearance. Based on this scenario pattern, S4 first... The spatial clustering degree of each abnormal region is calculated, and then the regional defect response value, regional area ratio, and spatial clustering degree are combined to form the overall abnormality degree of the entire product. Finally, online processing results are generated based on the threshold range. And output it to the production line execution unit.

[0033] Spatial clustering The construction of this method originates from the inverse distance weighting approach in pattern recognition and the local clustering description in point pattern analysis. Its basic premise is: if the centers of multiple abnormal regions are close to each other, these anomalies often represent a continuous manifestation of the same molding disturbance on the wood grain strip; if the abnormal regions are scattered, they are more likely to be sporadic disturbances, with a relatively weak impact on the overall appearance consistency. To enable this quantity to be directly used for the overall part determination in S4, the abnormal state table is first... For each anomalous region, its center position is read, and the Euclidean distance between that region and the centers of the other anomalous regions is calculated. The reciprocal mean of these distances is used to characterize the degree of clustering. Euclidean distance originates from the planar point distance formula in analytic geometry, and its reciprocal weighted form comes from the classic inverse distance weighted model. In this step, it is rewritten as a local clustering measure of the proximity between a single anomalous region and the other anomalous regions, expressed as: ; in, Indicates the first Spatial clustering of anomalous regions; This indicates the number of abnormal areas in the current product, which is determined by the abnormal status table. The number of abnormal records can be obtained directly; Indicates the first The center of the first abnormal region and the first The Euclidean distance between the centers of the anomaly regions is calculated by the difference in the coordinates of the two region centers in the plane. The coordinates of the region centers are directly generated by S3. The statistical results show the centroid locations of each anomalous region. The derivation of this formula is clear: the smaller the distance between points in the plane, the closer the two anomalous regions are in space, and the larger its reciprocal term; to avoid the value being too large when the two centers are very close, a constant is added to the denominator. Even so Individual contributions also This ensures computational stability; finally, the average value is calculated for all outlier regions except itself to obtain the region. The degree of local aggregation; when At that time, the current product only has one abnormal area, so it can be directly retrieved. Both the left and right sides of the formula represent a dimensionless clustering weight, which can be directly used as a weighting factor. Taking three abnormal regions of a product as an example, if the center positions of the regions are respectively... , and Then the distance from the first region to the second region is , The distance to the third region is Therefore, the spatial clustering degree of the first region is .

[0034] Similarly, the distance from the second region to the first region remains the same. The distance to the third region is Therefore The third region is far from the first two regions, therefore This shows that the first two spatially close anomalous areas have a higher degree of clustering, while the third distant area has a significantly lower degree of clustering. This is consistent with the actual judgment that patchy wood grain anomalies should be given more attention.

[0035] After obtaining the spatial clustering degree of each abnormal region, the overall abnormality degree of the entire product is further constructed. The initial source of this quantity comes from the weighted summation approach in statistical discrimination: when a whole object is composed of several local anomalies, the overall anomaly level can be obtained by summing the local anomalies according to their influence intensity. In the injection-molded wood grain scenario, the regional defect response value... Characterizing the intensity of anomalies in the region itself, and the proportion of the region's area. This characterizes the proportion of the abnormal area's influence on the overall product's surface area, and its spatial clustering. This indicates whether the anomaly has formed a concentrated, clustered distribution. Based on this, the classic weighted summation form is rewritten as a comprehensive judgment formula that considers the combined effects of "regional response value - area proportion - spatial clustering degree": ; in, This indicates the overall degree of abnormality of the current product; Indicates the first The defect response values ​​for each abnormal region are directly derived from the S3 abnormal status table. Calculation results for each abnormal region in the middle; Indicates the first The area percentage of each abnormal region is obtained by dividing the number of pixels in that region by the total number of pixels in the entire wood grain detection area. This value is already written when S3 summarizes the abnormal records. ; This represents the spatial clustering degree obtained from the previous formula; This represents the spatial aggregation correction coefficient, which is set during the equipment commissioning phase based on the statistical results of qualified samples, slightly abnormal samples, and obviously unqualified samples. It is used to adjust the amplification of the overall judgment by the abnormality of the whole area. This indicates the number of abnormal areas in the current product, consistent with the previous formula. There is a clear logical relationship between this formula and the previous one: the first formula calculates the local spatial clustering degree for each abnormal area; the second formula then uses this clustering degree as a region weight correction term in the calculation of the overall abnormality level of the entire product. In the formula... This reflects a specific improvement for this scenario: when other abnormal areas are clustered around a certain abnormal area, The increase amplifies the contribution of the current region to the overall judgment; when the abnormal region is isolated and scattered, Its size is relatively small, and its impact on the overall product is mainly determined by its own response value and area. Because... , and All are treated as dimensionless quantities in the calculation, therefore the dimensions on both sides remain consistent. Continuing with the example of the three abnormal regions mentioned above, let the defect response values ​​of the three in S3 be respectively... , , The area proportions are respectively , , And take the spatial clustering correction coefficient. Substitute the already calculated , , Then there is Calculations item by item yielded: the first item was... The second item is The third item is Therefore Taking another product as a control, its abnormal areas are only two and are scattered. Let... , , , The distance between their centers is approximately Then their respective aggregation degrees are approximately In the same Down, ,Right now .

[0036] This shows that the former type of product with concentrated abnormal bands has a significantly higher overall degree of abnormality than the latter type of product with only scattered small abnormalities. This is consistent with the actual requirement in the appearance of injection-molded wood grain that "abnormalities in large areas are given priority for being judged as unqualified".

[0037] In terms of overall anomaly After the calculation is completed, the system generates online processing results based on the threshold range established during the debugging phase. The threshold formation process is as follows: during the trial production phase, multiple batches of qualified products, slightly abnormal products, and obviously unqualified products are collected, and the threshold is calculated for each item. The value was recorded, and the conclusion of the manual review was noted; subsequently, the qualified products were counted. The upper limit of the distribution, the middle distribution range of slightly abnormal products, and obviously unqualified products. The distribution has a lower bound, forming a multi-level judgment threshold. During actual operation, if the current product... If it is below the acceptable threshold, it is considered acceptable; if If it falls within the middle range, it is considered suspicious and recording and sampling are performed; if If the value exceeds the non-compliance threshold, it is deemed non-compliant, triggering an audible and visual alarm and simultaneously sending an interception signal to the sorting mechanism. The output is the online processing result. At least include the product number, the judgment result, and the overall degree of abnormality. The system includes a set of abnormal area numbers and alarm or interception indicators. The product number is provided by the serial number recorded synchronously at the testing station when the image is triggered; the judgment result is determined by… The result is obtained by comparing with a threshold; the overall anomaly level is the calculation result of this step; the set of anomaly region numbers comes directly from... The abnormal records in the system; alarm or interception flags are mapped from the judgment results to PLC control commands. In actual operation, the industrial control computer calculates... and form Then, the results are sent to the PLC in the form of communication messages or digital outputs. The PLC then drives the audible and visual alarm, the inkjet marking unit, or the sorting cylinder to perform corresponding actions, thus completing the closed loop from regional abnormal status to online handling on the production line.

[0038] refer to Figure 2 As shown, to achieve the above objectives, another aspect of this application embodiment proposes an online detection system for wood grain texture of injection molded products based on machine vision, including: A standardized texture image construction module is used to extract high-contrast contours from the original image, correct a preset cropping box based on the high-contrast contours, extract a wood grain detection region image based on the corrected preset cropping box, input the wood grain detection region image into a convolutional network to extract a direction response map, perform pixel enhancement on the wood grain detection region image based on the direction response map, where each pixel position in the direction response map corresponds to a main direction, the most frequent main direction is taken as the main direction of the whole image, and a standardized texture image is constructed based on the main direction of the whole image and the pixel-enhanced wood grain detection region image. The wood grain texture region map construction module is used to calculate the local principal direction pixel by pixel in the standardized texture image, calculate the wood grain strip seed response value at each pixel position based on the local principal direction, construct strip seed points based on the wood grain strip seed response values, construct an initial micro-region based on the strip seed points, and merge the initial micro-region with adjacent regions by comparing the calculated merging cost with a preset threshold to construct the final region. The module then performs a thinning process on the final region to generate a texture region map. An abnormal state identification module is used to calculate the neighborhood reference grayscale of the texture region map, calculate the defect response value of the neighborhood based on the neighborhood reference grayscale, and classify the neighborhood into anomalies by combining a preset threshold range to generate an abnormal state table. The anomaly detection and handling module is used to calculate the spatial clustering degree of each abnormal area in the anomaly status table, calculate the comprehensive anomaly degree of the current injection molded product based on the spatial clustering degree and the defect response value, and generate online detection results based on the comparison result of the comprehensive anomaly degree with the preset threshold range.

[0039] The above embodiments are merely descriptions of preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Various modifications and improvements made by those skilled in the art to the technical solutions of the present invention without departing from the spirit of the present invention should fall within the protection scope defined by the claims of the present invention.

Claims

1. A machine vision-based online detection method for wood grain texture in injection molded products, characterized in that, include: High-contrast contours are extracted from the original image. Preset cropping boxes are corrected based on the high-contrast contours. Wood grain detection region images are extracted based on the corrected preset cropping boxes. The wood grain detection region images are input into a convolutional network to extract orientation response maps. Pixel enhancement is performed on the wood grain detection region images based on the orientation response maps. Each pixel position in the orientation response map corresponds to a main direction. The main direction with the highest frequency is taken as the main direction of the whole image. A standardized texture image is constructed based on the main direction of the whole image and the pixel-enhanced wood grain detection region images. For the standardized texture image, the local principal direction is calculated pixel by pixel. Based on the local principal direction, the wood grain strip seed response value at each pixel position is calculated. Strip seed points are constructed based on the wood grain strip seed response values. Initial micro-regions are constructed based on the strip seed points. By comparing the merging cost with a preset threshold, the initial micro-regions are merged with adjacent regions to construct the final region. The final region is then refined to generate a texture region map. Calculate the neighborhood reference grayscale of the texture region map, calculate the defect response value of the neighborhood based on the neighborhood reference grayscale, and classify the neighborhood into anomalies by combining a preset threshold range to generate an anomaly status table. For each abnormal region in the abnormal status table, its corresponding spatial clustering degree is calculated. Based on the spatial clustering degree and the defect response value, the overall abnormality degree of the current injection molded product is calculated. Based on the comparison result of the overall abnormality degree with the preset threshold range, an online detection result is generated.

2. The online detection method for wood grain texture of injection molded products based on machine vision according to claim 1, characterized in that, The pixel enhancement of the wood grain detection region image based on the directional response map specifically includes: For each pixel position in the directional response map, the average value of its corresponding main direction neighborhood is calculated using a mean function; Based on the average value of the neighborhood along the main direction, the enhanced pixel value of each pixel position is calculated using the enhancement function.

3. The online detection method for wood grain texture of injection molded products based on machine vision according to claim 1, characterized in that, The construction of a standardized texture image based on the main direction of the entire image and the enhanced pixel values ​​specifically includes: The rotational deviation of the wood grain detection area image is obtained by comparing the main direction of the entire image with the standard reference direction pre-recorded during the equipment debugging phase. Based on the rotation deviation, the wood grain detection area map after pixel enhancement is rotated and corrected, and then the rotated wood grain detection area map is normalized to finally output a standardized texture image.

4. The online detection method for wood grain texture of injection molded products based on machine vision according to claim 1, characterized in that, The step of calculating the local principal direction pixel-by-pixel on the standardized texture image specifically includes: Calculate the gradients in the horizontal and vertical directions in the standardized texture image; Then, the gradient is accumulated in the neighborhood of each pixel location to form a local covariance matrix; The eigenvector corresponding to the largest eigenvalue of the local covariance matrix is ​​defined as the local principal direction of the pixel position.

5. The online detection method for wood grain texture of injection molded products based on machine vision according to claim 1, characterized in that, The step of extracting high-contrast contours from the original image and modifying the preset cropping box based on the high-contrast contours specifically includes: Extract high-contrast contours of the top and side edges from the original image; The preset cropping frame is corrected based on the intersection position of the high-contrast contours.

6. The online detection method for wood grain texture of injection molded products based on machine vision according to claim 1, characterized in that, The step of refining the final region to generate a texture region map specifically includes: Obtain the region skeleton of each final region, and calculate the longest connected main skeleton length, total skeleton length, region main direction consistency ratio, and normal width sampling sequence of the region skeleton; The average gray level of a region is calculated from the set of pixels in that region, and the adjacency list and shared boundary length are calculated from the region's contact boundary. A texture region map is constructed based on the longest connected main skeleton length, total skeleton length, region main direction consistency ratio, normal width sampling sequence, region average gray level, adjacency list, and shared boundary length.

7. The online detection method for wood grain texture of injection molded products based on machine vision according to claim 1, characterized in that, The wood grain strip seed response value is generated by calculating a response function. The parameters of the response function include the pixel position of the current pixel in the normalized texture image, the discrete length of sampling along the local principal direction, the center line sampling point, the auxiliary sampling point, the pixel value of the center line sampling point, and the pixel value of the auxiliary sampling point.

8. The online detection method for wood grain texture of injection molded products based on machine vision according to claim 1, characterized in that, The merging cost is generated by calculating a cost function, the parameters of which include the normalized result of the average brightness difference between two adjacent micro-regions, the normalized result of the main direction difference between two adjacent micro-regions, the normalized result of the normal width difference between two adjacent micro-regions, the weight of the direction term, and the weight of the width term.

9. The online detection method for wood grain texture of injection molded products based on machine vision according to claim 1, characterized in that, The defect response value is generated by calculating the defect response function, the parameters of which include the average gray value of the defect region, the neighborhood reference gray value, the consistency ratio of the main direction of the region, the width fluctuation coefficient of the region, the integrity ratio of the skeleton of the region, the weights of the direction disorder term, the width fluctuation term and the skeleton fracture term.

10. A machine vision-based online detection method and system for wood grain texture of injection molded products, characterized in that, include: A standardized texture image construction module is used to extract high-contrast contours from the original image, correct a preset cropping box based on the high-contrast contours, extract a wood grain detection region image based on the corrected preset cropping box, input the wood grain detection region image into a convolutional network to extract a direction response map, perform pixel enhancement on the wood grain detection region image based on the direction response map, where each pixel position in the direction response map corresponds to a main direction, the most frequent main direction is taken as the main direction of the whole image, and a standardized texture image is constructed based on the main direction of the whole image and the pixel-enhanced wood grain detection region image. The wood grain texture region map construction module is used to calculate the local principal direction pixel by pixel in the standardized texture image, calculate the wood grain strip seed response value at each pixel position based on the local principal direction, construct strip seed points based on the wood grain strip seed response values, construct an initial micro-region based on the strip seed points, and merge the initial micro-region with adjacent regions by comparing the calculated merging cost with a preset threshold to construct the final region. The module then performs a thinning process on the final region to generate a texture region map. An abnormal state identification module is used to calculate the neighborhood reference grayscale of the texture region map, calculate the defect response value of the neighborhood based on the neighborhood reference grayscale, and classify the neighborhood into anomalies by combining a preset threshold range to generate an abnormal state table. The anomaly detection and handling module is used to calculate the spatial clustering degree of each abnormal area in the anomaly status table, calculate the comprehensive anomaly degree of the current injection molded product based on the spatial clustering degree and the defect response value, and generate online detection results based on the comparison result of the comprehensive anomaly degree with the preset threshold range.