This application claims priority to Japanese Patent Application No. 2012-236179, filed Oct. 26, 2012, the content of which is hereby incorporated herein by reference in its entirety.
The present disclosure relates to a device that is capable of generating embroidery data for performing embroidery sewing by a sewing machine, as well as to a non-transitory computer-readable medium that stores computer-readable instructions that cause a device to generate embroidery data.
A device is known that is capable of generating embroidery data for embroidery sewing, by a sewing machine, of a design that is based on data for an image such as a photograph or the like. The device may generate the embroidery data by the procedure hereinafter described, for example. First, based on the image data, the device calculates angle characteristics for various parts of the image, and strengths of the angle characteristics. The device arranges line segments in accordance with the calculated angle characteristics and the strengths. The device sets thread colors that correspond to the individual line segments and connects the line segments that have the same thread color. The device generates the embroidery data by converting data for the line segments into data that indicate stitches. The device selects the thread colors that correspond to the individual line segments from among a set of n thread colors that have been set in advance as the thread colors that will actually be used when the embroidery sewing is performed.
In a case where an image such as a photograph or the like is expressed in the form of an embroidery design, the number of the thread colors that are actually used is generally around ten. It is therefore important to select, from among approximately one-hundred thread colors that a user can prepare, the approximately ten thread colors that are best suited to expressing the original image. The device that is described above performs processing that reduces the colors of the original image to N colors, then selects as the used thread colors, from among the thread colors that the user can prepare, a set of n thread colors, each of which is close to one of the N colors. However, in a case where the selected set of n colors includes a plurality of colors that appear to the human eye to be similar, the number of colors that can be expressed by the set of n thread colors as a whole is less than in a case where the set of n thread colors includes only mutually dissimilar colors.
Various embodiments of the broad principles derived herein provide a device that is capable of generating embroidery data by selecting, from among thread colors that can be used, thread colors that are suitable for expressing the original image, and also provide a non-transitory computer-readable medium that stores computer-readable instructions that cause a device to generate the embroidery data.
Various embodiments herein provide a device that includes a processor and a memory. The memory is configured to store a plurality of group information pieces respectively identifying a plurality of groups, the number of thread colors to be used in embroidery sewing, and computer-readable instructions. Each of the plurality of group information pieces is associated with one or more thread colors among a plurality of thread colors. The computer-readable instructions cause the processor, when executed, to perform processes that includes acquiring image data including a plurality of pixels, the image data representing an image, replacing, based on the image data, a color of each one of the plurality of pixels with a thread color from the plurality of thread colors, calculating a frequency of using each of the plurality of thread colors, based on the colors of the plurality of pixels after the replacing of the colors, selecting, until the number of thread colors selected from the plurality of thread colors is equal to the number of thread colors to be used stored in the memory, one thread color from each of the plurality of group information pieces sequentially, based on the plurality of group information pieces stored in the memory and on the calculated frequency of using each of the plurality of thread colors, and generating embroidery data for forming stitches in the selected thread colors by a sewing machine, based on the image data and the selected thread colors.
Various embodiments also provide a non-transitory computer-readable medium storing computer-readable instructions. When executed by a processor of a device, the computer-readable instructions cause the processor to perform processes that includes acquiring image data including a plurality of pixels, the image data representing an image, replacing, based on the image data, a color of each one of the plurality of pixels with a thread color from a plurality of thread colors, calculating a frequency of using each of the plurality of thread colors, based on the colors of the plurality of pixels after the replacing of the colors, selecting, until the number of thread colors selected from the plurality of thread colors is equal to the number of thread colors to be used stored in a memory, one thread color from each of a plurality of group information pieces sequentially, based on the plurality of group information pieces and on the calculated frequency of using each of the plurality of thread colors, and generating embroidery data for forming stitches in the selected thread colors by a sewing machine, based on the image data and the selected thread colors. The plurality of group information pieces are stored in the memory and respectively identify a plurality of groups. Each of the plurality of group information pieces is associated with one or more thread colors among the plurality of thread colors.
Embodiments will be described below in detail with reference to the accompanying drawings in which:
Hereinafter, a first embodiment will be explained with reference to
The embroidery data generation device 1 may be a dedicated device that only generates the embroidery data. The embroidery data generation device 1 may also be a general-purpose device such as a personal computer or the like. In the present embodiment, a general-purpose form of the embroidery data generation device 1 is explained as an example. As shown in
The I/O interface 14 performs mediation of data transfers. A hard disk device (HDD) 15, a mouse 22, which is an input device, a video controller 16, a key controller 17, an external communication interface 18, a memory card connector 23, and an image scanner 25 are connected to the I/O interface 14.
A display 24, which is a display device, is connected to the video controller 16. A keyboard 21, which is an input device, is connected to the key controller 17. The external communication interface 18 is an interface that enables connection to a network 114. The embroidery data generation device 1 can connect to an external device through the network 114. A memory card 55 can be connected to the memory card connector 23. Through the memory card connector 23, the embroidery data generation device 1 is able to read data from the memory card 55 and write data to the memory card 55.
Storage areas in the HDD 15 will be explained. As shown in
The embroidery data generation program may be stored in the program storage area 153 after being acquired from outside through the network 114. In a case where the embroidery data generation device 1 is provided with a DVD drive, the embroidery data generation program may be stored in a medium such as a DVD or the like and may be read and then stored in the program storage area 153.
Data on setting values that are to be used by various types of processing may be stored in the setting values storage area 154. As an example of the setting values data in the present embodiment, data are stored that relate to one or more groups of one or more thread colors that have been classified in advance by a person. Each group includes one or more of a plurality of thread colors that are usable in embroidery sewing. Hereinafter, a thread color that is usable in embroidery sewing will be called a usable thread color. In the present embodiment, a thread color table is stored in the setting values storage area 154 as the data relating to the one or more groups of the one or more thread colors. The thread color table is a table that is generated by classifying the plurality of usable thread colors in advance, based on the criteria of whether or not a color appears similar to the human eye to another color.
The thread color table that is shown as an example in
The generation of the thread color table, that is, the dividing of the usable thread colors into groups, may be performed in response to inputs by a user of the embroidery data generation device 1, for example, at least before the embroidery data generation processing is started. In this case, the user may divide the usable thread colors into groups while looking at the usable thread colors from the beginning. Alternatively, based on data that indicate the RGB values for the usable thread colors, the CPU 11 may first group together the usable thread colors among which the distance in the RGB space is not greater than a specified threshold value. The CPU 11 may then perform processing that takes a color within the group that is specified by the user specifies to be dissimilar to the other colors and puts the color into a different group. The thread color table does not necessarily have to be generated by the user. The thread color table may also be generated in advance by an operator at an embroidery thread manufacturer, and provided to the user afterward, for example.
The thread color table in
The sewing machine 3, which is capable of sewing an embroidery pattern that is based on the embroidery data, will be briefly explained with reference to
When embroidery sewing is performed, a user of the sewing machine 3 mounts an embroidery frame 41 that holds a work cloth onto a carriage 42 that is disposed on the bed 30. The embroidery frame 41 may be moved by a Y direction moving mechanism (not shown in the drawings) that is contained in the carriage 42 and by an X direction moving mechanism (not shown in the drawings) that is contained in a main case 43 to a needle drop point that is indicated by an XY coordinate system that is unique to the sewing machine 3. In conjunction with the moving of the embroidery frame 41, a shuttle mechanism (not shown in the drawings) and a needle bar 35 to which a sewing needle 44 is attached may be operated, thereby forming an embroidery pattern on the work cloth. Note that the Y direction moving mechanism, the X direction moving mechanism, the needle bar 35, and the like may be controlled based on the embroidery data by a CPU (not shown in the drawings) that is built into the sewing machine 3. In the present embodiment, the embroidery data are data that indicate the coordinates of the needle drop points, the sewing order, and the colors of the embroidery threads to be used in order to form the stitches of the embroidery pattern.
A memory card slot 37 in which the memory card 55 can be removably inserted is provided on the right side face of the pillar 36 of the sewing machine 3. The embroidery data that have been generated by the embroidery data generation device 1, for example, may be stored in the memory card 55 through the memory card connector 23. Then the memory card 55 may be inserted in the memory card slot 37 of the sewing machine 3, and the embroidery data that are stored in the memory card 55 may be read out and stored in the sewing machine 3. Based on the embroidery data that have been read from the memory card 55, the CPU of the sewing machine 3 may control the operation of the sewing of the embroidery pattern by the Y direction moving mechanism, the X direction moving mechanism, the needle bar 35, and the like. Thus the sewing machine 3 is able to sew the embroidery pattern based on the embroidery data that have been generated by the embroidery data generation device 1.
The embroidery data generation processing that is performed by the embroidery data generation device 1 according to the first embodiment will be explained with reference to
As shown in
Based on the acquired image data, the CPU 11 calculates an angle characteristic and a strength of the angle characteristic for each of the plurality of pixels that make up the original image (Step S2). The angle characteristic is information that indicates a direction in which continuity of the color within the image is high. The strength of the angle characteristic is information that indicates a magnitude of a change in the color. The CPU 11 may use any sort of method to calculate the angle characteristic and the strength of the angle characteristic. For example, the CPU 11 can calculate the angle characteristic and the strength of the angle characteristic using the method that is described in detail in Japanese Laid-Open Patent Publication No. 2001-259268, the relevant portion of which is incorporated herein by reference. Other than that method, the CPU 11 may also calculate the angle characteristic and the strength of the angle characteristic using a Prewitt operator or a Sobel operator.
Based on the angle characteristics and the strengths of the angle characteristics that have been calculated, the CPU 11 performs processing that arranges line segments, then stores data that specify the line segments (hereinafter called the line segment data) in the RAM 12 (Step S3). The CPU 11 may use any sort of method to arrange the line segments based on the angle characteristics and the strengths of the angle characteristics. For example, the CPU 11 can use the method that is described in detail in Japanese Laid-Open Patent Publication No. 2001-259268, the relevant portion of which is incorporated herein by reference.
Next, the CPU 11 performs thread color setting processing (Step S4). The thread color setting processing is processing that, from among the plurality of N usable thread colors, sets colors of a plurality of threads that will actually be used in embroidery sewing. Hereinafter, the colors of the threads that will actually be used in embroidery sewing will be called used thread colors.
The thread color setting processing will be explained in detail with reference to
The CPU 11 performs color reduction processing (Step S12). The color reduction processing in the present embodiment is processing that replaces a color of each one of the plurality of pixels that make up the original image with one of the N usable thread colors that are contained in the thread color table (refer to
Approximate color conversion may be more appropriate in a case where the colors of the original image will be reproduced in a single color. Dithering may be more appropriate in a case where the original image will be reproduced using mixed color expression that simulates intermediate colors by using a plurality of colors. However, mixed color expression by embroidery threads is not able to express intermediate colors as accurately as can be done by dithering in ordinary image processing. Accordingly, at Step S12, the CPU 11 may use approximate color conversion in a case where the resolution of the original image is higher than a specified threshold value and may use dithering in a case where the resolution is not higher than a specified threshold value, for example.
The CPU 11 then calculates a frequency of using each of the usable thread colors, based on the colors of the pixels after the color reduction processing (Step S13). Specifically, for each of the usable thread colors, the CPU 11 counts the number of pixels that have the same RGB values as the usable thread color. The CPU 11 sets the number of pixels that are counted for the usable thread color as the frequency of using that usable thread color. The frequency of using a usable thread color will be hereinafter called a use frequency for the usable thread color.
The CPU 11 sets a first threshold value T1 (Step S14) and sets a second threshold value T2 (Step S15). In selection processing that will be described later, the first threshold value T1 is used for excluding a group from the selection of the used thread colors in a case where the total value of the use frequencies for all of the one or more usable thread colors that belong to the group (hereinafter also simply called the total value of the group use frequencies) is not greater than the first threshold value T1. In the selection processing that will be described later, the second threshold value T2 is used for excluding a usable thread color from the selection of the used thread colors in a case where the use frequency for the usable thread color is not greater than the second threshold value T2. The CPU 11 may set the first threshold value T1 and the second threshold value T2 to values that are respectively determined in advance and stored in the setting values storage area 154 of the HDD 15. The CPU 11 may also set the first threshold value T1 and the second threshold value T2 to values that are respectively input by the user. The CPU 11 stores in the RAM 12 the first threshold value T1 and the second threshold value T2 that have been set.
Next, the CPU 11 performs the selection processing (Step S20). The selection processing is processing that sets priority orders for the groups in descending order of the total values of the use frequencies for the individual groups, then selects, as the used thread colors, the usable thread color with the highest use frequency within each group, processing the groups in sequence, according to the priority orders, until the number of the used thread colors reaches the number of used thread colors M.
The selection processing will be explained in detail with reference to
Based on the use frequencies for the usable thread colors that were calculated at Step S13, the CPU 11 calculates the total value of the use frequencies for each group and stores the total values in the RAM 12 (Step S24). Specifically, the CPU 11 refers to the thread color table (refer to
In the present embodiment, based on the thread color table that is stored in the setting values storage area 154, on the use frequencies that were calculated at Step S13, on the total values of use frequencies that were calculated at Step S24, and on the priority orders that were set at Step S25, the CPU 11 generates a use frequency table such as shown in
The use frequency table that is shown in
The CPU 11 sets a variable i to 1 and stores the variable i in the RAM 12 (Step S31). The variable i is a variable that specifies the group that is an object of the processing in accordance with the priority order that was set at Step S25. In other words, at Step S31, the group for which 1 was set as the priority order (group 3 in the example in
In a case where none of the two conditions is satisfied (NO at Step S32), the CPU 11 advances the processing to Step S41, which will be described later. In other words, in a case where the variable b1 has been set such that the first threshold value T1 is to be used and GH(S(i)) is not greater than the first threshold value T1, the group that is the object of the processing (hereinafter called an object group) is excluded from the selection of the used thread colors. On the other hand, in a ease where at least one of the two conditions is satisfied (YES at Step S32), the CPU 11 advances the processing to Step S33 in order to select a used thread color from the object group S(i).
The CPU 11 determines whether or not a usable thread color that can be selected, that is, a usable thread color that has not yet been selected as a used thread color, is remaining in the object group (Step S33). In a case where the processing has been repeated several times and all of the usable thread colors in the object group have been selected as used thread colors (NO at Step S33), the CPU 11 advances the processing to Step S41.
In a case where there is a usable thread color in the object group that has not yet been selected (YES at Step S33), the CPU 11 refers to the use frequency table in the RAM 12 and specifies the usable thread color with the highest use frequency among the unselected usable thread colors (Step S34). For example, in a case where the use frequency table in
In a case where a plurality of usable thread colors have the highest use frequency, the CPU 11 may specify any one of those usable thread colors. In the present embodiment, in that case, the CPU 11 specifies the first usable thread color in the order in which the colors are registered in the thread color table (alphabetical order in the example in
The CPU 11 determines whether or not at least one of the two conditions described below is satisfied (Step S35). The first condition is that the variable b2 that is stored in the RAM 12 is zero, that is, that the variable b2 has been set such that the first threshold value T2 is not to be used. The second condition is that the use frequency HTx for the usable thread color Tx is greater than the second threshold value T2.
In a case where none of the two conditions is satisfied (NO at Step S35), the CPU 11 advances the processing to Step S41. In other words, in a case where the variable b2 has been set such that the second threshold value T2 is to be used and the use frequency HTx is not greater than the second threshold value T2, the usable thread color Tx is excluded from the selection of the used thread colors. On the other hand, in a case where at least one of the two conditions is satisfied (YES at Step S35), the CPU 11 selects, as a used thread color, the usable thread color Tx that was specified at Step S34, stores information that identifies the usable thread color Tx in the RAM 12, sets the value of the use frequency HTx to zero in the use frequency table, and adds 1 to the value of the variable c (Step S36). The CPU 11 determines whether or not the variable c is less than the number of used thread colors M (Step S37). In a case where the variable c is less than the number of used thread colors M (YES at Step S37), the number of selections has not reached the number of used thread colors M. In that case, the CPU 11 advances the processing to Step S41. At Step S41, the CPU 11 adds 1 to the value of the variable i to set the next group in the priority order as the object of the processing.
Next, the CPU 11 determines whether or not the variable i has exceeded the number of groups G, that is, whether or not all of the groups have been the object of a full round of the processing (Step S42). If the variable i has not exceeded the number of groups G (NO at Step S42), there are still one or more groups that have not been made the object of the processing, so the CPU 11 returns to the processing at Step S32. For as long as the number of selections has not reached the number of used thread colors M, the CPU 11 repeats the processing at Steps S32 to S42, making each of the remaining groups the object of the processing one at a time.
In a case where the number of groups G is not less than the number of used thread colors M, the total value of the use frequencies for each of the groups is greater than the first threshold value T1, and each of the groups includes a usable thread color for which the use frequency is greater than the second threshold value T2, the selection of M used thread colors can be completed in the first round of processing for all of the groups. In that case, the variable c, that is, the number of selections, reaches the number of used thread colors M (NO at Step S37). Accordingly, the CPU 11 terminates the selection processing and returns to the thread color setting processing in
On the other hand, in a case where the number of used thread colors M is greater than the number of groups G, the variable i exceeds the number of groups G (YES at Step S42) in a state in which the number of selections has not reached the number of used thread colors M. In the same manner, the variable i may also exceed the number of groups G (YES at Step S42) in a case where, for one or more of the groups, the total values of the use frequencies or the use frequencies of the usable thread colors do not satisfy their respective specified conditions, even though the number of groups G is not less than the number of used thread colors M. In those cases, the selection of M used thread colors is not completed in the first round of processing.
The CPU 11 determines whether or not the variable c and the variable c1 are equal (Step S43). The variable c1 was set to the same value as the variable c at Step S22, and has not been changed. On the other hand, if the processing at Steps S32 to S42 has been performed for each of the G groups and one or more used thread colors have been selected, the variable c has been changed to a value that corresponds to the number of the used thread colors that have been selected. Accordingly, in a case where a used thread color has been selected, the variable c and the variable c1 are different from one another (NO at Step S43). In that case, the CPU 11 returns the processing to Step S22 and starts a second round of processing.
Note that at Step S22, the CPU 11 once again sets the variable c1 to the variable c, so the variable c1 becomes the number of selections, that is, the number of the used thread colors that have already been selected. Furthermore, in the preceding round of the processing at Step S36, the use frequency HTx for the usable thread color Tx that was selected as a used thread color was reset to zero. Accordingly, in the second and subsequent rounds of the processing at Step S24, the calculating of the total values of the use frequencies by the CPU 11 is equivalent to the calculating of the total values of the use frequencies for the groups, excluding the use frequencies for the usable thread colors in each group that have already been selected as used thread colors. In the second and subsequent rounds of the processing at Steps S24 and S25, the total values of the use frequencies and the priority orders that were previously stored in the RAM 12 are replaced by the newly calculated total values of the use frequencies and priority orders.
In a case where not even one used thread color has been selected, even after the processing at Steps S32 to S42 has been performed for all of the individual groups, the variable c remains to be equal to the variable c1 (YES at Step S43). In that case, the CPU 11 cannot select M used thread colors for as long as the first threshold value T1 and the second threshold value T2 continue to be used. Accordingly, in a case where the variable b1 is 1, that is, the variable b1 is set such that the first threshold value T1 is to be used (YES at Step S44), the CPU 11, by setting the variable b1 to zero, sets the variable b1 such that the first threshold value T1 is not to be used (Step S45). The CPU 11 returns to the processing at Step S31 and performs the full round of the processing that was described above, in order, starting with the group S(1) with the highest priority order. In this case, the variable b1 is zero (YES at Step S32), so even if the total value GH(S(i)) of the use frequencies for the object group S(i) is not greater than the first threshold value T1, the group S(i) is not excluded from the selection of the used thread colors.
Even if the variable b1 is set at Step S45 such that the first threshold value T1 is not to be used, in a case where the use frequencies of the unselected usable thread colors in all of the groups are not greater than the second threshold value T2 (NO at Step S35), not even one used thread color is selected. Accordingly, even if the processing at Steps S32 to S42 is performed for all of the individual groups, the variable c remains to be equal to the variable c1 (YES at Step S43). In that case, the variable b1 is zero (NO at Step S44). Accordingly, the CPU 11, by setting the variable b2 to zero, sets the variable b2 such that the second threshold value T2 is not to be used (Step S46).
The CPU 11 returns to the processing at Step S31 and performs the full round of the processing that was described above, in order, starting with the group S(1) with the highest priority order. In this case, the variable b2 is zero (YES at Step S35), so even if the highest use frequency HTx among the use frequencies for the unselected usable thread colors in the object group S(i) is not greater than the second threshold value T2, the usable thread color Tx is not excluded from the selection of the used thread colors.
In this manner, the CPU 11 repeats the processing that selects, as a used thread color, one of the usable thread colors from each of the groups, in accordance with the priority orders of the groups. When the number of selections reaches the number of used thread colors M (NO at Step S37), the CPU 11 terminates the selection processing and returns to the thread color setting processing in
As shown in
The CPU 11 performs color assignment processing that sets the colors of the line segments that were arranged at Step S3 (Step S5). Based on the image data for the original image, for each of the line segments, the CPU 11 selects, from among the M used thread colors that were set by the thread color setting processing, one color that reflects the color in the original image and sets that color as the color of the line segment. The colors of the line segments will be the colors of the actual stitches. The CPU 11 performs processing that generates line segment data for each of the used thread colors by sequentially connecting the line segments that have the same used thread color, among the plurality of line segments to which the colors have been assigned (Step S6). The CPU 11 defines the two end points of one line segment as a starting point and an ending point, respectively, of a stitch. The CPU 11 then locates the end point of another line segment of the same color that is in the position that is closest to the ending point of the first line segment, and defines that end point as the starting point of the next stitch. The CPU 11 connects the line segments by repeating this process.
The CPU 11 generates the embroidery data based on the line segment data that was generated for each of the used thread colors at Step S6 (Step S7). The CPU 11 calculates the coordinates of the needle drop points by converting the coordinates of the end points of each line segments into the coordinates of the XY coordinate system that is unique the sewing machine 3. The CPU 11 also defines the order in which the line segments are connected as the sewing order for the needle drop points. In this manner, the CPU 11 generates the embroidery data that indicate the coordinates of the needle drop points, the sewing order, and the used thread colors. The CPU 11 then terminates the embroidery data generation processing that is shown in
As explained above, in the present embodiment, the plurality of usable thread colors are classified in advance by a person into one or more groups, and the thread color table, which contains the information of the one or more groups, are stored in the setting values storage area 154 of the HDD 15. A person can store the thread color table, in which usable thread colors that appear similar to the human eye are classified as belonging to the same group, in the HDD 15, as in the present embodiment. In other words, two colors that would be classified by calculation as not similar, but that appear to the human eye to be sufficiently similar, can be classified into the same group.
The CPU 11 calculates the use frequency for each of the plurality of usable thread colors based on the colors of the pixels in the original image, each color having been replaced by one of the plurality of usable thread colors. The CPU 11 sequentially selects, as a used thread color, one of the usable thread colors from each of the groups until the number of the selected used thread colors (the number of selections) reaches the number of the thread colors (the number of used thread colors M) that will actually be used in the embroidery sewing. More specifically, the CPU 11 sets the priority orders for the groups based on the total values of the use frequencies, and then selects, as the used thread color, the usable thread color with the highest use frequency in each group, processing the groups in descending order of the priority orders.
In a case where an image such as a photograph or the like is expressed in the form of an embroidery design, the image cannot be expressed in as much detail as can be done with pixels, because of limitations on the embroidery threads and the thicknesses of the needles. It is also a reality that the number of the thread colors (the number of used thread colors M) that are actually used in the embroidery sewing is significantly fewer than the number of colors in the pixels. It is therefore important to select, from among the N usable thread colors, the M used thread colors that are most suitable for expressing the original image
For example, if, from among the N usable thread colors for which the use frequencies were calculated at Step S13, the CPU 11 simply selects the M used thread colors in descending order of the use frequencies, it is possible that the CPU 11 selects a plurality of colors that appear to the human eye to be similar. In that case, the overall number of colors that can be expressed by the M used thread colors is made smaller. Therefore, this selection may not be the optimum selection of the used thread colors. This sort of situation may occur even if the CPU 11 performs processing that does not select colors whose distance from one another in the RGB space is less than a specified threshold value, because the calculated similarity of the colors does not necessarily match the similarity as seen by the human eye. For example, a dark gray color and a dark brown color that appear quite similar to the human eye are separated by a considerable distance in the RGB space. For that reason, the dark gray color and the dark brown color can both be selected as used thread colors.
In contrast to this, in the present embodiment, the groups are classified in advance according to the similarity of the colors as seen by the human eye, as explained above. Therefore, the result is that colors that do not appear to be particularly similar are sequentially selected one at a time from each group, creating a good balance. Accordingly, classifying a dark gray color and a dark brown color that appear similar to the human eye into the same group in advance, for example, reduces the possibility that both colors will be selected as two of the limited number of the used thread colors. Thus, according to the embroidery data generation device 1 of the present embodiment, the embroidery data can be generated by selecting, from among the plurality of usable thread colors, thread colors that are suitable for expressing the original image.
Furthermore, in a case where the number of selections does not reach the number of used thread colors M in the first round of the processing for all of the groups, the CPU 11 re-calculates the total values of the use frequencies for the individual groups, with the use frequencies of the used thread colors that have already been selected being excluded. The CPU 11 then re-sets the priority orders based on the newly calculated total values. The CPU 11 selects the color with the highest use frequency among the unselected usable thread colors in each group, processing the groups in descending order of the newly calculated priority orders.
For example, in a case where usable thread colors Y and Z are contained in a group X that contains only those two usable thread colors, and the use frequency for the usable thread color Y is significantly higher than that for the usable thread color Z, it may happen that the total value of the use frequencies for the group X is the highest of all the groups, even if the use frequency of the usable thread color Z is lower than the use frequencies of the usable thread colors in the other groups. However, after the usable thread color Y is selected in the first round of the processing, the use frequency of the usable thread color Y is excluded when the total value of the use frequencies for the group X is calculated again, so the priority order for the group X drops. Therefore, a usable thread color with the highest use frequency in a different group with a higher priority order is selected as a used thread color before the usable thread color Z in the group X. Thus, according to the embroidery data generation device 1 of the present embodiment, the used thread colors can be selected in the second and subsequent rounds of the processing by appropriately taking into account the total use frequencies for the groups and the use frequencies of the individual usable thread colors.
Furthermore, in the present embodiment, the CPU 11 performs the selecting of the used thread colors by first excluding any group for which the total value of the use frequencies is not greater than the first threshold value T1 and any usable thread color for which the use frequency is not greater than the second threshold value T2. In a case where the number of the selected used thread colors has not reached the number of used thread colors M as a result, the CPU 11 stops the use of the first threshold value T1 and the second threshold value T2 in that order.
A low total value of the use frequencies for a group means that all of the usable thread colors that belong to the group are colors that are not to be used very much for expressing the colors of the original image. Therefore, using the first threshold value T1 to select a used thread color from a group for which the total value of the use frequencies is fairly high before selecting a used thread color from the group with the low total value makes it possible to select used thread colors that are more suitable for expressing the original image. A low use frequency for a usable thread color means that the color is not to be used very much for expressing the colors of the original image, even if that usable thread color has a relatively high use frequency within the group. Therefore, using the second threshold value T2 to give priority to selecting, as a used thread color, the usable thread color for which the use frequency is fairly high makes it possible to select used thread colors that are more suitable for expressing the original image.
In the present embodiment, an example is explained in which both the first threshold value T1 and the second threshold value T2 are used. However, the CPU 11 may also use only one of the first threshold value T1 and the second threshold value T2 in the selection processing in
Hereinafter, a second embodiment will be explained with reference to
As shown in
The selection processing in the second embodiment will be explained in detail with reference to
The CPU 11 sets the variable i to 1 and stores the variable i in the RAM 12 (Step S53). In the present embodiment, the variable i is a variable that specifies the object group in accordance with the order in which the groups are registered in the thread color table. In other words, at Step S53, the first group that is registered in the thread color table (group 1 in the example in
The CPU 11 sets to zero and stores in the RAM 12 variables HTmax, Tmax, and Gmax, which are to be used in the process of selecting one used thread color from each of the G groups (Step S54). The variable HTmax is a variable for specifying the highest use frequency among the use frequencies for all of the usable thread colors. The variable Tmax is a variable for specifying the usable thread color with the highest use frequency among all of the usable thread colors. The variable Gmax is a variable for specifying the group to which the usable thread color with the highest use frequency among all of the usable thread colors belongs.
By referring to the selection flag that is stored in the RAM 12, the CPU 11 determines whether or not a used thread color has been selected from the group G(i) (Step S56). In a case where the selection flag is still zero, as it was set at Step S52, a used thread color has not yet been selected from the group G(i) (NO at Step S56). In that case, the CPU 11 specifies the usable thread color Tx that has the highest use frequency among the usable thread colors that belong to the group G(i) (Step S57).
The CPU 11 determines whether or not the use frequency HTx for the usable thread color Tx that was specified at Step S57 is greater than the variable HTmax (Step S58). In the processing of the first group G(1), HTmax is zero, as it was set at Step S54. Therefore, if the use frequency HTx is not zero, HTx will be greater than the variable HTmax (YES at Step S58). In that case, the CPU 11 sets the variables HTmax, Tmax, and Gmax to the values of HTx, Tx, and G(i), respectively (Step S59). In other words, information that indicates the highest use frequency that has been found up to this point, the corresponding usable thread color, and the group to which the usable thread color belongs is stored in the RAM 12.
The CPU 11 adds 1 to the variable i, thereby setting the next group that is registered in the thread color table as the object of the processing (Step S60). Next, the CPU 11 determines whether or not the variable i has exceeded the number of groups G, that is, whether or not all of the groups have been the object of a full round of the processing (Step S61). If the variable i has not exceeded the number of groups G (NO at Step S61), there are still one or more groups that have not been made the object of the processing, so the CPU 11 returns to the processing at Step S56. The CPU 11 performs the processing for the next object group as described above.
In a case where a used thread color has not yet been selected from the next group G(i) (NO at Step S56), the CPU 11 specifies the usable thread color Tx that has the highest use frequency in the group G(i) (Step S57). In a case where, in a previous round of the processing at Step S59, the use frequency of the usable thread color with the highest use frequency in the group that is registered before the group G(i) was stored as the variable HTmax, then if the use frequency HTx for the usable thread color Tx in the group G(i) is greater than the variable HTmax (YES at Step S58), the CPU 11 sets the variables HTmax, Tmax, and Gmax to the values of HTx, Tx, and G(i), respectively, that were set at Step S57. In other words, if the CPU 11 finds a usable thread color that has a higher use frequency than the use frequency for the previously processed group or groups, the CPU 11 updates the variables HTmax, Tmax, and Gmax.
On the other hand, if a usable thread color that has a higher use frequency than the use frequency for the previously processed group or groups is not found, the use frequency HTx is not greater than the variable HTmax (NO at Step S58). The CPU 11 then advances to the processing at Step S60 and sets the next group as the object of the processing.
Thus, when the CPU 11 has completed a full round of the processing at Steps S56 to S60 for all of the G groups, the variable i is greater than the number of groups G (YES at Step S61). The CPU 11 selects, as a used thread color, the usable thread color that is specified by the variable Tmax that is stored in the RAM 12 (Step 66). The CPU 11 also sets to zero the use frequency for the usable thread color that was selected as the used thread color, which is the use frequency that is specified by the variable HTmax, and adds 1 to the value of the variable c (Step S66). The CPU 11 determines whether or not the variable c is less than the number of used thread colors M (Step S67). In a case where the variable c is less than the number of used thread colors M (YES at Step S67), the CPU 11 sets to 1 the selection flag for the group that is indicated by the variable Gmax, thereby indicating that a used thread color has been selected from the group that is indicated by the variable Gmax (Step S68).
Based on whether or not all of the selection flags in the RAM 12 indicate 1, the CPU 11 determines whether or not one used thread color has been selected from every one of the G groups (Step S69). In a case where one or more groups remain for which a used thread color has not been selected (NO at Step S69), the CPU 11 once again sets the variable i to 1 (Step S53). The CPU 11 then resets each of the variables HTmax, Tmax, and Gmax to zero (Step S54), and repeats the previously described processing at Steps S56 to S61 for each of the G groups. In a case where the CPU 11 returns the processing to Step S53, the groups from which used thread colors have already been selected are excluded from the selecting of the used thread colors (YES at Step S56). In other words, the CPU 11 performs the selecting of the used thread colors by giving priority to groups from which the number of used thread colors that have already been selected is lower.
In a case where the number of groups G is not less than the number of used thread colors M, the variable c, that is, the number of selections, reaches the number of used thread colors M when the CPU 11 has selected the used thread colors one at a time from M groups among the G groups (NO at Step S67). In that case, the CPU 11 terminates the selection processing in
On the other hand, in a case where the number of groups G is less than the number of used thread colors M, the variable c, that is, the number of selections, remains to be less than the number of used thread colors M (YES at Step S67), when the CPU 11 completes the selecting of the used thread colors one at a time from all of the G groups (YES at Step S69). In this case, the CPU 11, in order to select another used thread color, returns the processing to Step S52 and sets all of the G groups as groups from which a used thread color has not been selected. The CPU 11 repeats the same processing for as long as the variable c is less than the number of used thread colors M. In this case, the use frequencies for the usable thread colors that have already been selected as the used thread colors were set to zero in previous rounds of the processing at Step S66, so the color with the highest use frequency among the unselected usable thread colors is selected from each of the groups in order. When the variable c, that is, the number of selections, reaches the number of used thread colors M (NO at Step S67), the CPU 11 terminates the selection processing in
As explained above, in the present embodiment, the plurality of usable thread colors are divided into one or more groups in advance according to the similarity as seen by the human eye, in the same manner as in the first embodiment. From each of the G groups, the CPU 11 selects a color with the highest use frequency among the N usable thread colors, giving priority to a group from which the fewest number of usable thread colors have already been selected as the used thread colors, until the number of selections reaches the number of used thread colors M. Accordingly, in the same manner as in the first embodiment, colors that do not appear to be particularly similar are sequentially selected one at a time from each group, creating a good balance. Therefore, according to the embroidery data generation device 1 of the present embodiment, the embroidery data can be generated by selecting, from among the plurality of usable thread colors, thread colors that are suitable for expressing the original image.
Furthermore, in the present embodiment, unlike in the first embodiment, the priority orders for the groups are not set according to the total values of the use frequencies. It is therefore possible to select used thread colors that better reflect the use frequencies for the individual usable thread colors.
Hereinafter, the third embodiment will be explained with reference to
The thread color table that is used in the present embodiment will be explained with reference to
The thread color table in the present embodiment is created by a person by dividing the plurality of usable thread colors into groups of colors that appear to be similar, and then dividing the usable thread colors that belong to each of the groups into sub-groups of colors that appear to be even more similar. Note that in a case where only one color belongs to a group, the number of sub-groups is one. The number of sub-groups is also one in a case where the person who classifies the usable thread colors has determined that all of the plurality of usable thread colors that belong to the particular group appear to be very similar to one another, as in group 4 in
The selection processing in the present embodiment will be explained with reference to
In the present embodiment, in the processing at Steps 13 and S71 to S74 described above, the CPU 11 generates and stores in the RAM 12 a use frequency table like the example that is shown in
The use frequency table that is shown in
The CPU 11 sets a variable SSi(i) (where i is an integer from 1 to G) to 1 (Step S75). The variable SSi(i) is a variable for specifying the second priority order of the sub-group at which a search will be started within each group. The CPU 11 sets to zero the variable c for counting the number of selections (Step S76). The CPU 11 sets to 1 the variable i for specifying the object group according to the first priority order (Step S81). In other words, the group for which 1 has been set as the first priority order (group 3 in the example in
The CPU 11 determines whether or not a selectable usable thread color is remaining within the object group S(i) (Step S82). In a case where the processing has been repeated several times and all of the usable thread colors in the object group have been selected as used thread colors (NO at Step S82), the CPU 11 advances the processing to Step S111.
The CPU 11 sets a variable j to the value of the variable SSi(i) and sets a variable k to the value of the variable j (Step S83). The variable j is a variable for specifying the sub-group that is the object of the processing in accordance with the second priority orders within the object group S(i). The variable k is a variable that indicates whether or not the sub-group that is the object of the processing (hereinafter called the object sub-group) has already been processed. Hereinafter, within the group S(i) with the i-th first priority order, the sub-group with the j-th second priority order will also be referred to as the sub-group SS(i, j). In the first round of the processing, the variable SSi(i) has been set to 1 at Step S75, as described previously, so the CPU 11 sets the variable j to 1 at Step S83. Thus, within the group with the first priority order of 1, the sub-group with the second priority order of 1 (the sub-group 1 within the group 3 in
The CPU 11 determines whether or not there is a selectable usable thread color remaining in the object sub-group SS(i, j) (Step S84). In a case where there is a selectable usable thread color (YES at Step S84), the CPU 11, by referring to the use frequency table in the RAM 12, specifies the usable thread color with the highest use frequency among the unselected usable thread colors (Step S86). For example, in a case where the use frequency table in
Note that because every one of the sub-groups contains one or more usable thread colors, in the first round of processing, if the number of groups G is not less than the number of used thread colors M, the CPU 11 determines, for every one of the sub-groups, that there is a selectable usable thread color (YES at Step S84).
The CPU 11 selects, as a used thread color, the usable thread color Tx that was specified at Step S86, stores information that identifies the usable thread color Tx in the RAM 12, sets the value of the use frequency HTx to zero in the use frequency table, and adds 1 to the value of the variable c (Step S87). The CPU 11 adds 1 to the variable j and sets the variable SSi(i) to the resulting value (Step S88). Thus the sub-group at which the next search will start is changed to the sub-group with the next second priority order within the same group.
The CPU 11 determines whether or not the variable SSi(i) has exceeded the number of sub-groups SG (Step S89). For example, there is only one sub-group in group 4 in
At Step S91, the CPU 11 determines whether or not the variable c, that is the number of selections, is less than the number of used thread colors M. In a case where the variable c is less than the number of used thread colors M (YES at Step S91), the CPU 11 adds 1 to the value of the variable i to set the next group in the first priority order as the object of the processing (Step S111). Next, the CPU 11 determines whether or not the variable i has exceeded the number of groups G, that is, whether or not all of the groups have been the object of a full round of the processing (Step S112). If the variable i has not exceeded the number of groups G (NO at Step S112), there are still one or more groups that have not been made the object of the processing, so the CPU 11 returns to the processing at Step S82. The CPU 11 performs the processing described above for the next group.
In this way, the CPU 11 completes the full round of the processing at Steps S82 to S91 and S111 to S112 for all of the G groups, and when a used thread color has been selected from one of the sub-groups in every one of the groups, the variable i exceeds the number of groups G (YES at Step S112). The CPU 11 returns the processing to Step S81 in order to select another used thread color and once again sets, as the object of the processing, the group for which the first priority order is 1.
In the second and subsequent rounds of processing, for any group in which one or more sub-groups remain that have not been made the object of the processing, the next sub-group at which the search will start is set based on the variable SSi(i) that was changed in the preceding round of the processing at Step S88, as described previously. Accordingly, in the second round of the processing for the object group S(1), for example, the CPU 11 selects the usable thread color with the highest use frequency from the object sub-group SS(1, 2). For example, in a case where the use frequency table in
In a case where the number of groups G is less than the number of used thread colors M and the result of the performing of the second and subsequent rounds of processing is that there is no unselected usable thread color remaining in the object sub-group SS(i, j) (NO at Step S84), the CPU 11 adds 1 to the variable j, thereby changing the object sub-group to the next sub-group in the second priority order within the same object group S(i) (Step S101).
The CPU 11 determines whether or not the variable j has exceeded the number of sub-groups SG (Step S102). In a case where the variable j has exceeded the number of sub-groups SG (YES at Step S102), there is no sub-group remaining in the object group S(i) that can be made the object of the processing. Accordingly, the CPU 11 resets the variable j to 1 (Step S103) and advances the processing to Step S104. In a case where the variable j has not exceeded the number of sub-groups SG (NO at Step S102), there are one or more sub-groups that can be made the object of the processing. Accordingly, the CPU 11 advances the processing to Step S104 without resetting the variable j.
The CPU 11 determines whether or not the variable j is equal to the variable k (Step S104). In a case where the processing has been completed for the object sub-group SS(i, j), the variable k was set to the variable j in the preceding round of the processing at Step S83. Accordingly, in a case where the variable j is equal to the variable k (YES at Step S104), the CPU 11 advances the processing to Step S111 and sets the next group in the first priority order as the object of the processing. In a case where the variable j is not equal to the variable k (NO at Step S104), the CPU 11 returns the processing to Step S84 and performs the processing for the next sub-group.
For as long as the variable c is less than the number of used thread colors M, the CPU 11 repeats the processing in the same manner. When the variable c, that is, the number of selections, reaches the number of used thread colors M (NO at Step S91), the CPU 11 terminates the selection processing in
As explained above, in the present embodiment, the thread color table is generated by dividing the plurality of usable thread colors into one or more groups in advance according to the similarity as seen by the human eye, and then further dividing each of the groups into one or more sub-groups. The CPU 11 calculates the total value of the use frequencies for the usable thread colors in each group (the first total value) and the total value of the use frequencies in each sub-group (the second total value). The CPU 11 sets the priority orders for the groups (the first priority orders) in descending order of the first total values and sets the priority orders for the sub-groups within each group (the second priority orders) in descending order of the second total values.
Processing the groups in order according to the first priority orders, the CPU 11 selects, as a used thread color, an unselected usable thread color with the highest use frequency in the sub-group with the highest second priority order within each group. In a case where the number of selections does not reach the number of used thread colors M, even if one used thread color is selected from each group, the CPU 11 selects a color with the highest use frequency in the sub-group within each group, processing the groups and sub-groups in descending order of the first priority orders and the second priority orders, until the number of selections reaches the number of used thread colors M. In other words, from the sub-group with the highest second total value among the sub-groups from which the fewest number of used thread colors have already been selected, the unselected usable thread color with the highest use frequency is selected.
Accordingly, in the same manner as in the first embodiment, colors that do not appear to be particularly similar are sequentially selected one at a time from each group, creating a good balance. Furthermore, by dividing the groups into sub-groups, the colors that are selected can be evenly distributed, even within each group. For that reason, a richer array of colors can be expressed as a whole. Therefore, according to the embroidery data generation device 1 of the present embodiment, the embroidery data can be generated by selecting, from among the plurality of usable thread colors, thread colors that are suitable for expressing the original image.
In the present embodiment, once the first priority orders and the second priority orders are set based on the first total values and the second total values that are initially calculated, they are not changed thereafter. However, as in the first embodiment, the CPU 11 may also reset the first priority orders and the second priority orders by re-calculating the first total values and the second total values in the second and subsequent rounds of processing, excluding the use frequencies for the usable thread colors that have already been selected as used thread colors. The second threshold value T2 may also be used in the same manner as in the first embodiment.
In the present embodiment, an example has been explained in which the groups are divided into sub-groups of colors that appear to be more similar, but the criteria for dividing the groups into sub-groups does not necessarily have to be the similarity of the colors as seen by the human eye. For example, the sub-groups may be generated based on the saturation of each of the individual usable thread colors. In that case, a person may first divide the plurality of usable thread colors into groups based on the criteria of whether or not the colors appear to be similar. Then the CPU 11 calculates the saturation of each usable thread color based on data that indicate the RGB values for the color. The CPU 11 may divide the usable thread colors in the group into a sub-group 1 including one or more usable thread colors whose calculated saturation are greater than a specified threshold value TS and a sub-group 2 including one or more usable thread colors whose saturation are not greater than the specified threshold value TS. The threshold value TS may be a value that is set in advance, and may also be a value that is designated by the user. Note that a saturation S for a color whose RGB values are (r, g, b) can be calculated based on the equations below.
MAX=max(r,g,b)
MIN=min(r,g,b)
S=(MAX−MIN)/MAX
In a case where mixed color expression is performed by combining a plurality of colors, a color with high saturation (a vivid color) cannot be expressed by including in the combination a color with low saturation (a color that is not vivid). For example, even though a red with low saturation can be expressed by combining a vivid red and a gray with low saturation, a vivid red cannot be expressed by combining a red with low saturation and another color with high saturation. Accordingly, in a case where the sub-groups are defined according to the saturation of the usable thread colors as described above, at Step S74 in
In addition to the saturation, the distance from the median values in the RGB space, that is, the distance from gray, may also be used as the criteria for defining the sub-groups. For example, even though gray can be expressed by combining white and black, neither white nor black can be expressed by using gray. Accordingly, the CPU 11 may define sub-group 1 as one or more usable thread colors whose distance from the median values (128, 128, 128) in the RGB space are greater than a specified threshold value D and define sub-group 2 as one or more usable thread colors whose distance from the median values are not greater than the specified threshold value D, so that a larger number of colors can be expressed by combinations, in the same manner as in the case where the sub-groups are defined based on the saturations of the usable thread colors.
The present disclosure is not limited to the embodiments that have been described above, and various types of modifications can be made. For example, in the embodiments described above, examples are explained in which, in the selecting of the used thread colors, priority is given to the usable thread color with a higher use frequency within the group. However, the priority orders may also be set by a different method whose objective is to select M used thread colors that are more uniformly distributed in the color space. An example of such a selection method will hereinafter be described.
For example, the CPU 11 calculates the use frequency for each usable thread color in the same manner as in the first embodiment and the second embodiment. Then, in a case where the number of groups G is not less than the number of used thread colors M, that is, in a case where the number of selections will reach the number of used thread colors M if one used thread color is selected from each group, the CPU 11 calculates the median values in the RGB space of the usable thread colors in each group. The CPU 11 gives priority to selecting a usable thread color whose distance from the median values is shortest. The result of this method is that the color that is selected from each group is an average color within the group. Therefore, so M used thread colors can be selected that are more uniformly distributed in the color space.
When the number of the usable thread colors within a group is n, the usable thread colors are respectively thread color 1, the thread color 2, . . . thread color n, the RGB values for the usable thread colors are respectively (r1, g1, b1), (r2, g2, b2), (rn, gn, bn), and the use frequencies for the usable thread colors are respectively h1, hs, . . . hn, the median values (Cr, Cg, Cb) in the RGB space of the usable thread colors that belong to the group can be calculated by the equations below.
Cr=(r1×h1+r2×h2+ . . . m×hn)/(h1+h2+ . . . hn)
Cg=(g1×h1+g2×h2+ . . . gn×hn)/(h1+h2+ . . . hn)
Cb=(b1×h1+b2×h2+ . . . bn×hn)/(h1+h2+ . . . hn)
In a case where the number of groups G is less than the number of used thread colors M, that is, in a case where the number of selections will not reach the number of used thread colors M even if one used thread color is selected from each group, then for every group from which not less than two used thread colors are selected, the CPU 11 calculates the distance in the RGB space between the two colors in every possible combination of two usable thread colors in the group. The CPU 11 selects as the used thread colors the two colors for which the calculated distance for the combination is the greatest. This makes it possible to select used thread colors that are distributed within a broader range in the RGB space. The first color that the CPU 11 selects from each group may also be the usable thread color with the highest use frequency in the group, and the second color that the CPU 11 selects may be the usable thread color that is separated from the first color by the greatest distance.
The method hereinafter described may also be used. In the first round of the processing the CPU 11 selects a usable thread color C1, which has the highest use frequency within the group that has the highest total value of the use frequencies. Then, from the group that has the next-highest total value of the use frequencies, the CPU 11 selects a usable thread color C2, whose distance from the usable thread color C1 in the RGB space is the greatest in that group. Next, from the group that has the next-highest total value of the use frequencies, the CPU 11 selects a usable thread color C3, whose distances from the usable thread color C1 and the usable thread color C2 in the RGB space are the greatest in that group. The CPU 11 repeats this processing until the number of selections reaches the number of used thread colors M. In this case as well, used thread colors can be selected that are distributed within a broader range in the RGB space.
The apparatus and methods described above with reference to the various embodiments are merely examples. It goes without saying that they are not confined to the depicted embodiments. While various features have been described in conjunction with the examples outlined above, various alternatives, modifications, variations, and/or improvements of those features and/or examples may be possible. Accordingly, the examples, as set forth above, are intended to be illustrative. Various changes may be made without departing from the broad spirit and scope of the underlying principles.
Number | Date | Country | Kind |
---|---|---|---|
2012-236179 | Oct 2012 | JP | national |
Number | Name | Date | Kind |
---|---|---|---|
6098554 | Orii et al. | Aug 2000 | A |
6629015 | Yamada | Sep 2003 | B2 |
7587257 | Niimi et al. | Sep 2009 | B2 |
7693598 | Yamada | Apr 2010 | B2 |
8793009 | Ihira | Jul 2014 | B2 |
20100305744 | Yamada | Dec 2010 | A1 |
20110160894 | Yamada | Jun 2011 | A1 |
Number | Date | Country |
---|---|---|
A-2001-259268 | Sep 2001 | JP |
A-2010-273859 | Dec 2010 | JP |
Number | Date | Country | |
---|---|---|---|
20140116308 A1 | May 2014 | US |