Control method, controller and lighting equipment
By converting the target color image into a line drawing and coloring it, a light emission control signal is generated, which solves the problem of low efficiency in manually drawing line drawings and realizes the automatic generation of light effect patterns, ensuring color consistency and richness.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN QIANYAN TECH LTD
- Filing Date
- 2026-03-25
- Publication Date
- 2026-04-28
AI Technical Summary
In the current technology, manually drawing line diagrams is inefficient and cannot meet users' customization needs.
By converting the target color image into a first line drawing, and coloring the contour lines in the first line drawing according to the color of the contour lines in the target color image, a second line drawing is generated. Contour feature points are determined, a color dot map is generated, and then a light emission control signal is generated to control the light emission unit to present a pattern.
It enables automatic generation of line drawings, reducing manual drawing time, ensuring that the colors of the lighting effect patterns are consistent with the target color image, enriching the expression of the lighting effects, avoiding manual color matching, and improving efficiency.
Smart Images

Figure CN121940931A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and more specifically, to a control method, controller, and lighting device. Background Technology
[0002] Lighting equipment is widely used in various scenarios to create lighting effects, such as controlling lighting equipment to display linear patterns. In related technologies, to enable lighting equipment to display linear patterns, it is necessary to manually draw line drawings or upload existing line drawings, and then generate light control signals to control the lighting equipment based on the line drawings. Manually drawing line drawings is inefficient, and existing line drawings rarely meet users' customization needs. Therefore, how to automatically generate line drawings is a pressing technical problem to be solved in related technologies. Summary of the Invention
[0003] In view of the above problems, this application proposes a control method, controller and lighting device to solve the problem of low efficiency of manually drawing line drawings in related technologies.
[0004] In a first aspect, a control method is provided, comprising: converting a target color image into a line drawing to obtain a first line drawing; coloring the contour lines in the first line drawing according to the colors of the corresponding positions of the contour lines in the target color image to obtain a second line drawing; wherein the colors of the contour lines in the second line drawing are the same as the colors of the corresponding positions in the target color image; determining contour feature points on each contour line in the second line drawing; generating a color dot map according to the coordinate information of each contour feature point in the second line drawing and the colors of each contour feature point in the second line drawing; and generating a light emission control signal according to the color dot map, wherein the light emission control signal is used to cause the light emission unit to present the pattern in the color dot map according to the colors of the contour feature points in the color dot map.
[0005] Secondly, a control device is provided, comprising: a conversion module for converting a target color image into a line drawing to obtain a first line drawing; a coloring module for coloring the contour lines in the first line drawing according to the colors of the corresponding positions of the contour lines in the target color image to obtain a second line drawing; wherein the colors of the contour lines in the second line drawing are the same as the colors of the corresponding positions in the target color image; a contour feature point determination module for determining contour feature points on each contour line in the second line drawing; a color dot plot generation module for generating a color dot plot according to the coordinate information of each contour feature point in the second line drawing and the colors of each contour feature point in the second line drawing; and a control module for generating a light emission control signal according to the color dot plot, wherein the light emission control signal is used to cause the light emission unit to present the pattern in the color dot plot according to the colors of each contour feature point in the color dot plot.
[0006] Thirdly, a controller is provided, comprising: a processor; and a memory storing computer-readable instructions, which, when executed by the processor, implement the control method described above.
[0007] Fourthly, a lighting device is provided, including a processor, a memory, and a light-emitting unit. The memory stores computer-readable instructions, which, when executed by the processor, generate a light-emitting control signal according to the control method described above. The light-emitting unit is used to present a lighting effect according to the light-emitting control signal.
[0008] Fifthly, a computer-readable storage medium is provided that stores computer-readable instructions thereon, which, when executed by a processor, implement the control method described above.
[0009] Sixthly, a computer program product is provided, including computer-readable instructions that, when executed by a processor, implement the control method described above.
[0010] In this application, after converting the target color image into a first line drawing, the contour lines in the first line drawing are colored according to the colors of their corresponding positions in the target color image, resulting in a second line drawing. This ensures that the colors of the contour lines in the second line drawing are essentially consistent with their corresponding colors in the target color image. Subsequently, based on the coordinate information and colors of the contour feature points on each contour line in the second line drawing, a color dot map is automatically generated, which in turn generates a light emission control signal. The light emission control signal enables the light-emitting units to illuminate according to the colors of the contour feature points in the color dot map, presenting a light effect pattern identical to the pattern in the color dot map, thus ensuring the richness of the presented light effect pattern's colors. Moreover, the colors of the presented light effect pattern basically follow the color scheme in the target color image, eliminating the need for users to spend considerable time color matching different contours within the pattern. This application's solution achieves automatic generation of a second line drawing from the target color image, thereby generating a light emission control signal without the need for manual drawing of the line drawing or manual color matching of the contour lines, effectively solving the problem of low efficiency in manually drawing line drawings in related technologies. Attached Figure Description
[0011] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0012] Figure 1 This is a flowchart illustrating a control method according to an embodiment of this application.
[0013] Figure 2 An exemplary diagram of the first line drawing generated for the target color image is shown.
[0014] Figure 3 This is a flowchart illustrating the steps preceding step 120 according to an embodiment of this application.
[0015] Figure 4 An exemplary schematic diagram is shown for determining a second line drawing for another target color image.
[0016] Figure 5A An example diagram of the intersecting pixel region is shown.
[0017] Figure 5B This is a schematic diagram illustrating the determination of a contour detection region in a first line drawing according to an embodiment of this application.
[0018] Figure 6This is a flowchart illustrating step 130 according to an embodiment of this application.
[0019] Figure 7 This is a flowchart illustrating the determination of a single pixel width according to an embodiment of this application.
[0020] Figure 8 This is a flowchart illustrating a control method according to another embodiment of this application.
[0021] Figure 9 This is a block diagram of a control device according to an embodiment of this application.
[0022] Figure 10 This is a block diagram of a lighting device according to an embodiment of this application. Detailed Implementation
[0023] The embodiments of this application are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application.
[0024] In the following description, the terms "first" and "second" are used only to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first" and "second" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0025] In this document, "multiple" refers to two or more. "And / or" describes the relationship between associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following associated objects are in an "or" relationship. In the following description, references to "some embodiments or some embodiment methods" describe a subset of all possible embodiments. However, it is understood that "some embodiments" can be the same subset or different subsets of all possible embodiments and can be combined with each other without conflict.
[0026] Figure 1 This is a flowchart illustrating a control method according to an embodiment of this application. This method can be executed by a lighting device or by other devices communicatively connected to the lighting, such as a server or terminal; no specific limitations are made herein. Figure 1 As shown, the method includes at least steps 110 to 150, which are described in detail below: Step 110: Convert the target color image into a line drawing to obtain the first line drawing. The target color image can be an RGB image, which is a colored pixel image. The objects presented in the target color image are not limited and can be buildings, landscapes, people, animals, etc.
[0027] The first line drawing can be obtained by extracting contours from the target color image. It presents the contour lines of various objects in the target color image. The size of the first line drawing is the same as the target color image. The pixel regions containing the contour lines in the first line drawing are different colors from other pixel regions. All pixel regions containing the contour lines in the first line drawing have the same color; for example, the pixel region containing the contour lines is black (or another color), and the pixel regions other than the contour lines are white. It is worth noting that although the first line drawing presents the contour lines of objects in the target color image, the width of the contour lines in the first line drawing is not necessarily a single pixel width. That is, in the width direction of the contour lines, the contour lines may occupy one or more pixels.
[0028] In some embodiments, the background-removed color image may be used as the target color image in this application; alternatively, the background of the target color image may be removed before step 110, and in step 110, the background-removed target color image may be converted into a line drawing. In some embodiments, a trained neural network model, such as the BiRefNet model, may be used to remove the background from the target color image. The background-removed target color image may only present the foreground of the initial target color image.
[0029] In some embodiments, a target color image can be converted into a line drawing using a line drawing conversion model for converting a color image into a line drawing, resulting in a first line drawing. The line drawing conversion model can be a CLIPasso model, an Informative Drawings model, or similar.
[0030] In some embodiments, considering that different line drawing conversion models have different effects on line drawing conversion of images with different subject categories, a line drawing conversion model suitable for converting the target color image can be specifically determined by combining the image subject and the complexity of the color image. Then, the determined line drawing conversion model is used to convert the target color image into a line drawing to obtain a first line drawing.
[0031] For example, the target color image can first be classified into subject categories to determine the subject category to which the target color image belongs; the target color image can then be classified into foreground complexity categories to obtain the foreground complexity category to which the target color image belongs; and finally, based on the mapping relationship between the subject category and the complexity category and the line drawing conversion model, the line drawing conversion model suitable for the target color image can be determined.
[0032] The subject category to which the target color image belongs is one of several preset subject categories. These preset subject categories may include, for example, architecture, portraits, and a third subject category. More detailed subject categories can also be set. Similarly, the foreground complexity category to which the target color image belongs is one of several preset complexity categories. For example, these preset complexity categories may include complex image categories and simple image categories. In other embodiments, even more preset complexity categories can be set; no specific limitation is made here. Foreground complexity classification of the target color image refers to classifying the complexity of the foreground within the target color image; that is, the complexity classification does not consider the background of the target color image.
[0033] The mapping relationship between topic categories and complexity categories and the line drawing conversion model indicates the applicable line drawing conversion model for each topic category and each complexity category.
[0034] Taking the preset theme categories as three categories, namely architecture, portrait, and a third theme category (which includes all other categories besides architecture and portrait), and the preset complexity categories as two categories, namely complex image and simple image, as an example, the mapping relationship between theme categories, complexity categories, and line drawing conversion models can be shown in Table 1 below: Table 1 In some embodiments, a topic classification model can be used to classify the subject matter of a target color image. This topic classification model is a neural network model constructed using convolutional neural networks, fully connected networks, etc. To ensure the classification accuracy of the topic classification model, it can be pre-trained on a training set and its subject classification performance can be validated on a validation set. Once the subject classification performance meets the accuracy requirements, the model is deployed online for classifying the subject matter of input color images. The training set includes multiple first color images and the subject categories labeled for each first color image (e.g., building categories, portrait categories, and other subject categories), while the validation set includes multiple second color images and the subject categories labeled for each second color image.
[0035] During training, a first color image is input into the topic classification model. The model classifies the first color image into a predicted topic category. Then, a loss function is used to calculate the topic classification loss based on the labeled topic categories for each first color image and the predicted topic categories for that image. The parameters of the topic classification model are then adjusted based on this loss until the training termination condition is met. The loss function can be cross-entropy loss, absolute value loss, mean squared error loss, etc., and is not specifically limited here. The training termination condition can be at least one of the following: the number of iterations of the topic classification model reaches a threshold, or the topic classification loss converges.
[0036] In some embodiments, foreground complexity classification of a target color image can be performed based on complexity classification prompts and a multimodal large model, outputting the foreground complexity category to which the target color image belongs. In other words, to perform foreground complexity classification of a target color image using a multimodal large model, the target color image and complexity classification prompts can be input into the multimodal large model, so that the multimodal large model performs foreground complexity classification of the target color image according to the instructions of the complexity classification prompts and outputs the complexity category to which the target color image belongs. This multimodal large model can be used to process at least text modality data and image modality data, and the multimodal large model is not limited, such as the Gemma-3 model, the mPLUG model, etc.
[0037] The complexity classification prompt can include instruction text, which prompts the user to classify the foreground complexity of the input image among several preset complexity categories. For example, the instruction text could be "Please classify the foreground complexity of the input image and output whether the image belongs to the complex image category or the simple image category."
[0038] In some embodiments, the complexity classification prompt may further include definition text, which includes the definition of each complexity category. For example, if the complexity categories include a complex image category and a simple image category, the definition text indicates the definitions of the complex image category and the simple image category. In some embodiments, the definition text indicates that in an image belonging to the complex image category, the number of foreground objects is not less than a first number, and there are at least a second number of foreground objects whose pixel area ratio in the image exceeds a preset area ratio, the second number not exceeding the first number. The first number is an integer greater than 1, and the first number and the preset area ratio can be set as needed. For example, if the first number is 4, the second number is 2, and the preset area ratio is 20%, the definition text could be: "If the input image presents at least 4 foreground objects, and at least 2 of these objects occupy pixel areas exceeding 20% of the entire image area, then the image is considered to belong to the complex image category; otherwise, it belongs to the simple image category."
[0039] In this way, the multimodal large model can accurately understand each complexity category based on the definition text, and thus accurately classify the foreground complexity of the input image. The instruction text and definition text listed above are merely illustrative examples and should not be considered as limiting the scope of this application.
[0040] Step 120: Color the contour lines in the first line drawing according to the colors of the corresponding positions of each contour line in the target color image to obtain the second line drawing; wherein, the colors of each contour line in the second line drawing are the same as the colors of the corresponding positions in the target color image.
[0041] The color of each contour line in the first line drawing may be black or another color, and the color of each contour line may not match the color of its corresponding position in the target color image. For example, for... Figure 2 The target color image shown on the left is generated. Figure 2 The first line drawing shown on the right side has black outlines, a color different from the corresponding positions in the target color image. It should be noted that... Figure 2 The black outer border of the first line drawing shown is used as an example to represent the boundary of the first line drawing and is not part of the image content of the first line drawing. The number of outline lines in the first line drawing is unlimited; it can be one or more.
[0042] In some embodiments, if the color of each outline in the first line drawing is the same as the color of the corresponding position in the target color image, then the first line drawing can be used as the second line drawing.
[0043] Therefore, in this application, the contour lines in the first line drawing are colored according to the colors of their corresponding positions in the target color image, so that the colors of the contour lines in the second line drawing are substantially the same as the colors of their corresponding positions in the target color image. For example, if the hair color is yellow in the target color image, then the contour line representing the hair in the second line drawing is also yellow.
[0044] In some embodiments, the contour pixel region where each contour line in the first line drawing is located can be determined, the pixel point in the contour pixel region is called the contour pixel point, and the coordinate information of each contour pixel point is determined. Then, according to the coordinate information of the contour pixel point, the corresponding pixel point is located in the target color image, and the color of the located pixel point in the target color image is used to color the corresponding contour pixel point in the first line drawing until all the contour pixels in the first line drawing are recolored.
[0045] In other embodiments, it can be in accordance with Figure 3 The process shown determines the color of each contour line in the first line drawing at the corresponding position in the target color image: Step 310: Perform semantic segmentation on the foreground in the target color image to obtain a semantic segmentation map, which includes multiple semantic objects.
[0046] Image semantic segmentation models can be used to perform semantic segmentation on the foreground of a target color image. In a semantic segmentation image, different colored masks represent different semantic objects. For example, different body parts, different people, or different objects are considered different semantic objects. Different colored masks correspond to the pixel regions containing different semantic objects, while pixel regions containing the same semantic object are represented by masks of the same color.
[0047] It's worth noting that the color of each semantic object in the semantic segmentation image (i.e., the color of the corresponding mask) may differ from the color of that semantic object in the target color image. For example, Figure 4 The semantic segmentation map generated from the target color image shown in ① is as follows: Figure 4 As shown in Figure ②, it can be seen that the mask representing the left balloon in this semantic segmentation graph is gray, while... Figure 4 In the target color image, the balloon on the left is red; for example, Figure 4 In the color image of the target, the balloon on the right is yellow, but in the semantic segmentation map, the mask representing the balloon on the right is black. It's worth noting that... Figure 4 In the diagrams other than the target color image, the black outer border is only used to indicate the outer boundary of the corresponding image and is not considered as image content.
[0048] In some embodiments, considering the varying accuracy of different image semantic segmentation models in semantic segmentation of images with different subject categories, an applicable image semantic segmentation model for each subject category can be pre-defined. Then, the image semantic segmentation model corresponding to the subject category of the target color image is determined, and the determined image semantic segmentation model is used to perform semantic segmentation on the foreground in the target color image. For example, the deeplabv3 model or the Sapiens model can be used for semantic segmentation of images belonging to the "people" category, and the sam2 model can be used for semantic segmentation of images belonging to the third subject category.
[0049] Step 320: Perform color clustering based on the color of the corresponding region of each semantic object in the semantic segmentation map in the target color image to obtain the target color of each semantic object.
[0050] The semantic segmentation map indicates the location of the pixel region where each semantic object is located. Thus, based on the location of the pixel region where each semantic object is located indicated by the semantic segmentation map, the pixel region at the same location can be located in the target color image, and the color of each pixel in the located pixel region can be obtained accordingly. Then, the colors of all pixels in the located pixel region are clustered to determine the dominant color of the located pixel region, which is used as the target color of the semantic object to which the pixel region belongs.
[0051] In some embodiments, the color clustering performed can be based on the color of each pixel in the located pixel region, grouping the pixels in the pixel region to minimize the color difference between different pixels in the same group, while the color difference between pixels in different groups is relatively large. After grouping, the group with the largest number of pixels can be determined, and the average color of the pixels in that group (which can also be understood as the cluster center of the pixel colors in that group) can be used as the dominant color of the located pixel region, that is, the target color of the semantic object to which the pixel region belongs. For example, for Figure 4 In the semantic segmentation diagram shown in ②, according to step 320, the color of the semantic object "balloon" on the left in the pixel region of the target color image can be clustered to obtain that the target color of the semantic object "balloon" on the left is red.
[0052] Step 330: Reset the color of each semantic object in the semantic segmentation map to the corresponding target color to obtain the target semantic segmentation map.
[0053] By resetting the colors of each semantic object in the semantic segmentation image to their corresponding target colors, it can be ensured that the colors of each semantic object in the obtained target semantic segmentation image are basically the same as their colors in the target color image. For example, for Figure 4 The semantic segmentation map shown in ②, after color recoloring, yields the target semantic segmentation map as follows: Figure 4 As shown in ③, compare Figure 4 As can be seen from ③ and ①, the color of the same semantic object in the target color image is the same as the color in the target semantic segmentation map. For example, for the semantic object of the balloon on the left, its color in the target color image is red, and its color in the target semantic segmentation map is also red.
[0054] Step 340: Based on the target semantic segmentation map, determine the color of each contour line in the first line image at the corresponding position in the target color image.
[0055] In some embodiments, the color of the semantic object to which each contour line in the first line drawing belongs, as shown in the color of the target semantic segmentation map, can be used as the color of the corresponding position of that contour line in the target color image. For example... Figure 4 ④ in the middle is to Figure 4 The first line drawing generated by converting the target color image shown in ① into a line drawing. Figure 4 The outline 410 shown in the first line drawing (④) belongs to the semantic object of the balloon on the right. The semantic object of the balloon on the right is... Figure 4 The color of the target semantic segmentation map shown in ③ is yellow. Therefore, the color of the contour line 410 in the target color image is yellow.
[0056] In some embodiments, please continue reading Figure 3 Step 340 includes the following steps 341-343: Step 341: Determine the bounding boxes for each outline in the first line drawing.
[0057] The bounding shape of a contour line is a circumscribed shape that surrounds the contour line, such as a circumscribed rectangle. Figure 4 Example ④ shows a bounding box graphic 420 of the outline 410. After determining the bounding box graphic of each outline in the first line drawing, the position information of the bounding box graphic in the first line drawing can be determined accordingly.
[0058] Step 342: Determine the intersection pixel region between each selected graphic in the target semantic segmentation map and the semantic object in the target semantic segmentation map.
[0059] Based on the positional information of the bounding box, the bounding area defined by that positional information in the target semantic segmentation map can be determined. Then, the intersection of this bounding area and the pixel region containing the semantic object in the target semantic segmentation map is determined; this intersection pixel region is the intersection pixel region. It is understood that this intersection pixel region does not include any pixels in the target semantic segmentation map other than those in the pixel region containing the semantic object.
[0060] Figure 5A An exemplary diagram illustrates an intersection pixel region, which is a region that... Figure 4 The outline 410 of the first line drawing shown in Figure ④ corresponds to the framed graphic 420. Figure 4 The selected region in the semantic segmentation map of the target (i.e. Figure 5A The pixel area enclosed by the dashed rectangle 430), and Figure 4 The intersection of semantic objects in the target semantic segmentation map, and the intersection pixel region 440 is the... Figure 5A The pixel region enclosed by the solid black line. It can be seen that this intersection pixel region 440 includes part of the pixel region of the semantic object "balloon" on the right side of the target semantic pixel image and part of the pixel region of the background in the target semantic segmentation image.
[0061] Step 343: Determine the main color of the intersection pixel region based on the color information of the intersection pixel region, and use the main color as the color of the corresponding contour line at the corresponding position in the target color image.
[0062] Following steps 341-342, for each contour line in the first line image, an intersection pixel region can be determined in the target semantic segmentation image. In some embodiments, the number of pixels corresponding to each color in the intersection pixel region corresponding to each contour line can be counted, and the color with the most pixels can be used as the dominant color of that intersection pixel region. For example, Figure 5A In the intersecting pixel region shown, the color with the most pixels is the color of the semantic object "balloon" on the right in the target semantic segmentation map (i.e., yellow). Therefore, it can be determined that... Figure 4 In the first line drawing shown in Figure ④, the outline 410 is yellow at the corresponding position in the target color image. In some embodiments, the color of the semantic object with the highest percentage of pixels in the intersection pixel region can be used as the main color of the intersection pixel region.
[0063] In other embodiments, for each contour line, the average color of the pixels in the intersection pixel region corresponding to the contour line is calculated and used as the main color of the intersection pixel region.
[0064] After the above process, the colors of each contour line in the first line drawing are determined at their corresponding positions in the target color image. The colors of each contour line in the first line drawing are then adjusted to these determined colors, resulting in the second line drawing. This ensures that the colors representing each contour line in the second line drawing are essentially the same as the main color of the semantic object to which each contour line belongs in the target color image, thus guaranteeing that the colors of the contour lines in the second line drawing satisfy the overall color scheme logic of the target color image. For example, according to... Figure 4 The target semantic segmentation map shown in ③ is for Figure 4 The second line drawing, obtained by recoloring the outlines in the first line drawing shown in ④, can be as follows: Figure 4 As shown in ⑤, compare Figure 4 In the second line drawing, the colors of the outlines ① and ⑤ are the same as the main color of the semantic object to which the outline belongs in the target color image.
[0065] exist Figure 3 In the corresponding embodiment, the target semantic segmentation map is used as an intermediary to determine the color of each contour line at the corresponding position in the target color image by taking the contour line as the unit. Compared with determining the color by taking the pixel point on the contour line as the unit, the color determination efficiency is greatly improved, thereby improving the efficiency of obtaining the second line map.
[0066] Even if the target color image has undergone background removal, some background pixels may still remain. If the outline shapes are mapped to the target color image to determine the outline color, the accuracy of the determined outline color may be affected by the inability to distinguish the pixel positions of semantic objects in the target color image. Semantic segmentation is more accurate than background removal. In the above embodiment, instead of directly mapping the outline shapes in the target color image to determine the color of each outline at its corresponding position in the target color image, the outline shapes in the first line image are mapped to the target semantic segmentation image. This avoids the influence of the colors of remaining background pixels on the accuracy of the determined outline color.
[0067] In some embodiments, considering that some contour lines in the first line drawing may be close to the boundary of the first line drawing, during the processing, the contour lines close to the boundary of the first line drawing may be mistakenly identified as the boundary of the first line drawing, causing subsequent omission of contour lines close to the boundary.
[0068] To avoid this problem, in step 120, the four boundaries of the first line drawing can be expanded outward by a first distance. Figure 5B An exemplary diagram illustrates offsetting the boundary 510 of a first line drawing outward by a first distance L1, with the first bounding box 520 serving as the new boundary of the first line drawing after the outward offset. It is worth noting that the newly added pixel area in the first line drawing after the outward offset, compared to the first line drawing before the outward offset, can be filled with white. Subsequently, within the area defined by the first bounding box 520, a contour detection region is determined. For example, the boundary of the contour detection region can be the boundary after the first bounding box 520 is offset inward by a second distance. Figure 5B As shown, the first bounding box 520 is offset inward by a second distance to obtain the second bounding box 530. The pixel area defined by the second bounding box is used as the contour detection area. The second distance is greater than zero and less than the first distance. The second bounding box 530 can be understood as being obtained by offsetting the boundary 510 of the first line drawing outward by a third distance L2. The third distance is equal to the difference between the first distance and the second distance. This ensures that the size of the determined contour detection area exceeds the size of the first line drawing before the outward offset, ensuring that all contour lines in the first line drawing can be accurately identified without omission. The first distance and the second distance can be set as needed, for example, the first distance is 4 pixels and the second distance is 1 pixel.
[0069] After determining the contour detection region, a blank image with the same size as the first line image after outward offset can be created. After determining the color of each contour line in the first line image at its corresponding position in the target color image, the detected contour lines in the contour detection region are drawn onto the blank image according to the determined colors, resulting in the second line image. Alternatively, the first line image after outward offset can be binarized. The position of each contour line is then detected in the corresponding contour detection region within the binarized first line image, and the detected contour lines are drawn onto the blank image according to their corresponding determined colors.
[0070] Step 130: Determine the contour feature points on each contour line in the second line drawing.
[0071] In step 130, multiple contour feature points are extracted from each contour line in the second line drawing. These extracted contour feature points represent the corresponding contour lines. The contour feature points on each contour line are those that play a crucial role in expressing the curve shape of the contour line. Considering that there are many points on each contour line, retaining a large number of points would complicate the subsequent control logic of the lighting fixtures. Therefore, a smaller number of contour feature points are selected from each contour line in the second line drawing to represent each contour line. Contour feature points include, for example, the endpoints and inflection points of the contour lines.
[0072] In some embodiments, contour points can be sampled starting from the endpoints of each contour line at a preset distance. The sampled contour points (a contour point refers to a pixel on the contour line in the second line drawing) are used as contour feature points of the contour line, and the endpoints of the contour line are also used as contour feature points. The distance between two adjacent contour feature points on the same contour line is equal to the preset distance. In this case, the smaller the preset distance, the more contour feature points are determined.
[0073] In some embodiments, prior to step 130, the method further includes: filtering contour lines in the second line drawing whose length is less than a length threshold, and / or filtering contour lines in the second line drawing whose area of the enclosed closed region is less than an area threshold.
[0074] The length threshold and area threshold can be set as needed to filter out contour lines in the second line image whose length is less than the length threshold. That is, the pixels occupied by contour lines whose length is less than the length threshold are filled with white. In some embodiments, the contour lines in the second line image can be sorted in descending order of length, and the first N contour lines can be selected as the contour lines for which contour feature points need to be extracted. N is an integer greater than 2, and N can be set as needed, for example, N is 15, 20, etc.
[0075] It's worth noting that the outline that encloses a closed region can be a single outline or multiple outlines. If multiple outlines enclose a closed region, and the area of that closed region is less than an area threshold, then these multiple outlines will be filtered out, meaning the pixels occupied by these multiple outlines will be filled with white.
[0076] By filtering shorter contour lines before step 130, and / or filtering contour lines that enclose a small area of the closed region, it is equivalent to filtering out contour lines that have little impact on the pattern, which can reduce the amount of subsequent data processing and improve the efficiency of generating color dot plots.
[0077] In some embodiments, to facilitate the extraction of contour feature points, the second line image can be enhanced before step 130, or after contour filtering of the second line image. At least one of the following enhancements can be performed on the second line image: saturation, brightness, contrast, and sharpness enhancement, to improve the quality of the second line image.
[0078] Step 140: Generate a color dot map based on the coordinate information of each contour feature point in the second line drawing and the color of each contour feature point in the second line drawing.
[0079] In step 140, points can be drawn in a blank image with the same size as the second line drawing, according to the coordinate information of each contour feature point in the second line drawing and the color in the second line drawing, to obtain a color dot map. The points drawn in the color dot map are the determined contour feature points, and the colors are the same as the colors in the second line drawing.
[0080] Step 150: Generate a light emission control signal based on the color dot map. The light emission control signal is used to make the light emission unit present the pattern in the color dot map according to the color of each contour feature point in the color dot map.
[0081] The light emission control signal is generated by the color dot map, ensuring that the light effect presented by the light emission unit according to the light emission control signal is a linear pattern formed by the combination of all the contour feature points in the color dot map. Moreover, the color of the light in each part of the pattern is the color of the contour feature point corresponding to the position of the light in the color dot map. In this way, the color and shape of the final light effect pattern are consistent with those in the color dot map.
[0082] In some embodiments, the light-emitting unit is a laser lamp; correspondingly, step 150 includes: combining the coordinate information and color of each contour feature point in the color dot map to generate a light-emitting control signal, and sending the light-emitting control signal to the laser lamp so that the laser lamp emits laser light of the corresponding color toward the contour feature points in the color dot map according to the color of each contour feature point, so as to present the pattern in the color dot map.
[0083] The coordinate information of each contour feature point in the color dot map is used to control the rotation mechanism of the laser lamp, so that the laser lamp can emit laser light towards the corresponding contour feature point in the color dot map located in the light effect display plane, and the color of the laser light emitted by the laser lamp is the same as the color of the corresponding contour feature point in the color dot map. The laser lamp can emit laser light along the trajectory in the pattern in the color dot map for a relatively short period of time (e.g., not exceeding the visual persistence of the human eye). In this way, due to the visual persistence effect of the human eye, the human eye can see the same laser pattern light effect as the color dot map.
[0084] In other embodiments, the light-emitting unit may include multiple LEDs arranged in rows and columns. Based on this, the mapping relationship between the LEDs in the light-emitting unit and each contour feature point in the color dot map can be determined according to the layout information of the multiple LEDs in the light-emitting unit and the layout information (coordinate information) of the contour feature points in the color dot map. Here, the LED corresponding to a contour feature point is the LED that needs to be illuminated according to the color of that contour feature point. In this way, the LEDs corresponding to each contour feature point in the light-emitting unit can be controlled to illuminate according to the color of each contour feature point, ensuring that when all the LEDs corresponding to all contour feature points are illuminated, the overall lighting effect pattern presented is the pattern in the color dot map.
[0085] In this application, after converting the target color image into a first line drawing, the contour lines in the first line drawing are colored according to the colors of their corresponding positions in the target color image, resulting in a second line drawing. This ensures that the colors of the contour lines in the second line drawing are essentially consistent with their corresponding colors in the target color image, thus enhancing the richness of the contour line colors. Subsequently, based on the coordinate information and colors of the contour feature points on each contour line in the second line drawing, a color dot map is automatically generated, which in turn generates a light emission control signal. The light emission control signal enables the light-emitting units to illuminate according to the colors of the contour feature points in the color dot map, presenting a light effect pattern identical to the pattern in the color dot map, ensuring the richness of the presented light effect pattern colors. The colors of the presented light effect pattern basically follow the color scheme in the target color image, eliminating the need for the user to spend considerable time color matching different contours in the pattern to ensure a reasonable color scheme. The solution proposed in this application enables the automatic generation of a second line drawing based on a target color image, thereby generating a light emission control signal. This eliminates the need for manual drawing of the line drawing and manual color matching of the outlines in the line drawing, effectively solving the problem of low efficiency in manual drawing of line drawings in related technologies.
[0086] In other embodiments, such as Figure 6 As shown, step 130 includes the following steps 610-680: Step 610: Use the second line drawing or the single-pixel width contour drawing as the target line drawing. The single-pixel width contour drawing is obtained by converting the second line drawing into a single-pixel width line drawing.
[0087] In some embodiments, before step 610, the second line image can be denoised. For example, the second line image can be converted into a grayscale image and then blurred using a Gaussian kernel to reduce noise.
[0088] In some embodiments, if the second line drawing is used as the target line drawing, the target line drawing may be broken and filled before step 620.
[0089] Step 620: Obtain each contour line in the target line drawing as the target contour line. That is, take each contour line in the target line drawing as the target contour line, and determine the corresponding contour feature points for each contour line.
[0090] Step 630: Obtain two contour points with different positions in the target contour line as the first contour point and the second contour point, respectively.
[0091] Step 640: Add the first contour point and the second contour point to the feature point set.
[0092] The first contour point and the second contour point are two contour points at different positions on the target contour line. They can be two endpoints on the target contour line or two contour points at other positions. In some embodiments, when the target line drawing is a second line drawing, if the contour line in the second line drawing is thicker, the contour line in the second line drawing will occupy multiple pixels in the width direction. Correspondingly, each contour point on the target contour line may also occupy multiple pixels in the second line drawing. In this case, any one of the multiple pixels occupied by the contour can be used as the first contour point or the second contour point. That is, the coordinates of the first contour point (or the second contour point) are the coordinates of the selected pixel representing the corresponding endpoint.
[0093] Step 650: Calculate the distance from each intermediate contour point on the target contour line to the target line. The intermediate contour point is the contour point on the target contour line located between the first contour point and the second contour point; the target line is the line connecting the first contour point and the second contour point.
[0094] Step 660: Determine the intermediate contour point that is furthest from the line connecting to the target, and use it as the maximum distance point; Step 670: Determine whether the distance from the maximum distance point to the target line is greater than the distance threshold; if yes, proceed to step 680; if no, proceed to step 690.
[0095] The distance threshold can be set as needed. It is understood that the size of this distance threshold directly affects the number of contour feature points determined for each contour line. The smaller the distance threshold, the more contour feature points are determined; the larger the distance threshold, the fewer contour feature points are determined. In some embodiments, the distance threshold can be selected specifically based on the length of the contour line. For example, the distance threshold can be set to 0.0005 × the length of the contour line.
[0096] Step 680: Use the maximum distance point as the dividing point to divide the target contour line, and use the two sub-contour lines obtained by the division as the new target contour line, and use the two endpoints of the new target contour line as the new first contour point and the second contour point; then return to step 640.
[0097] If the distance from the maximum distance point to the target line is greater than a distance threshold, it indicates that the maximum distance point is an important feature point on the contour line and needs to be retained. Therefore, the target contour line is segmented using the maximum distance point as the segmentation point. The two sub-contour lines obtained from the segmentation are used as the new target contour line, and the two endpoints of each new target contour line are used as the new first contour point and second contour point. Then, the process returns to step 640. It is understandable that since the target contour line is segmented using the maximum distance point, this maximum distance point is also used as the endpoint of the two sub-contour lines obtained from the segmentation. After returning to step 640, this maximum distance point is added to the feature point set.
[0098] Step 690: Take the contour points in the feature point set as the contour feature points of the corresponding contour lines.
[0099] Following the process described above, a set of feature points can be determined for each target contour line. The contour points in this set serve as the contour feature points of the corresponding target contour line. Then, all the contour feature points of each contour line can be used to represent that contour line, resulting in multiple contour feature points determined for each contour line.
[0100] In some embodiments, the coordinates of each contour point can be integerized based on the coordinate information of each contour point in the feature point set to eliminate floating-point errors.
[0101] In some embodiments, after step 690, the contour feature points of each contour line can be validated to verify whether the number of contour feature points determined for each contour line exceeds a third number. If it exceeds the third number, the validation is passed. The third number can be an integer greater than or equal to 3, and can be set as needed. By ensuring that the number of contour feature points extracted from each contour line exceeds the third number, it is ensured that all contour feature points extracted from a contour line can maintain the geometric properties and shape integrity of the contour line.
[0102] In some embodiments, the target line drawing is a contour drawing with a single pixel width; such as Figure 7 As shown, prior to step 620, the method further includes: Step 710: Fill in the gaps in the second line drawing to obtain the third line drawing.
[0103] First, the second line image can be converted to grayscale. Then, using a preset color threshold (e.g., 127), the grayscale image can be binarized and inverted to obtain a reference binarized image. The usual binarization process is: if a pixel's value is greater than the color threshold, the pixel is set to white (pixel value 255); if the pixel's value is not greater than the color threshold, the pixel is set to black (pixel value 0). The binarization and inversion process reverses the result of the conventional binarization; that is, if a pixel's value is greater than the color threshold, the pixel is set to black (pixel value 0); if the pixel's value is not greater than the color threshold, the pixel is set to white (pixel value 255). This way, in the final reference binarized image, the white outline represents the foreground, and the black outline represents the background.
[0104] Subsequently, a morphological closing operation can be performed on the reference binarized image using a 3×3 convolution kernel. This involves first dilating and then eroding the image, thus filling in small holes in the contour lines of the reference binarized image, connecting broken parts, and maintaining the overall contour of the foreground. Through the morphological closing operation, a third line image is obtained. In the third line image, the contour lines are continuous and unbroken. In the third line image, the contour lines (foreground) are white, and the background is black.
[0105] Step 720: Identify the center pixel of the contour pixel region where each contour line is located in the third line image, and set the non-center pixels of the contour pixel region other than the center pixels of the contour to the background to obtain the reference contour image.
[0106] In some embodiments, the center line in the third line image can be extracted using local maxima. Pixels on this center line are then used as the contour center pixels. In other words, the line formed by the contour center pixels preserved in the reference contour image is used as the center line of the contour in the third line image. When the contour line in the third line image is thicker, its width may not be a single pixel. Therefore, the center line in the reference contour image will be narrower than the contour line in the third line image. However, the center line in the reference contour image may also not be a single pixel wide.
[0107] In step 720, the Euclidean distance from each foreground pixel in the third line image to the nearest background pixel can be calculated, thus obtaining a distance matrix. It can be understood that pixels located at the center line of the contour have the largest distance to the nearest background pixel, while pixels located at the edge of the contour have the smallest distance. Therefore, local maximum detection can be used to identify contour center pixels and non-contour center pixels. Specifically, each pixel in the third line image is traversed; if the distance value of a pixel in the distance matrix is the maximum value within its 8-neighborhood, then the pixel is determined to be a contour center pixel; otherwise, it is determined to be a non-contour center pixel.
[0108] In other embodiments, a reference distance threshold can be set. If the distance value corresponding to a pixel in the distance matrix is greater than the reference distance threshold, then the pixel is determined to be the center pixel of the contour; otherwise, the pixel is determined to be a non-center pixel of the contour.
[0109] Step 730: Perform single-pixel thinning on the reference contour map to obtain a contour map with a single-pixel width.
[0110] As described above, the center line in the reference contour image may not be a single pixel wide. Therefore, to thin the lines (center line) in the reference contour image pixel by pixel, a skeletonization method can be used to iteratively erode foreground pixels, preserving the central skeleton of the line to obtain a contour image with a single pixel width. In some embodiments, a skeletonization computation library in a scientific computing library can be used to perform pixel-by-pixel thinning on the reference contour image. Alternatively, the Zhang-Suen thinning algorithm can be used to perform pixel-by-pixel thinning on the reference contour image.
[0111] pass Figure 7 This process can convert a second line drawing that may not be a single pixel wide into a contour drawing with a single pixel width.
[0112] In some embodiments, when the target line drawing is a single-pixel-width contour drawing, contour lines with a length less than a length threshold can be filtered out from the single-pixel-width contour drawing after step 730. In this case, line tracing can be performed in the single-pixel-width contour drawing to determine the complete line path, that is, to locate each contour line (center line), thereby determining the length of each contour line, and then filtering out contour lines with a length less than the length threshold.
[0113] For each contour pixel (i.e., the pixel located on the center line, also known as a skeleton point) in a single-pixel width contour map, the number of foreground pixels (white pixels, i.e., pixels located on the center line) within its 8-neighborhood is counted. The number of foreground pixels within the 8-neighborhood of a contour pixel is its degree (also known as connectivity). Then, contour pixels are classified according to their degree: if a contour pixel has a degree of 1, it is an endpoint of the contour line; if a contour pixel has a degree of 2, it is a regular pixel on the contour line (i.e., connected to two other contour pixels and located in the middle segment of the contour line); if a contour pixel has a degree greater than 3, it is located at a branch / intersection of the contour line. During line tracing, starting from the contour pixel belonging to the endpoint, the 8-neighborhood of each contour pixel is traversed in a consistent direction to avoid repetition or random walking, until a contour pixel belonging to the intersection or another endpoint is reached, forming a complete line path, which is considered a contour line, and the length of the contour line can be counted. Then, contour lines whose length is less than the length threshold can be filtered out.
[0114] Figure 8 This is a flowchart illustrating a control method according to another embodiment of this application, such as... Figure 8 As shown, prior to step 120, the method further includes the following steps 810-820: Step 810: Perform image subject classification on the target color image to determine the subject category to which the target color image belongs. The specific implementation process for image subject classification is described above and will not be repeated here. The execution order of steps 810 and 110 is not limited; they can also be executed in parallel.
[0115] If the subject category of the target color image is other than the architecture category, proceed to step 820 to classify the foreground complexity of the target color image and obtain its foreground complexity category. In this case, if the subject category of the target color image belongs to the architecture category, foreground complexity classification of the target color image is not required.
[0116] Correspondingly, if the foreground complexity category of the target color image is the complex image category, then step 120 and subsequent steps are executed. The process of classifying the subject of the target color image is described above and will not be repeated here.
[0117] When the target color image does not belong to the building category, and its foreground complexity category is the complex image category, it means that there are multiple objects in the foreground of the target color image, and they are basically objects other than buildings. In this case, if multiple objects use the same color, it is not easy for users to distinguish them when the lighting effect is presented. Moreover, if colors are randomly assigned in this case, it may lead to an unreasonable overall color scheme in the final lighting effect pattern, resulting in a poor viewing experience for users. Therefore, in this case, following the process of step 120, the contour lines in the first line image are colored according to the colors of the corresponding positions of each contour line in the target color image to obtain the second line image, and then further processed. This ensures that the colors of the contour feature points representing the contour lines of each object in the subsequent color point image follow the color scheme in the target color image. This allows different objects to be distinguished by color, and the overall color scheme of the pattern representing multiple objects is also harmonious, ensuring a good viewing experience for users when the lighting effect is presented.
[0118] In some embodiments, please continue reading Figure 8 The method further includes at least one of steps 830 and 840: if the subject category to which the target color image belongs is the building category, then step 830 is performed to reset all the outlines in the first line drawing to the same color to obtain the second line drawing.
[0119] When the target color image belongs to the architecture category, it means that the foreground object in the target color image is a building. For representing building lighting effects, complex colors are usually unnecessary. Therefore, based on this need, all outlines in the first line drawing can be reset to the same color to obtain the second line drawing. In some embodiments, a color can be selected from one or more preset colors suitable for buildings as a reference color, and then all outlines in the first line drawing can be reset to this reference color. For example, a color can be selected from candidate colors such as red, orange, yellow, green, cyan, blue, and purple as the reference color. In other embodiments, the average color of the foreground pixel region in the target color image can also be calculated, and this average color can be used as the reference color.
[0120] If the foreground complexity category of the target color image is a simple image category, then step 840 is executed to reset the different contour lines in the first line image to different colors to obtain the second line image.
[0121] When the subject category of the target color image is not architecture and its foreground complexity category is simple image, it indicates that the number of objects in the foreground of the target color image is small. In this case, different contour lines in the first line drawing are assigned different colors to distinguish contour lines representing different objects or different parts. In some embodiments, colors can be assigned to different contour lines in the first line drawing from a preset pool of candidate colors to ensure that different contour lines use different colors.
[0122] In some embodiments, for target color images whose subject category is not architecture and whose foreground complexity category is simple image, the CLIPasso model can be used to convert the target color image into a line graph. Before performing the line graph conversion, the number of lines needs to be input to limit the number of contour lines in the first line graph. For example, if the number of input lines is 8, the output first line graph includes 8 contour lines. Correspondingly, different colors are assigned to the 8 contour lines in the first line graph. For example, the following 8 colors are assigned to the 8 contour lines: yellow (255, 255, 0), dark red (128, 0, 0), dark green (0, 128, 0), dark blue (0, 0, 128), orange (255, 165, 0), purple (128, 0, 128), brown (165, 42, 42), and pink (255, 192, 203).
[0123] In other embodiments, the M colors with the most pixels in the foreground pixel region of the target color image can be determined based on the number of contour lines in the first line drawing (assumed to be M), and then the determined M colors can be assigned to each contour line in the first line drawing for coloring.
[0124] In the above embodiments, a differentiated coloring strategy is used to color the outlines in the first line drawing according to the subject category and foreground complexity category to which the target color image belongs. This allows users to meet their color presentation needs for light effect patterns belonging to different subject categories and different foreground complexity categories.
[0125] In other embodiments, if the color scheme of the presented lighting effect pattern is required to meet the color scheme of the target color image, each target color image can be arranged according to... Figure 1 The illustrated embodiment processes the data without distinguishing between subject categories and foreground complexity categories to select different coloring strategies.
[0126] The following describes an apparatus embodiment of this application, which can be used to perform the methods described in the above embodiments of this application. For details not disclosed in the apparatus embodiments of this application, please refer to the method embodiments described in the above embodiments of this application.
[0127] Figure 9 This is a block diagram of a control device according to an embodiment of this application, such as... Figure 9 As shown, the control device includes: a conversion module 910 for converting a target color image into a line drawing to obtain a first line drawing; a coloring module 920 for coloring the contour lines in the first line drawing according to the colors of the corresponding positions of each contour line in the target color image to obtain a second line drawing; wherein the colors of each contour line in the second line drawing are the same as the colors of the corresponding positions in the target color image; a contour feature point determination module 930 for determining the contour feature points on each contour line in the second line drawing; a color dot map generation module 940 for generating a color dot map according to the coordinate information and colors of each contour feature point in the second line drawing; and a control module 950 for generating a light emission control signal based on the color dot map, wherein the light emission control signal is used to cause the light emission unit to present the pattern in the color dot map according to the colors of each contour feature point in the color dot map.
[0128] In some embodiments, the control device further includes: a semantic segmentation module, used to perform semantic segmentation on the foreground in the target color image to obtain a semantic segmentation map, the semantic segmentation map including multiple semantic objects; a color clustering module, used to perform color clustering based on the color of the corresponding region of each semantic object in the semantic segmentation map in the target color image to obtain the target color of each semantic object; a color reset module, used to reset the color of each semantic object in the semantic segmentation map to the corresponding target color to obtain a target semantic segmentation map; and a color determination module, used to determine the color of each contour line in the first line drawing at the corresponding position in the target color image based on the target semantic segmentation map.
[0129] In some embodiments, the color determination module includes: a first determination unit, configured to determine the bounding boxes of each contour line in the first line drawing; a second determination unit, configured to determine the bounding box region corresponding to each bounding box in the target semantic segmentation image, and the intersection pixel region between the bounding box region and the semantic object in the target semantic segmentation image; and a third determination unit, configured to determine the main color of the intersection pixel region based on the color information of the intersection pixel region, and use the main color as the color of the corresponding contour line at the corresponding position in the target color image.
[0130] In some embodiments, the contour feature point determination module 930 is configured to: use a second line drawing or a single-pixel width contour drawing as the target line drawing, wherein the single-pixel width contour drawing is obtained by converting the second line drawing into a single-pixel width line drawing; obtain each contour line in the target line drawing as the target contour line; obtain two contour points at different positions in the target contour line as the first contour point and the second contour point, respectively; add the first contour point and the second contour point to the feature point set; calculate the distance from each intermediate contour point on the target contour line to the target line, wherein the intermediate contour point is the contour point on the target contour line located between the first contour point and the second contour point; The target line is the line connecting the first contour point and the second contour point; the intermediate contour point with the largest distance to the target line is determined as the maximum distance point; if the distance from the maximum distance point to the target line is greater than the distance threshold, the maximum distance point is used as the segmentation point to segment the target contour line, and the two sub-contour lines obtained by the segmentation are used as the new target contour line, and the two endpoints of the new target contour line are used as the new first contour point and the second contour point, and the step of adding the first contour point and the second contour point to the feature point set is returned; if the distance from the maximum distance point to the target line is not greater than the distance threshold, the contour points in the feature point set are used as the contour feature points of the corresponding contour line.
[0131] In some embodiments, the target line drawing is a contour drawing with a single pixel width; the control device further includes: a break-filling module for filling breaks in the second line drawing to obtain a third line drawing; an identification processing module for identifying the contour center pixel of the contour pixel region where each contour line in the third line drawing is located, and setting the non-contour center pixels in the contour pixel region other than the contour center pixel as the background to obtain a reference contour drawing; and a single-pixel thinning processing module for performing single-pixel thinning processing on the reference contour drawing to obtain a contour drawing with a single pixel width.
[0132] In some embodiments, the control device further includes: a filtering module for filtering contour lines in the second line drawing whose length is less than a length threshold, and / or filtering contour lines in the second line drawing whose area of the enclosed closed region is less than an area threshold.
[0133] In some embodiments, the light-emitting unit is a laser lamp; the control module 950 is configured to generate a light-emitting control signal based on the coordinate information and color of each contour feature point in the color dot map, and send the light-emitting control signal to the laser lamp so that the laser lamp emits laser light of the corresponding color toward the contour feature points in the color dot map according to the color of each contour feature point, so as to present the pattern in the color dot map.
[0134] In some embodiments, the control device further includes: a subject classification module, configured to classify the subject of the target color image to determine the subject category to which the target color image belongs; a foreground complexity classification module, configured to classify the foreground complexity of the target color image if the subject category to which the target color image belongs is a subject category other than the building category, to obtain the foreground complexity category to which the target color image belongs; correspondingly, the coloring module 920 is configured to: if the foreground complexity category to which the target color image belongs is a complex image category, then color the contour lines in the first line drawing according to the colors of the corresponding positions of each contour line in the target color image to obtain a second line drawing.
[0135] In some embodiments, the control device further includes at least one of the following: a first reset module, configured to reset all contour lines in the first line drawing to the same color to obtain a second line drawing if the subject category to which the target color image belongs is the building category; and a second reset module, configured to reset different contour lines in the first line drawing to different colors to obtain a second line drawing if the foreground complexity category to which the target color image belongs is the simple image category.
[0136] This application also provides a controller, including a processor and a memory, wherein the memory stores computer-readable instructions, which, when executed by the processor, implement the control method described above.
[0137] Figure 10 This is a block diagram of a lighting device according to an embodiment of this application. The electronic device may include: a processor 1010, a memory 1020, and a light-emitting unit (not shown in the figure). The memory 1020 stores computer-readable instructions. When the computer-readable instructions are executed by the processor 1010, the lighting device can be used to implement the method in any of the above method embodiments.
[0138] The light-emitting unit can be a laser light, an LED light with a laser module (such as a projection light or a stage light), or a planar light fixture as mentioned above, etc., without being specifically limited here.
[0139] The processor 1010 may include one or more processing cores. The processor 1010 connects to various parts of the lighting device using various interfaces and lines, and performs various functions and processes data of the lighting device by running or executing instructions, programs, code sets, or instruction sets stored in the memory 1020, and by calling data stored in the memory 1020. Optionally, the processor 1010 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 1010 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 1010 and may be implemented separately through a communication chip.
[0140] The memory 1020 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 1020 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function, instructions for implementing the various method embodiments described below, etc. The data storage area may also store data generated during the use of the lighting device.
[0141] This application also provides a computer-readable storage medium storing computer-readable instructions thereon, which, when executed by a processor, implement the method in any of the above method embodiments.
[0142] Computer-readable storage media can be electronic storage devices such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. Optionally, computer-readable storage media includes non-transitory computer-readable storage medium. The computer-readable storage medium has storage space for computer-readable instructions that perform any of the method steps described above. These computer-readable instructions can be read from or written to one or more computer program products. The computer-readable instructions can be compressed, for example, in a suitable form.
[0143] According to one aspect of the embodiments of this application, a computer program product is provided, the computer program product including computer-readable instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer-readable instructions from the computer-readable storage medium, and the processor executes the computer-readable instructions, causing the computer device to perform the methods of any of the above embodiments.
[0144] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0145] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, touch terminal, or network device, etc.) to execute the methods according to the embodiments of this application.
[0146] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein.
[0147] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A control method, characterized in that, include: The target color image is converted into a line drawing to obtain the first line drawing; Based on the color of each contour line in the first line drawing at the corresponding position in the target color image, the contour lines in the first line drawing are colored to obtain a second line drawing, wherein the color of each contour line in the second line drawing is the same as the color of the corresponding position in the target color image; Identify the contour feature points on each contour line in the second line drawing; A color dot map is generated based on the coordinate information of each contour feature point in the second line graph and the color of each contour feature point in the second line graph; A light emission control signal is generated based on the color dot map. The light emission control signal is used to make the light emission unit present the pattern in the color dot map according to the color of each contour feature point in the color dot map.
2. The method according to claim 1, characterized in that, Before coloring the contour lines in the first line image according to the colors of their corresponding positions in the target color image, to obtain the second line image, the method further includes: Semantic segmentation is performed on the foreground in the target color image to obtain a semantic segmentation map, which includes multiple semantic objects. Based on the color of the corresponding region of each semantic object in the semantic segmentation map in the target color image, color clustering is performed to obtain the target color of each semantic object; The color of each semantic object in the semantic segmentation map is reset to the corresponding target color to obtain the target semantic segmentation map; Based on the target semantic segmentation map, determine the color of each contour line in the first line image at the corresponding position in the target color image.
3. The method according to claim 2, characterized in that, The step of determining the color of each contour line in the first line image at the corresponding position in the target color image based on the target semantic segmentation map includes: Determine the bounding boxes for each outline in the first line drawing; Determine the intersection pixel region between each of the selected shapes in the target semantic segmentation map and the semantic object in the target semantic segmentation map; Based on the color information of the intersection pixel region, the main color of the intersection pixel region is determined, and the main color is used as the color of the corresponding position of the outline in the target color image.
4. The method according to claim 1, characterized in that, The step of determining the contour feature points on each contour line in the second line drawing includes: The second line drawing or a single-pixel width contour drawing is used as the target line drawing, wherein the single-pixel width contour drawing is obtained by converting the second line drawing into a single-pixel width line drawing. Obtain each contour line in the target line drawing as the target contour line; Two contour points with different positions in the target contour line are obtained as the first contour point and the second contour point, respectively. Add the first contour point and the second contour point to the feature point set; Calculate the distance from each intermediate contour point on the target contour line to the target connecting line, wherein the intermediate contour point is a contour point on the target contour line located between the first contour point and the second contour point; the target connecting line is the line connecting the first contour point and the second contour point. The intermediate contour point that is the furthest from the line connecting the target is determined as the maximum distance point; If the distance from the maximum distance point to the target line is greater than the distance threshold, the maximum distance point is used as the dividing point to divide the target contour line. The two sub-contour lines obtained by the division are used as the new target contour line. The two endpoints of the new target contour line are used as the new first contour point and the second contour point. Then, the step of adding the first contour point and the second contour point to the feature point set is returned. If the distance from the maximum distance point to the target line is not greater than the distance threshold, the contour points in the feature point set are used as the contour feature points of the corresponding contour line.
5. The method according to claim 4, characterized in that, The target line drawing is a contour drawing with a single pixel width; the method further includes: The second line drawing is broken and filled to obtain the third line drawing; Identify the center pixel of the contour pixel region where each contour line is located in the third line image, and set the non-center pixels in the contour pixel region other than the center pixel of the contour to the background to obtain a reference contour image. The reference contour map is thinned by a single pixel to obtain a contour map with the width of the single pixel.
6. The method according to claim 1, characterized in that, Before determining the contour feature points on each contour line in the second line drawing, the method further includes: Filter out contour lines in the second line graph whose length is less than a length threshold, and / or filter out contour lines in the second line graph whose area of the enclosed closed region is less than an area threshold.
7. The method according to any one of claims 1 to 6, characterized in that, Before coloring the contour lines in the first line image according to the colors of their corresponding positions in the target color image, to obtain the second line image, the method further includes: The target color image is classified into image themes to determine the theme category to which the target color image belongs; If the subject category to which the target color image belongs is a subject category other than architecture, perform foreground complexity classification on the target color image to obtain the foreground complexity category to which the target color image belongs; The step of coloring the contour lines in the first line image according to the colors of the corresponding positions of each contour line in the target color image to obtain the second line image includes: If the foreground complexity category to which the target color image belongs is the complex image category, then the contour lines in the first line image are colored according to the colors of the corresponding positions of each contour line in the target color image, to obtain the second line image.
8. The method according to claim 7, characterized in that, The process of classifying the foreground complexity of the target color image to obtain the foreground complexity category to which the target color image belongs includes: Obtain a complexity classification prompt, which includes definition text for complex image category and simple image category. The definition text indicates that in an image belonging to complex image category, the number of foreground objects is not less than a first number, and there are at least a second number of foreground objects in the image whose pixel area ratio exceeds a preset area ratio, and the second number does not exceed the first number. Based on the complexity classification prompts and the multimodal large model, the foreground complexity of the target color image is classified, and the foreground complexity category to which the target color image belongs is output.
9. The method according to claim 7, characterized in that, The method further includes at least one of the following: If the subject category of the target color image is architecture, then all the outlines in the first line drawing are reset to the same color to obtain the second line drawing; If the foreground complexity category of the target color image is a simple image category, then the different contour lines in the first line drawing are reset to different colors to obtain the second line drawing.
10. A controller, characterized in that, It includes a processor and a memory, wherein the memory stores computer-readable instructions that, when executed by the processor, implement the method as described in any one of claims 1 to 9.
11. A lighting device, characterized in that, include: processor; A memory storing computer-readable instructions, which, when executed by the processor, generate a light-emitting control signal according to any one of claims 1 to 9; The light-emitting unit is used to present a lighting effect according to the light-emitting control signal.
Citation Information
Patent Citations
Generation method of lamp strip modeling graph, electronic equipment and storage medium
CN119741399A
Image processing method and electronic equipment
CN120543682A
Method for setting illumination light
US20170265267A1
Image based lighting control
US20180279440A1