Image contour extraction and cutting method and device, equipment and medium

By real-time image acquisition, background removal, edge detection and vectorization processing, generating cutting paths and performing cutting operations, the problem of insufficient dependence, operation complexity and flexibility of image cutting in the prior art is solved, and dynamic and accurate image cutting is achieved.

CN119963588APending Publication Date: 2025-05-09环盛智能(深圳)有限公司
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510064663.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-15
Publication Date
2025-05-09

AI Technical Summary

Technical Problem

The prior art has problems in relying on pre-designed still image data, complex operations, lack of automation and flexibility in image cutting, and cannot meet user customization and dynamic cutting needs.

Method used

By setting the shooting device at the target position, placing reference marks to determine the pixel density reference parameters, collecting images of the target object and background area, removing the background based on the background color, performing edge detection and vectorization processing, generating a cutting path, and sending it to the cutting device to perform.

Benefits of technology

It realizes dynamic and accurate target object cutting, simplifies user operation process, improves cutting efficiency and accuracy, meets the user's needs for customized image cutting, and adapts to efficient applications in mobile devices or portable scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119963588A_ABST
    Figure CN119963588A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image processing and automatic cutting, and discloses an image contour extraction and cutting method, which comprises the following steps of: setting shooting equipment at a target position, placing an actual length reference mark, shooting a reference mark image through the shooting equipment, measuring the number of pixels and determining a pixel density reference parameter; collecting an image containing the target object and the background area through the shooting equipment; identifying a to-be-replaced pixel matched with the background color based on the background color, replacing the to-be-replaced pixel with a transparent pixel, and generating a processed image after the background is eliminated; performing edge detection on the processed image, extracting contour information of a target object, generating a vector contour file of an actual size in combination with a pixel density reference parameter, and generating a cutting path; and the cutting path is sent to the cutting device, and cutting operation of the target object is completed. According to the method, the image of the target object is collected in real time, the vector contour file of the actual size is generated in combination with the pixel density reference parameters, and dynamic and accurate target object cutting is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computer graphics processing, and in particular to an image contour extraction and cutting method, device, equipment and storage medium. Background Art

[0002] In traditional film cutting machine operation, users usually need to cut according to the existing image data in the pre-prepared content list. This method is highly dependent on image data. It not only requires users to complete the design and editing of images in advance, but also places high demands on the operation process of the equipment, increasing the complexity of operation. In addition, this method cannot meet the user's needs for customized image cutting, especially in rapidly changing scenarios, and cannot achieve dynamic adjustment, making it difficult to adapt to the user's diverse and real-time cutting needs.

[0003] In the prior art, some cutting devices have begun to introduce image processing functions, but these functions are mainly focused on processing static images and cannot directly cut images collected by users in real time. Users need to manually select or draw the target area, which not only increases the operation steps, but also places higher requirements on the user's operating skills. This manual interaction method is prone to operational errors and shows obvious limitations in application scenarios that require instant feedback.

[0004] Especially in mobile devices or portable scenarios, due to the limitations of device performance and user operating conditions, traditional film cutting machine technology is difficult to provide fast and efficient cutting solutions. These shortcomings make traditional film cutting machines have significant shortcomings in user experience, efficiency improvement and ease of interaction, and cannot meet users' needs for efficient image cutting in complex and dynamic environments.

[0005] In general, the existing technology has a lot of room for improvement in cutting accuracy, ability to meet user customized needs, and real-time feedback capabilities. There is an urgent need for a new cutting technology that can combine real-time image processing, automatic contour extraction, and simplified user operations to solve these problems. Summary of the invention

[0006] The main purpose of the present invention is to provide an image contour extraction and cutting method, device, equipment and storage medium, aiming to solve the technical problems in the prior art that the film cutting machine relies on pre-designed static image data, cannot meet the user's needs for customized cutting based on real-time captured target object images, and is complex to operate and lacks automation and flexibility.

[0007] To achieve the above object, the present invention provides an image contour extraction and cutting method, comprising:

[0008] Set up the camera at the target location;

[0009] Placing a reference mark of known actual length, capturing an image of the reference mark by the capturing device and measuring the corresponding number of pixels, and determining a pixel density reference parameter according to the actual length and the number of pixels;

[0010] Placing a background plate at the target position and placing the target object on the background plate;

[0011] Acquire the image to be processed including the target object and the background area by the shooting device;

[0012] Based on the background color of the background plate, identifying pixels to be replaced in the image to be processed that match the background color, and replacing the pixels to be replaced with transparent pixels, so as to generate a processed image that only contains the target object after the background is removed;

[0013] Performing edge detection on the processed image, extracting contour information of the target object, converting the contour information into a vector contour file of actual size in combination with the pixel density reference parameter, and generating a cutting path;

[0014] The cutting path is sent to a cutting device, and the cutting device performs a cutting operation on the target object according to the cutting path.

[0015] Furthermore, to achieve the above-mentioned purpose, the present invention provides an image contour extraction and cutting device, comprising:

[0016] A shooting device setting module is used to set the shooting device at a target position;

[0017] a pixel density calculation module, used for placing a reference mark of known actual length, capturing an image of the reference mark by the capturing device and measuring the corresponding number of pixels, and determining a pixel density reference parameter according to the actual length and the number of pixels;

[0018] An object placement module is used to place a background plate at the target position and place the target object on the background plate;

[0019] An image acquisition module, used for acquiring an image to be processed including a target object and a background area through the shooting device;

[0020] A background removal module is used to identify the pixels to be replaced that match the background color in the image to be processed based on the background color of the background plate, and replace the pixels to be replaced with transparent pixels to generate a processed image that only contains the target object after the background is removed;

[0021] A contour extraction and vectorization module, used to perform edge detection on the processed image, extract contour information of the target object, convert the contour information into a vector contour file of actual size in combination with the pixel density reference parameter, and generate a cutting path;

[0022] The cutting execution module is used to send the cutting path to the cutting device, and the cutting device performs a cutting operation on the target object according to the cutting path.

[0023] Furthermore, to achieve the above-mentioned purpose, the present invention also provides a computer device, which includes a memory, a processor, and an image contour extraction and cutting program stored in the memory and executable on the processor, wherein the image contour extraction and cutting program, when executed by the processor, implements the steps of the image contour extraction and cutting method as described above.

[0024] Furthermore, to achieve the above objectives, the present invention also provides a computer-readable storage medium, on which an image contour extraction and cutting program is stored, and when the image contour extraction and cutting program is executed by a processor, the steps of the image contour extraction and cutting method described above are implemented.

[0025] Beneficial effects: The present invention relates to the field of image processing and automated cutting technology, and discloses an image contour extraction and cutting method, which comprises setting a shooting device at a target position, placing an actual length reference mark, shooting a reference mark image by the shooting device and measuring the number of pixels, and determining a pixel density reference parameter; placing a background plate and a target object at a target position, and collecting an image containing the target object and the background area by the shooting device; identifying pixels to be replaced that match the background color based on the background color, and replacing them with transparent pixels, and generating a processed image after the background is eliminated; edge detection is performed on the processed image, and the target object contour information is extracted, and a vector contour file of the actual size is generated in combination with the pixel density reference parameter, and a cutting path is generated; the cutting path is sent to a cutting device to complete the cutting operation of the target object. The present invention realizes dynamic and accurate cutting of the target object by collecting the image of the target object in real time and generating a vector contour file of the actual size in combination with the pixel density reference parameter; through automatic background removal, edge detection and cutting path optimization, the user operation process is simplified, the cutting efficiency and accuracy are improved, the user's customized image cutting needs are met, and it can adapt to efficient applications in mobile devices or portable scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] The present invention will be further described below with reference to the accompanying drawings and embodiments, in which:

[0027] Figure 1 A schematic diagram of an application environment of an image contour extraction and cutting method in an embodiment of the present invention;

[0028] Figure 2 A schematic diagram of a flow chart of an embodiment of an image contour extraction and cutting method of the present invention;

[0029] Figure 3 A schematic diagram of functional modules of a preferred embodiment of the image contour extraction and cutting device of the present invention;

[0030] Figure 4 A schematic diagram of the structure of a computer device in one embodiment of the present invention;

[0031] Figure 5 FIG. 4 is another schematic diagram of the structure of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION

[0032] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0033] The image contour extraction and cutting method provided by the embodiment of the present invention can be applied in the following aspects: Figure 1 In the application environment, the user end communicates with the server end through the network. The server end can set the shooting device at the target position through the user end, place the actual length reference mark, shoot the reference mark image through the shooting device and measure the number of pixels, and determine the pixel density reference parameter; place the background plate and the target object at the target position, and collect the image containing the target object and the background area through the shooting device; identify the pixels to be replaced that match the background color based on the background color, and replace them with transparent pixels to generate a processed image after the background is eliminated; perform edge detection on the processed image, extract the contour information of the target object, and generate a vector contour file of the actual size and a cutting path in combination with the pixel density reference parameter; send the cutting path to the cutting device to complete the cutting operation of the target object. The present invention realizes dynamic and accurate cutting of the target object by real-time acquisition of the image of the target object and generating a vector contour file of the actual size in combination with the pixel density reference parameter; through automatic background removal, edge detection and cutting path optimization, the user operation process is simplified, the cutting efficiency and accuracy are improved, the user's customized image cutting needs are met, and it can adapt to efficient applications in mobile devices or portable scenarios. Among them, the user end can be but not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices. The server side can be implemented by an independent server or a server cluster composed of multiple servers. The present invention is described in detail below through specific embodiments.

[0034] See also Figure 2 , Figure 2This is a flow chart of an embodiment of the image contour extraction and cutting method provided by the present invention. It should be noted that although the logical order is shown in the flow chart, in some cases, the steps shown or described may be performed in a different order than that here.

[0035] like Figure 2 As shown, the image contour extraction and cutting method proposed by the present invention includes the following steps:

[0036] S10, setting the shooting device at the target location;

[0037] In this embodiment, the shooting device needs to be firmly mounted on the support device to ensure that the device is fixed in position and does not shift during shooting. The selection of the support device needs to consider the weight and size of the shooting device, and should also have the function of adjusting the height and angle.

[0038] Use a stable tripod, cantilever bracket or other suitable support device to install the camera in its fixed slot. The camera is fixedly connected to the support device through a standard interface (such as a threaded interface or a snap-on interface) to ensure that the device is firmly installed. Check whether the support device is stable to avoid displacement of the device due to vibration or external force.

[0039] Move the installed camera to the target position, which refers to the ideal position directly above the background plate or other shooting areas, to ensure that the camera can cover the entire range of the background plate.

[0040] Manually or automatically move the camera to the target location using a movable base (such as a pulley or track) on the support. If there is no pulley, the device can be moved manually by adjusting the position of the bracket. After reaching the target location, lock the base of the support or fix the feet to prevent the device from moving.

[0041] Adjust the lens of the shooting device so that the optical axis of the lens is vertically aligned with the center of the background plate. Vertical alignment of the optical axis can avoid distortion of the captured image and ensure the accuracy of subsequent image processing.

[0042] Adjust the pitch adjustment lever on the support device to adjust the lens angle of the camera so that the lens plane is vertically downward. Use a laser aligner, a level, or the real-time preview function of the camera to adjust the lens position to ensure that its optical axis is aligned with the center of the background plate. After confirming the optical axis angle, lock the pitch adjustment lever of the camera to fix the angle.

[0043] The camera needs to be set to a fixed resolution to ensure the clarity and accuracy of the captured image. The resolution should be selected in accordance with the size of the target object and the requirements for subsequent processing. Open the settings interface of the camera and select a fixed resolution (such as 1920×1080 or higher). Make sure that the resolution matches the size of the background board to avoid too high a resolution causing an increased data processing burden, or too low a resolution causing a blurred image. Preview the captured image to check whether the resolution is clear enough to meet the requirements for subsequent processing.

[0044] The camera is a key hardware component used to capture images containing the target object and background area, providing high-quality input for subsequent background removal, contour extraction, and cutting path generation. The performance of the camera directly affects the accuracy and effect of the entire method. The specifications of the camera can include:

[0045] Camera resolution: The main camera has a resolution of 5 megapixels, ensuring the acquisition of high-definition images and meeting the accuracy requirements for target object contour extraction.

[0046] Shooting range and focus mode: Supports A4-size shooting range, suitable for common target object sizes. The focus mode is fixed focus, avoiding the delay or focus shift problem that may be caused by auto focus.

[0047] Image acquisition speed: Supports a frame rate of 10fps, which can efficiently acquire continuous images and provide support for dynamic shooting. A single shot takes 1 second, quickly completing the acquisition of static targets.

[0048] Image format and compatibility: Supports multiple static image formats (such as JPG, TIF, BMP, PNG) and video formats (such as AVI, WMV) to improve device compatibility and application flexibility.

[0049] Sensor type: CMOS sensor with high sensitivity and low noise characteristics to ensure the quality of captured images.

[0050] Light source support: Equipped with LED light source to provide natural light conditions and reduce the impact of ambient light changes on image acquisition.

[0051] Image control function: Provides brightness, exposure, and contrast adjustment functions, allowing users to adjust image quality according to actual environment.

[0052] Connection and power supply: Use USB2.0 interface for data transmission and device connection, support USB 5V power supply, and simplify device configuration.

[0053] By setting the camera at the target position, ensuring the camera is stable, the lens is aligned, and the resolution is adapted, a precise foundation is provided for subsequent image acquisition and processing. By fixing and adjusting the equipment, the error in the shooting process is reduced, and the accuracy of background removal and contour extraction is improved.

[0054] S20, placing a reference mark of known actual length, capturing an image of the reference mark by the capturing device and measuring the corresponding number of pixels, and determining a pixel density reference parameter according to the actual length and the number of pixels;

[0055] In this embodiment, the reference mark is a physical ruler with a known actual length, which is used for calculating the ratio between the actual length and the number of pixels in the captured image. The reference mark needs to be placed within the shooting range of the target position and maintain the same horizontal plane as the target object and the background plate to ensure the accuracy of the ratio calculation.

[0056] Choose a standard ruler with clear scale or other object with known actual length (such as a 30cm ruler). Place the reference mark in the center or edge of the background board where it is easy to shoot, and make sure the length direction of the mark is parallel to the horizontal plane of the background board. Use a fixing device (such as tape) to stabilize the mark to prevent it from moving during shooting.

[0057] The shooting device needs to capture images containing reference marks to record the pixel number information of the reference marks. When shooting, it is necessary to ensure that the reference marks are clearly visible without distortion or occlusion.

[0058] Adjust the height of the camera so that the reference mark is completely within the field of view of the camera. Start the camera and capture an image containing the reference mark. Use the real-time preview function to confirm that the scale of the reference mark in the image is clear and not obstructed.

[0059] Measuring the number of pixels of the reference mark in the captured image is used to calculate the pixel density reference parameter, that is, the number of pixels per unit length. Accurately measuring the pixel length of the reference mark is the basis for subsequent calculations.

[0060] Import the captured reference marker image into the image processing module. Use image processing algorithms (such as edge detection or ruler recognition algorithms) to mark the pixel positions of the start and end points of the reference marker in the image. Calculate the pixel length of the reference marker in the image, for example, the distance from pixel A to pixel B is 2553 pixels.

[0061] The pixel density reference parameter is the ratio of actual length to number of pixels and is used to convert the pixel size in the image to the actual size of the target object. It is calculated by dividing the actual length of the reference mark by the measured number of pixels.

[0062] Use the actual length of the known reference marker (e.g. 30cm) to calculate the pixel density reference parameter using the formula:

[0063] Pixel density reference parameter = actual length (mm) / number of pixels

[0064] For example, the actual length of the reference mark is 300 mm, and the corresponding number of pixels is 2553. The pixel density reference parameter is:

[0065] Pixel density reference parameter = 300 / 2553≈0.1175mm / pixel

[0066] The calculation results are stored as reference parameters for subsequent target object size conversion.

[0067] By placing reference markers of known actual length and measuring their number of pixels, the pixel density reference parameters are accurately calculated, and the conversion between pixel size and actual size is realized. This provides a basis for the subsequent calculation of the actual size of the target object, improves the accuracy of size measurement, and avoids errors caused by manual estimation.

[0068] S30, placing a background plate at the target position, and placing the target object on the background plate;

[0069] In this embodiment, the background plate is a key component for enhancing the color contrast between the target object and the background area, and its main function is to provide a clear boundary contrast for the subsequent background removal operation. The material, color and size of the background plate must meet the shooting requirements, especially to form a clear contrast with the color of the target object.

[0070] Background board selection:

[0071] Material: Choose a material with low reflectivity and a smooth surface (such as matte plastic or rubber) to avoid noise in the captured image due to light reflection.

[0072] Color: Give priority to choosing a single, uniform background color that is significantly different from the target object, such as a black background for shooting light-colored targets.

[0073] Size: The background plate needs to cover the target object and extend beyond its borders to ensure that the target object is completely within the background plate.

[0074] Background board placement: Place the background board directly below the camera, consistent with the shooting field of view; the background board needs to be kept flat and fixed with a support device to avoid image distortion due to tilt; ensure that the background board is consistent with the target position and fully covers the field of view in the real-time preview of the camera.

[0075] The target object is the core area of ​​image acquisition, and its placement directly affects the accuracy of background removal and contour extraction. The target object needs to be placed in the center of the background plate to avoid blocking the border of the background plate and ensure that it fits the background plate.

[0076] Position adjustment: Use a marking tool to mark the shooting center position on the background board (such as a crosshair or dot marker); place the target object at the marked center position and adjust its angle according to the preview to keep it level.

[0077] Fix the target object: For lightweight targets, use non-reflective tape to gently fix them to the background board to ensure that they will not move during shooting; for high-volume or irregular-shaped targets, use a weighting device (such as a small clamp) to fix them.

[0078] Avoid occlusion: Ensure that the background area around the target object is not blocked by other objects (such as light sources or supporting devices); ensure that the integrity of the target object is clearly visible in the field of view of the shooting equipment.

[0079] By placing a background plate at the target position and placing the target object on the background plate, the contrast between the target object and the background area is significantly improved, providing reliable boundary clarity for subsequent background removal operations. At the same time, the precise placement of the target object ensures the integrity and accuracy of the target object in the image, improving the accuracy of subsequent contour extraction and path generation.

[0080] S40, collecting an image to be processed including a target object and a background area by the shooting device;

[0081] In this embodiment, the image to be processed is the original input data containing the target object and the background area collected by the shooting device, which is the starting point of the entire image processing and cutting process. The quality of the image (such as clarity, resolution and color accuracy) directly affects the effect of subsequent background removal, contour extraction and path generation.

[0082] Configuration of the shooting device: Set a fixed resolution (such as 5 million pixels) to ensure clear details of the image; adjust the exposure, brightness and contrast of the shooting device to ensure that the details of the target object and the background area are clearly presented.

[0083] Field of view coverage check: Use the real-time preview function of the camera to confirm that the target object and background area are completely within the field of view; check whether the edge of the target object is blurred due to lens distortion, occlusion or light reflection.

[0084] Capture images: Start the camera to capture images of the target object and background area; use trigger mode (manual or automatic) to capture images and ensure shooting stability.

[0085] The collected images to be processed must meet certain quality requirements, including resolution, color contrast, and distortion-free characteristics, to ensure the accuracy of subsequent image processing.

[0086] Resolution setting: Select an appropriate image resolution (such as 2592×1944 pixels) based on the size and detail requirements of the target object. The resolution setting should take into account both image accuracy and processing efficiency to avoid excessively high resolution that results in extended processing time.

[0087] Light adjustment: Use LED light sources to provide uniform illumination, avoiding image noise caused by insufficient or uneven lighting; avoid overexposure or reflected light that interferes with the details of the target object.

[0088] Stability guarantee: The shooting equipment is installed on a stable support device to avoid vibration and blurry images; use a timer or remote control to trigger shooting to reduce equipment shaking caused by manual operation.

[0089] The collected image to be processed must include the complete target object and background area, and there must be sufficient color or brightness contrast between the edge of the target object and the background area.

[0090] Background plate check: Ensure that the background plate is uniform in color and has no stains or reflective areas; confirm that the contrast between the target object and the background area is high enough for the effectiveness of the subsequent background removal operation.

[0091] Shooting angle of view: Adjust the height and angle of the shooting device to ensure that the target object and background area are completely covered within the image range; avoid the edge of the target object overlapping with the boundary of the background board to improve the processing accuracy of the image edge.

[0092] Example description:

[0093] Assume that you need to shoot a target object of 20×20cm:

[0094] The target object was placed on a black background board with a size of 30×30 cm.

[0095] Adjust the height of the camera so that the target object and the background plate are fully displayed in the real-time preview.

[0096] Set the capture resolution to 2592 × 1944 pixels and enable the LED light source to evenly illuminate the target object and background area.

[0097] Click the Capture button to acquire and save a high-quality image that includes the target object and background area.

[0098] By capturing the image to be processed containing the target object and the background area through the shooting device, it can ensure that the image has the characteristics of high resolution, clear edges and high contrast, providing high-quality raw data input for subsequent background removal and contour extraction. At the same time, it ensures the integrity of the target object and the background area, and improves the accuracy of image processing.

[0099] S50, based on the background color of the background plate, identifying pixels to be replaced in the image to be processed that match the background color, and replacing the pixels to be replaced with transparent pixels, to generate a processed image that only contains the target object after the background is removed;

[0100] In this embodiment, the background color is a key attribute for distinguishing the background area from the target object. The color information of the background plate is collected as a reference value to identify pixels matching the background color in the image to be processed.

[0101] The background color needs to be in sharp contrast with the color of the target object, which is the key condition for achieving efficient background removal. By selecting the appropriate background plate color and adjusting the camera settings, the recognition efficiency of the background area can be significantly improved, and the clarity of the target object boundary can be improved.

[0102] Background color selection: In order to facilitate the algorithm to accurately identify the background area, the background should be a single and uniform color. For example, a dark target object should use a light background (such as white or light gray), while a light target object should choose a dark background (such as black). The color of the background should avoid using a color close to the color of the target object to reduce the possibility of mislabeling.

[0103] Light environment optimization:

[0104] Lighting uniformity: Make sure the background and target object are evenly illuminated during the shot to avoid distracting shadows or reflections.

[0105] Light adjustment: In actual shooting, LED light sources can be used to provide stable fill light to reduce the impact of ambient light changes on background color.

[0106] In some special scenarios, when the difference between the background color and the target object color is insufficient, the following technical means can be used to supplement it:

[0107] Adjust color tolerance value: Dynamically adjust the tolerance range of color matching to accommodate subtle changes in the background color while avoiding mislabeling of target objects due to excessive range.

[0108] Introducing other image features: In addition to color information, texture features or brightness distribution can be combined to identify background areas, thereby improving recognition accuracy.

[0109] Use contrast enhancement measures: Cover the target object with an occlusion with significant color contrast (such as a contrasting color identification card), and then use an algorithm to exclude the occlusion area after shooting.

[0110] Sample eight pixels from the four corners and the middle of the four edges of the image to be processed, and record their color values. Determine the background color reference by calculating the color average of the sampled pixels.

[0111] Set the color matching tolerance to accommodate slight changes in background color (such as lighting changes or uneven background material).

[0112] By comparing the color value of each pixel in the image to be processed with the background color reference value, the pixels matching the background color are marked as pixels to be replaced.

[0113] Traverse each pixel in the image to be processed and calculate the difference between its color value and the background color reference. If the difference value is less than the color tolerance, mark the pixel as a pixel to be replaced. Mark all pixels to be replaced as "background area" and other pixels as "target area".

[0114] The marked pixels to be replaced are replaced with transparent pixels, the background area is removed from the image, and only the target object is retained.

[0115] Change the color value of the pixel to be replaced to a transparent pixel value (such as setting the Alpha channel in the RGBA value to 0). The replacement operation can be performed row by row to improve processing efficiency.

[0116] Use the Flood-Fill algorithm to expand from the marked pixels to the surrounding areas to ensure complete replacement of the background area.

[0117] After the background replacement is completed, a semi-transparent image containing only the target object is generated to provide input for subsequent contour extraction and path generation. Check whether there are still non-transparent background pixels in the processed image to ensure that the background is completely removed. Save the processed image in a file format with a transparent channel (such as PNG) to retain transparent pixel information.

[0118] Example description:

[0119] In a practical operation:

[0120] The background plate is black and the target object is a white plastic part.

[0121] A background color reference is collected from the captured image to be processed, and the background color is determined to be pure black (RGB value is 0,0,0).

[0122] Set the Color Tolerance value to 10 to match the background color deviation caused by lighting.

[0123] Traverse the image pixels and mark the pixels that match the background color as pixels to be replaced.

[0124] Replace the pixels to be replaced with transparent pixels and expand the replacement area by flood filling.

[0125] The final result is a semi-transparent image containing only the white target object, and the background area is completely transparent.

[0126] By identifying and replacing the background area in the image to be processed based on the background color, a processed image containing only the target object is generated, which can significantly improve the boundary clarity of the target object and provide high-quality input for subsequent contour extraction and path generation. In addition, automated background removal reduces manual intervention and improves operational efficiency and consistency.

[0127] S60, performing edge detection on the processed image, extracting contour information of the target object, converting the contour information into a vector contour file of actual size in combination with the pixel density reference parameter, and generating a cutting path;

[0128] In this embodiment, edge detection is a key step in extracting the contour information of the target object, and is used to identify the boundary between the target object and the background area. The preliminary contour of the target object is generated by detecting the position where the brightness or color changes significantly in the image.

[0129] Process the processed image using common edge detection algorithms (such as Canny, Sobel, or Laplacian) to extract the boundaries of the target object. Before edge detection, Gaussian blur the image to remove noise and smooth the edges. Exclude small spots on the background or blemishes on the target object and retain the main boundaries. After detecting the edges, close the broken boundaries through image processing methods (such as contour tracking or morphological operations) to generate a complete outline of the target object.

[0130] By combining the previously calculated pixel density reference parameters, the contour information in the image (in pixels) is converted into contour information of actual size to ensure the accuracy of the subsequent cutting path.

[0131] Get each pixel path point of the target object's outline and convert it to actual size path points based on the pixel density reference parameter. For example, assuming the pixel density is 0.1175mm / pixel and the path point spacing is 10 pixels, the actual path point spacing is 1.175mm. Ensure that the path points are continuous without breakpoints to avoid missing outlines due to pixel conversion.

[0132] Format the actual size path data into a vector file format (such as SVG) to facilitate subsequent cutting path optimization and execution. Call a vectorization tool (such as the Potrace library) to convert the contour path into vector data, including the start point, end point, and geometric shape description. During the vectorization process, remove redundant path points and smooth the path curve to improve the accuracy and simplicity of the file. Save the generated vector data as an SVG file and record the path width, height and other dimensional information.

[0133] Based on the path information of the vector contour file, a cutting path that meets the execution requirements of the cutting device is generated.

[0134] According to the complexity of the target object's contour, the path is decomposed into multiple segments to ensure that the cutting machine can execute step by step. Call the conversion tool to convert the vector data in the SVG file into PLT format to adapt to the instruction specifications of the cutting machine. Check whether the cutting path contains repeated or redundant instructions to ensure that the cutting path is efficient and accurate.

[0135] Example description:

[0136] Suppose you need to cut a rectangular target object:

[0137] The Canny algorithm is used to extract the edge of the image after removing the background to obtain the rectangular outline of the target object.

[0138] According to the pixel density reference parameter (0.1175mm / pixel), the contour dimensions in the image are converted from pixel units to millimeter units.

[0139] The Potrace library is called to generate an SVG file, which contains the geometric description of the start point, end point and four edges of the contour.

[0140] Convert the SVG file into a PLT file, segment the path into four straight line segments, and generate cutting instructions.

[0141] The cutting device performs cutting operations according to the PLT file and successfully cuts out the target object that meets the actual size.

[0142] By combining edge detection and pixel density reference parameters, the contour of the target object can be accurately extracted and a vector contour file that conforms to the actual size can be generated. The generated cutting path has high precision and continuity, ensuring that the cutting device can efficiently and accurately complete the cutting task of the target object. Human errors are reduced and cutting quality and efficiency are improved.

[0143] S70, sending the cutting path to a cutting device, and having the cutting device perform a cutting operation on the target object according to the cutting path.

[0144] In this embodiment, the cutting path is an executable instruction set generated from the contour information of the target object. The step of sending the cutting path is responsible for transmitting the generated cutting path data from the image processing system to the cutting device, ensuring that the cutting device can read and execute the relevant instructions.

[0145] The cutting path must be in a file format supported by the cutting device (such as PLT format or G code). Before sending, check whether the path file is complete and correct and meets the execution specifications of the cutting device.

[0146] The cutting path file is transferred to the cutting device via a USB interface or wireless transmission (such as Wi-Fi, Bluetooth). After the transfer is completed, a verification mechanism (such as CRC verification) is used to confirm the integrity of the file.

[0147] Load the cutting path file on the cutting device. Provide path preview function for users to confirm whether the cutting sequence and position are correct.

[0148] The cutting device performs actual cutting operations on the target object using a cutter, laser or other cutting tools according to the received cutting path.

[0149] Start the cutting device and select a suitable cutting tool (such as a laser cutting head or a blade) according to the material and thickness of the target object. Set the parameters of the cutting device (such as cutting speed, power or depth).

[0150] The cutting device executes the cutting operation of the path step by step according to the instructions in the path file, and tracks the starting and ending points of the cutting path to ensure that the path is continuous and not missed.

[0151] Use sensors or cameras to monitor the cutting process in real time to ensure path execution accuracy. If deviation or failure is found, the cutting will be automatically paused and an alarm will be issued.

[0152] Processing after cutting: clean the edge of the target object (such as removing burrs or residues); check whether the target object meets the expected cutting effect. If there are any problems, record them and re-execute the cutting.

[0153] Example description:

[0154] In one cutting operation:

[0155] The target object path file generated by the image processing system is in PLT format, and the path includes the start point, end point and geometric shape description.

[0156] Use the USB interface to transfer the path file to the cutting device and load the file for preview to confirm that the order and position of the paths are correct.

[0157] Start the laser cutting device and set the cutting power to low power mode (suitable for plastic materials).

[0158] Perform the cutting operation step by step according to the instructions in the path file, and clean up the edges of the target object after cutting.

[0159] After inspection, the size of the target object is consistent with expectations, and the cutting edge is smooth and defect-free.

[0160] By sending the cutting path to the cutting device and controlling the cutting device to accurately perform the cutting operation according to the cutting path, a seamless connection from image processing to actual processing is achieved. The high accuracy of the cutting path of the target object is guaranteed, the error is reduced, and the cutting quality and efficiency are improved. In addition, the cutting process is monitored in real time, which effectively reduces the operation risk and improves the automation level of production.

[0161] The present invention relates to the technical field of image processing and automated cutting, and discloses an image contour extraction and cutting method, which comprises setting a shooting device at a target position, placing an actual length reference mark, shooting a reference mark image by the shooting device and measuring the number of pixels, and determining a pixel density reference parameter; acquiring an image containing a target object and a background area by the shooting device; identifying pixels to be replaced that match the background color based on the background color, and replacing them with transparent pixels, and generating a processed image after the background is eliminated; edge detection is performed on the processed image, and the target object contour information is extracted, and a vector contour file of an actual size is generated in combination with the pixel density reference parameter, and a cutting path is generated; the cutting path is sent to a cutting device, and the cutting operation of the target object is completed. The present invention realizes dynamic and precise cutting of the target object by acquiring an image of the target object in real time and generating a vector contour file of an actual size in combination with the pixel density reference parameter.

[0162] In one embodiment, the above S60 includes:

[0163] S601, performing edge detection on the processed image, extracting contour information of the target object and recording pixel path data of the contour information;

[0164] S602, based on the pixel density reference parameter, converting the pixel path data into actual size path data of the target object;

[0165] S603, generating a vector outline file of the target object based on the actual size path data, wherein the vector outline file includes a start point, an end point and a geometric shape description of the path;

[0166] S604, calculating boundary size information of the target object based on the actual size path data, the boundary size information including the width, height and boundary position of the target object;

[0167] S605, optimizing the path information in the vector outline file based on the boundary size information of the target object;

[0168] S606: Generate the cutting path based on the optimized path information.

[0169] In this embodiment, edge detection is the first step to extract the contour of the target object. The outer boundary of the target object is determined by detecting the location of the sharp change in brightness or color in the image. The processed image is analyzed using a classic edge detection algorithm (such as the Canny algorithm) to obtain the boundary pixel points of the target object. Before edge detection, a Gaussian blur algorithm is applied to the image to reduce noise interference. Morphological operations (such as dilation or corrosion) are used to fill the boundary break area to ensure the integrity of the contour.

[0170] After edge detection is completed, the target object contour is stored in the form of a pixel path, including the coordinate sequence of the boundary points. The edge detection results are traversed and the pixel coordinates of each contour point are recorded as path points. The path is stored in segments for subsequent processing and vectorization operations.

[0171] Combined with the pixel density reference parameter, the recorded pixel path data is converted into path data in actual size (such as millimeters).

[0172] Conversion formula: actual size = number of pixels × pixel density reference parameter.

[0173] Replace the pixel coordinates of the path points with the actual size coordinates to generate a sequence of actual size path points.

[0174] Format the actual size path data into a vector file (such as SVG) to describe the outline of the target object. Call a vectorization tool (such as the Potrace library) to process the actual size path data. Record the start point, end point, and geometric shape description (such as a straight line or curve) of the vector path.

[0175] Based on the actual size path data, calculate the width, height and boundary position of the target object to optimize the subsequent path information. Calculate the width and height of the target object through the maximum and minimum coordinates of the path points. Determine the position of the boundary of the target object in the actual size coordinate system.

[0176] Optimize path order and content based on boundary size information to reduce redundant paths and improve cutting efficiency.

[0177] Path area filtering: Delete path segments with an area smaller than a preset threshold to avoid unnecessary cutting.

[0178] Path sorting: Sort by path area to optimize cutting order.

[0179] A cutting path is generated based on the optimized vector contour file, providing executable instructions for the cutting device.

[0180] Path format conversion: Convert vector path data into PLT file format supported by cutting device.

[0181] Cutting instruction generation: Generate an instruction set including the path starting point, end point and execution order.

[0182] This embodiment performs edge detection on the processed image and generates a vector contour file and cutting path of actual size in combination with pixel density reference parameters, which not only improves the dimensional accuracy of the target object cutting, but also reduces the cutting time and path redundancy through path optimization, thereby improving the cutting efficiency. At the same time, it can adapt to target objects of different shapes and sizes and enhance versatility.

[0183] In one embodiment, the above S605 includes:

[0184] S6051, calculating the area of ​​each path in the vector contour file based on the boundary size information;

[0185] S6052, filtering paths whose areas are smaller than a preset threshold, and sorting the retained paths according to their areas;

[0186] S6053, adjusting the cutting order of the path based on the sorting result to optimize the cutting path.

[0187] In this embodiment, the calculation of the path area is based on the path information in the vector contour file and the boundary size information of the target object, so as to identify and distinguish the path with cutting significance.

[0188] Path boundary definition: The area of ​​each path is calculated by the coordinate points of the closed path, which is applicable to polygonal, curved and other paths. For open paths, the area is defined as the approximate enclosing area of ​​the path length.

[0189] Calculation formula: Use classic geometric formulas, such as the polygon area formula, to calculate the area of ​​a closed path. The envelope area of ​​an open path can be calculated by extending its path width.

[0190] Information storage: The area of ​​each path is attached to the path information as an attribute for subsequent filtering and sorting.

[0191] By setting a preset area threshold, tiny paths that have no practical cutting significance are filtered out, reducing redundant operations of the cutting device.

[0192] Threshold setting: The preset threshold is calculated based on the actual size of the target object, such as 0.1% of the total area or other empirical values.

[0193] Path screening: traverse the path information list, filter out the paths whose areas are greater than or equal to the threshold, and retain them.

[0194] Data update: Update the vector outline file and only keep the filtered path information.

[0195] By sorting the reserved paths by area size, the execution order of the cutting paths is optimized, and the paths with larger areas are cut first to reduce the number of cutting times and time.

[0196] Sorting algorithm: Use quick sort or merge sort algorithm to arrange the paths from largest to smallest according to their area.

[0197] Priority rule: Prioritize cutting paths with larger areas to avoid discontinuous cutting due to small path fragments.

[0198] Data structure update: Rearrange the path list in the vector outline file by sorting result.

[0199] Based on the sorted path information, the cutting sequence is optimized, unnecessary movement of the cutting device is reduced, and execution efficiency is improved.

[0200] Sequential adjustment logic: Cutting operations are performed in order of paths, with paths with larger areas being given priority.

[0201] Path continuity: Ensure that the starting point of the cutting path is adjacent to the end point of the previous path or connected by the shortest distance.

[0202] Final path generation: Save the optimized cutting sequence as a cutting path file to ensure compatibility with cutting devices.

[0203] This embodiment can significantly reduce the redundancy in the cutting path by optimizing the path information in the vector contour file based on the boundary size information of the target object, give priority to executing the path with cutting significance, and reduce the running time of the cutting device. It ensures the logic of the path sequence and the cutting efficiency, while reducing the load on the cutting device and improving the production accuracy.

[0204] In one embodiment, the above S50 includes:

[0205] S501, reducing the resolution of the image to be processed to one quarter of the original resolution;

[0206] S502, collecting a background color reference of the image to be processed, wherein the background color reference is composed of color values ​​of eight pixels sampled from four corners and four edge middles of the image to be processed;

[0207] S503, setting a color tolerance value and performing color matching on each pixel in the image to be processed, marking pixels to be replaced that match the background color reference;

[0208] S504: Replace the color value of the pixel to be replaced with a transparent pixel, expand the background replacement area through a flood fill operation, and generate a processed image containing only the target object.

[0209] In this embodiment, by reducing the resolution of the image to be processed to one-fourth of the original resolution, the number of image pixels can be reduced, the computational complexity can be reduced, and the processing efficiency of background color matching can be improved.

[0210] Reduction ratio: Reduce the width and height of the original image to half of the original size, and reduce the overall number of pixels to one quarter of the original size.

[0211] Image processing method: Use an image processing library (such as OpenCV or Pillow) to perform the downscaling operation, using bilinear interpolation to maintain the overall quality of the image.

[0212] By sampling the color values ​​of eight pixels from the four corners and the middle positions of the four edges of the image to be processed, a reference for the background color is obtained for subsequent color matching.

[0213] Sampling position: Select the four vertices of the image (upper left, upper right, lower left, lower right) and the four edge midpoints (top, bottom, left, right).

[0214] Sampling method: Read the pixel value (RGB or HSV format) of the corresponding position in the image and store the sampling result as the background color reference.

[0215] The color tolerance value is set according to the background color reference, the color values ​​in the image are matched pixel by pixel, and the pixels to be replaced that match the background color reference are marked.

[0216] Tolerance value setting: Set a certain range of color tolerance values ​​(such as ±10 RGB deviation range) to allow a certain degree of deviation for the background color.

[0217] Pixel traversal: Traverse the color value of each pixel in the image and compare it with the background color reference. If the color difference is within the tolerance range, it is marked as a pixel to be replaced.

[0218] Set the color value of the pixels marked for replacement to the transparent color to remove the background area.

[0219] Transparent color definition: Set the Alpha channel value of the marked pixel to 0 to make the background transparent.

[0220] Batch Replacement: Based on the marking results, batch replace the color values ​​of the pixels to be replaced with transparent colors.

[0221] A flood-fill algorithm is used to expand the replacement range from the background area to ensure the integrity of background removal.

[0222] Flood fill starting point: Select the center or edge of the background plate as the filling starting point.

[0223] Filling logic: Traverse the image pixels and gradually expand the background area that is connected to the starting point and has a similar color.

[0224] Transparent extended area: Replace all pixels within the extended area with a transparent color.

[0225] Example description:

[0226] Assume that the image to be processed is a picture of a target object (such as a tool part) placed on a blue background board: the image resolution is reduced from 4000x3000 to 1000x750; the background color benchmark is collected (such as RGB is [0,0,255]), and the tolerance value is set to ±10; the background pixels that meet the color benchmark are marked and replaced with transparent pixels; the background replacement range is expanded using flood fill to ensure that there is no residue in the background area; and finally a transparent background image containing only the tool parts is generated for subsequent processing.

[0227] This embodiment achieves efficient and accurate background removal through resolution reduction, background color sampling, tolerance matching and flood filling operations. The generated processed image contains only the target object without background interference, providing a reliable data basis for subsequent contour extraction and cutting path generation. It reduces the computational complexity, improves the processing efficiency, and adapts to scenes with different background complexities.

[0228] In one embodiment, the above S504 includes:

[0229] S5041, detecting transparent pixels in the processed image to determine whether the background removal is successful;

[0230] S5042, when the background removal is unsuccessful, adjusting the color tolerance value to re-mark the pixels to be replaced;

[0231] S5043, replacing the re-marked pixels to be replaced with transparent pixels;

[0232] S5044, repeatedly detecting transparent pixels in the processed image until the background is removed successfully.

[0233] In this embodiment, after the preliminary background removal is completed, the number or distribution of transparent pixels in the processed image is detected to determine whether the background area is completely replaced by transparent pixels, so as to evaluate the success of the background removal.

[0234] Transparent pixel detection: traverse each pixel in the image and count the number of pixels with an alpha channel value of 0 (transparent). Determine whether the distribution of transparent pixels covers the background area of ​​the image.

[0235] Background removal success criteria: The transparent pixel ratio in the background area reaches the set threshold (such as above 95%). The transparent pixel distribution matches the expected background area.

[0236] When the detection finds that the background removal is unsuccessful, the pixels to be replaced in the background area are re-marked by adjusting the range of the color tolerance value.

[0237] Tolerance adjustment logic: Increase the color tolerance value range (such as increasing ±5) to expand the background color matching range. Adapt to slight changes in background color or complex texture characteristics.

[0238] Re-mark pixels: Use the adjusted tolerance value to re-check whether the color of each pixel matches the background color benchmark. Mark the newly discovered pixels to be replaced.

[0239] The re-labeled pixels to be replaced are replaced with transparent pixels to further remove the background areas that were not successfully replaced.

[0240] Transparency processing: Set the Alpha channel value of the re-marked pixels to 0 to achieve a transparency effect.

[0241] Regional processing: Perform local transparency processing on some of the background areas that have not been replaced to ensure the integrity of background removal.

[0242] By repeatedly performing transparent pixel detection and tolerance adjustment operations, it is ensured that the background area is completely replaced by transparent pixels, and finally the success standard of background removal is achieved.

[0243] Loop logic: If background removal is unsuccessful, continue to detect transparent pixels and adjust the tolerance value.

[0244] Termination condition: When the number and distribution of transparent pixels meet the background removal success criteria, the loop is terminated.

[0245] This embodiment ensures the complete removal of the background area through a closed-loop processing method of transparent pixel detection and tolerance adjustment, reduces the possibility of residual background, and improves the accuracy of background removal. It can adapt to background scenes of different complexities while ensuring the boundary integrity of the target object, providing a high-quality data foundation for subsequent contour extraction and path generation.

[0246] In one embodiment, before the above S40, the method further includes:

[0247] S401, marking a shooting center point and edge identification points on a background plate to determine a shooting range of the shooting device;

[0248] S402, adjusting the height of the shooting device so that the distance between the shooting device and the background plate meets the predetermined field of view angle requirement to completely cover the boundary of the background plate;

[0249] S403, adjusting the pitch angle of the shooting device so that the lens of the shooting device is vertically aligned with the background plate;

[0250] S404: Lock the current field of view of the shooting device.

[0251] In this embodiment, the shooting center point and edge identification points are marked on the background board to determine the lens position and shooting range of the shooting device, ensuring that the target object is at the center of the background board and the entire background board is completely covered in the lens field of view.

[0252] Marking content: The shooting center point is marked as the geometric center of the background plate. The edge identification point is marked as the midpoint or corner point of the four sides of the background plate.

[0253] Marking method: Use a high-contrast marking tool (such as colored tape, spray paint, etc.) to mark points on the background board for easy camera recognition.

[0254] Auxiliary tools: Use a ruler or laser alignment tool to accurately locate the marking point to ensure that the position of the marking point is symmetrical with the edge of the background plate.

[0255] By adjusting the distance between the camera and the background, ensure that the field of view of the lens can completely cover the boundaries of the background.

[0256] Field of view angle calculation: Calculate the field of view angle range based on the lens specifications of the shooting equipment (such as focal length, photosensitive element size). Calculate the appropriate height range based on the size of the background board.

[0257] Height adjustment tools: Use a lifting bracket or tripod to adjust the height of the camera. Use a level to check if the camera is in a level position.

[0258] Height verification: Use the camera to preview the image and confirm that the background board boundary is completely covered within the lens field of view.

[0259] By adjusting the pitch angle of the shooting device, the optical axis of the lens is perpendicular to the center of the background board to avoid distortion of the background board edge or image due to perspective offset.

[0260] Tilt Angle Adjustment: Use the angle adjustment function on the bracket to precisely adjust the pitch angle of the lens.

[0261] Verticality check: Use a laser rangefinder or leveling tool to ensure that the lens optical axis is perpendicular to the center point of the background plate.

[0262] Image Correction: Use real-time image preview to check whether the target object is in the center of the picture and has no obvious distortion.

[0263] After completing the device position and viewing angle adjustment, lock the current position and field of view of the camera to ensure that the viewing angle remains fixed and does not shift when capturing images.

[0264] Locking method: Use the fixing knob or locking device on the bracket to lock the height and angle of the device.

[0265] Anti-shake mechanism: Use anti-shake brackets or shock-absorbing devices to reduce device displacement caused by external interference.

[0266] Field of view verification: Ensure that the field of view is consistent with the background board boundary by previewing the shooting center point and edge identification points of the image.

[0267] This embodiment ensures that the field of view of the shooting device covers the boundary of the background board by marking the shooting range on the background board and adjusting the position, direction and field of view of the shooting device, thereby improving the stability and accuracy of image acquisition. After locking the field of view of the device, image offset or distortion is avoided, laying a solid foundation for subsequent background removal and contour extraction.

[0268] In one embodiment, the above S10 includes:

[0269] S101, installing the photographing device on a supporting device, and moving the supporting device to a target position;

[0270] S102, adjusting the direction of the lens of the shooting device so that the optical axis of the lens is vertically aligned with the center position of the background plate;

[0271] S103: Setting the resolution of image acquisition in the shooting device.

[0272] In this embodiment, the shooting device is fixed on the supporting device, and the device is positioned to the target position by moving the supporting device, so as to ensure that the device is stable and can be flexibly adjusted according to the position of the background board.

[0273] Install the device: Use a supporting device (such as a tripod or lifting bracket) to fix the shooting device. Ensure the stability of the installation to prevent the device from shaking or tilting.

[0274] Mobile positioning: Move the support device to the target position to ensure that the shooting device is above the background plate. Use auxiliary tools (such as a level or laser locator) to calibrate the device position to ensure that the device is aligned with the center of the background plate.

[0275] By adjusting the direction of the camera lens, align the optical axis vertically with the center of the background plate, ensure that the center of the field of view coincides with the center of the background plate, and avoid image distortion or poor alignment due to angle deviation.

[0276] Lens adjustment mechanism: Use the universal joint or angle adjustment knob on the support device to flexibly adjust the lens direction.

[0277] Vertical alignment method: Use a laser rangefinder or level tool to check whether the lens optical axis is vertically pointing to the center of the background plate. Use real-time image preview to confirm whether the lens field of view completely covers the background plate.

[0278] A fixed image acquisition resolution is set in the shooting device to ensure that the acquired image meets the resolution requirements of subsequent processing and to avoid affecting the processing accuracy due to inconsistent resolution.

[0279] Resolution setting: Select an appropriate resolution (such as 1920x1080, 2592x1944) based on the target object size and background plate size. Use the device menu or control software to configure the acquisition resolution.

[0280] Resolution verification: Check that the device settings are consistent with the expected resolution. Take a test image to verify the impact of resolution on image clarity and coverage.

[0281] This embodiment can ensure the stability and clarity of the captured image by installing the shooting device on the supporting device and accurately positioning it, combined with the adjustment of the lens direction and resolution. This not only improves the accuracy of image acquisition, but also provides high-quality basic data for subsequent image processing and contour extraction.

[0282] In one embodiment, an image contour extraction and cutting device is provided, and the image contour extraction and cutting device corresponds to the image contour extraction and cutting method in the above embodiment. Figure 3 , Figure 3 This is a functional module diagram of a preferred embodiment of the image contour extraction and cutting device of the present invention. The shooting device setting module 10, the pixel density calculation module 20, the object arrangement module 30, the image acquisition module 40, the background removal module 50, the contour extraction and vectorization module 60 and the cutting execution module 70. The functional modules are described in detail as follows:

[0283] The photographing device setting module 10 is used to set the photographing device at a target position;

[0284] A pixel density calculation module 20, for placing a reference mark of known actual length, capturing an image of the reference mark by the capturing device and measuring the corresponding number of pixels, and determining a pixel density reference parameter according to the actual length and the number of pixels;

[0285] An object arrangement module 30 is used to place a background plate at the target position and place the target object on the background plate;

[0286] An image acquisition module 40 is used to acquire an image to be processed including a target object and a background area through the shooting device;

[0287] The background removal module 50 is used to identify the pixels to be replaced that match the background color in the image to be processed based on the background color of the background plate, and replace the pixels to be replaced with transparent pixels to generate a processed image that only contains the target object after the background is removed;

[0288] The contour extraction and vectorization module 60 is used to perform edge detection on the processed image, extract the contour information of the target object, convert the contour information into a vector contour file of actual size in combination with the pixel density reference parameter, and generate a cutting path;

[0289] The cutting execution module 70 is used to send the cutting path to a cutting device, so that the cutting device performs a cutting operation on the target object according to the cutting path.

[0290] In one embodiment, the contour extraction and vectorization module 60 is specifically used for:

[0291] Performing edge detection on the processed image, extracting contour information of the target object and recording pixel path data of the contour information;

[0292] Based on the pixel density reference parameter, converting the pixel path data into actual size path data of the target object;

[0293] Based on the actual size path data, a vector outline file of the target object is generated, wherein the vector outline file includes a start point, an end point and a geometric shape description of the path;

[0294] Calculating the boundary size information of the target object based on the actual size path data, wherein the boundary size information includes the width, height and boundary position of the target object;

[0295] Optimizing the path information in the vector outline file based on the boundary size information of the target object;

[0296] The cutting path is generated based on the optimized path information.

[0297] In one embodiment, the contour extraction and vectorization module 60 is specifically used for:

[0298] Based on the boundary size information, calculating the area of ​​each path in the vector contour file;

[0299] Filter the paths whose area is smaller than the preset threshold, and sort the retained paths by area size;

[0300] The cutting order of the paths is adjusted based on the sorting result to optimize the cutting paths.

[0301] In one embodiment, the background removal module 50 is specifically configured to:

[0302] Reducing the resolution of the image to be processed to one quarter of the original resolution;

[0303] Acquire a background color reference of the image to be processed, wherein the background color reference is composed of color values ​​of eight pixel points sampled from four corners and four edge middle positions of the image to be processed;

[0304] Setting a color tolerance value and performing color matching on each pixel in the image to be processed, marking pixels to be replaced that match the background color reference;

[0305] The color value of the pixel to be replaced is replaced with a transparent pixel, and the background replacement area is expanded through a flood fill operation to generate a processed image containing only the target object.

[0306] In one embodiment, the background removal module 50 is specifically configured to:

[0307] Detecting transparent pixels in the processed image to determine whether the background removal is successful;

[0308] When background removal is unsuccessful, adjusting the color tolerance value to re-mark the pixels to be replaced;

[0309] Replace the re-marked pixels to be replaced with transparent pixels;

[0310] The transparent pixels in the processed image are repeatedly detected until the background is removed successfully.

[0311] In one embodiment, the image acquisition module 40 is specifically used for:

[0312] Mark the shooting center point and edge identification points on the background board to determine the shooting range of the shooting device;

[0313] Adjusting the height of the shooting device so that the distance between the shooting device and the background plate meets the predetermined field of view angle requirement, so as to completely cover the boundary of the background plate;

[0314] Adjust the pitch angle of the shooting device so that the lens of the shooting device is vertically aligned with the background plate;

[0315] Lock the current field of view of the camera.

[0316] In one embodiment, the camera setting module 10 is specifically used to:

[0317] Installing the photographing device on a supporting device, and moving the supporting device to a target position;

[0318] Adjust the direction of the lens of the shooting device so that the optical axis of the lens is vertically aligned with the center of the background plate;

[0319] The resolution of image acquisition is set in the photographing device.

[0320] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 4 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external user terminal through a network connection. When the computer program is executed by the processor, it realizes the functions or steps of a service end side of an image contour extraction and cutting method.

[0321] In one embodiment, a computer device is provided. The computer device may be a user terminal, and its internal structure diagram may be as follows: Figure 5 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external server through a network connection. When the computer program is executed by the processor, it realizes the functions or steps of a user-side of an image contour extraction and cutting method

[0322] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the following steps are implemented:

[0323] Set up the camera at the target location;

[0324] Placing a reference mark of known actual length, capturing an image of the reference mark by the capturing device and measuring the corresponding number of pixels, and determining a pixel density reference parameter according to the actual length and the number of pixels;

[0325] Placing a background plate at the target position and placing the target object on the background plate;

[0326] Acquire the image to be processed including the target object and the background area by the shooting device;

[0327] Based on the background color of the background plate, identifying pixels to be replaced in the image to be processed that match the background color, and replacing the pixels to be replaced with transparent pixels, so as to generate a processed image that only contains the target object after the background is removed;

[0328] Performing edge detection on the processed image, extracting contour information of the target object, converting the contour information into a vector contour file of actual size in combination with the pixel density reference parameter, and generating a cutting path;

[0329] The cutting path is sent to a cutting device, and the cutting device performs a cutting operation on the target object according to the cutting path.

[0330] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0331] Set up the camera at the target location;

[0332] Placing a reference mark of known actual length, capturing an image of the reference mark by the capturing device and measuring the corresponding number of pixels, and determining a pixel density reference parameter according to the actual length and the number of pixels;

[0333] Placing a background plate at the target position and placing the target object on the background plate;

[0334] Acquire the image to be processed including the target object and the background area by the shooting device;

[0335] Based on the background color of the background plate, identifying pixels to be replaced in the image to be processed that match the background color, and replacing the pixels to be replaced with transparent pixels, so as to generate a processed image that only contains the target object after the background is removed;

[0336] Performing edge detection on the processed image, extracting contour information of the target object, converting the contour information into a vector contour file of actual size in combination with the pixel density reference parameter, and generating a cutting path;

[0337] The cutting path is sent to a cutting device, and the cutting device performs a cutting operation on the target object according to the cutting path.

[0338] It should be noted that the above functions or steps that can be implemented by the computer-readable storage medium or computer device can refer to the relevant descriptions on the server side and the user side in the aforementioned method embodiment. To avoid repetition, they will not be described one by one here.

[0339] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0340] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0341] It should be noted that if software tools or components other than those of the Company appear in the embodiments of the present application, they are only used for illustration and do not represent actual use. The above-described embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the above-mentioned embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the above-mentioned embodiments can still be modified, or some of the technical features thereof can be replaced by equivalents; and these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.

Claims

1. A method for extracting and cutting image contours, characterized in that: The following steps are involved: Set up the camera at the target location; Placing a reference mark of known actual length, capturing an image of the reference mark by the capturing device and measuring the corresponding number of pixels, and determining a pixel density reference parameter according to the actual length and the number of pixels; Placing a background plate at the target position and placing the target object on the background plate; Acquire the image to be processed including the target object and the background area by the shooting device; Based on the background color of the background plate, identifying pixels to be replaced in the image to be processed that match the background color, and replacing the pixels to be replaced with transparent pixels, so as to generate a processed image that only contains the target object after the background is removed; Performing edge detection on the processed image, extracting contour information of the target object, converting the contour information into a vector contour file of actual size in combination with the pixel density reference parameter, and generating a cutting path; The cutting path is sent to a cutting device, and the cutting device performs a cutting operation on the target object according to the cutting path.

2. The image contour extraction and cutting method according to claim 1, characterized in that: Performing edge detection on the processed image, extracting contour information of the target object, converting the contour information into a vector contour file of actual size in combination with the pixel density reference parameter, and generating a cutting path, including: Performing edge detection on the processed image, extracting contour information of the target object and recording pixel path data of the contour information; Based on the pixel density reference parameter, converting the pixel path data into actual size path data of the target object; Based on the actual size path data, a vector outline file of the target object is generated, wherein the vector outline file includes a start point, an end point and a geometric shape description of the path; Calculating the boundary size information of the target object based on the actual size path data, wherein the boundary size information includes the width, height and boundary position of the target object; Optimizing the path information in the vector outline file based on the boundary size information of the target object; The cutting path is generated based on the optimized path information.

3. The image contour extraction and cutting method according to claim 2, characterized in that: Optimizing the path information in the vector outline file based on the boundary size information of the target object includes: Based on the boundary size information, calculating the area of ​​each path in the vector contour file; Filter the paths whose area is smaller than the preset threshold, and sort the retained paths by area size; The cutting order of the paths is adjusted based on the sorting result to optimize the cutting paths.

4. The image contour extraction and cutting method according to claim 1, characterized in that: Based on the background color of the background plate, identifying pixels to be replaced in the image to be processed that match the background color, and replacing the pixels to be replaced with transparent pixels, to generate a processed image containing only the target object after the background is removed, including: Reducing the resolution of the image to be processed to one quarter of the original resolution; Acquire a background color reference of the image to be processed, wherein the background color reference is composed of color values ​​of eight pixel points sampled from four corners and four edge middle positions of the image to be processed; Setting a color tolerance value and performing color matching on each pixel in the image to be processed, marking pixels to be replaced that match the background color reference; The color value of the pixel to be replaced is replaced with a transparent pixel, and the background replacement area is expanded through a flood fill operation to generate a processed image containing only the target object.

5. The image contour extraction and cutting method according to claim 4, characterized in that: After replacing the color value of the pixel to be replaced with a transparent pixel and expanding the background replacement area by a flood fill operation to generate a processed image containing only the target object, the method further includes: Detecting transparent pixels in the processed image to determine whether the background removal is successful; When background removal is unsuccessful, adjusting the color tolerance value to re-mark the pixels to be replaced; Replace the re-marked pixels to be replaced with transparent pixels; The transparent pixels in the processed image are repeatedly detected until the background is removed successfully.

6. The image contour extraction and cutting method according to claim 1, characterized in that: Before the image to be processed including the target object and the background area is collected by the shooting device, the method further includes: Mark the shooting center point and edge identification points on the background board to determine the shooting range of the shooting device; Adjusting the height of the shooting device so that the distance between the shooting device and the background plate meets the predetermined field of view angle requirement, so as to completely cover the boundary of the background plate; Adjust the pitch angle of the shooting device so that the lens of the shooting device is vertically aligned with the background plate; Lock the current field of view of the camera.

7. The image contour extraction and cutting method as claimed in claim 1, characterized in that: Set up the camera at the target location, including: Installing the photographing device on a supporting device, and moving the supporting device to a target position; Adjust the direction of the lens of the shooting device so that the optical axis of the lens is vertically aligned with the center of the background plate; The resolution of image acquisition is set in the photographing device.

8. An image contour extraction and cutting device, characterized in that: The image contour extraction and cutting device comprises: A shooting device setting module is used to set the shooting device at a target position; a pixel density calculation module, used for placing a reference mark of known actual length, capturing an image of the reference mark by the capturing device and measuring the corresponding number of pixels, and determining a pixel density reference parameter according to the actual length and the number of pixels; An object placement module is used to place a background plate at the target position and place the target object on the background plate; An image acquisition module, used for acquiring an image to be processed including a target object and a background area through the shooting device; A background removal module is used to identify the pixels to be replaced that match the background color in the image to be processed based on the background color of the background plate, and replace the pixels to be replaced with transparent pixels to generate a processed image that only contains the target object after the background is removed; A contour extraction and vectorization module, used to perform edge detection on the processed image, extract contour information of the target object, convert the contour information into a vector contour file of actual size in combination with the pixel density reference parameter, and generate a cutting path; The cutting execution module is used to send the cutting path to the cutting device, and the cutting device performs a cutting operation on the target object according to the cutting path.

9. A computer device, characterized in that: The computer device includes a memory, a processor, and an image contour extraction and cutting program stored in the memory and executable on the processor. When the image contour extraction and cutting program is executed by the processor, the steps of the image contour extraction and cutting method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium, characterized in that: The storage medium stores an image contour extraction and cutting program, which, when executed by a processor, implements the steps of the image contour extraction and cutting method according to any one of claims 1 to 7.

Citation Information

Cited By

  • High-myopia cataract image processing system based on image recognition

    CN120807993A

  • Method and system for controlling slicing equipment

    CN121083716A