1. Field of the Invention
This invention relates to a method and an apparatus for scaling digital data. Specifically, it relates to a method and an apparatus for magnifying and minifying a digital image.
2. Description of the Related Art
The break through computer technologies in recent years has flooded our everyday life with numerous amount of information and we lead a life style surrounded with digital technologies. For example, the digital camera is more and more popular, and the digital data is easy to be operated than the analog data. Therefore, everyone likes to modify their own picture on PC. However, quality and size of the pictures are usually restricted by the apparatus or device capturing the digital image. Consequently, it is used to scale the digital image by image processing technologies for high quality, proper size, or satisfied dpi of a digital image.
This invention provides a data processing apparatus for scaling a first digital data. The data processing apparatus comprises a ratio transformation module for receiving a ratio signal and generating a Look-up Table (LUT) based on the ratio signal; and a scaling module connected to the ratio transformation module for receiving and scaling the first digital data based on the LUT, and outputting a second digital data.
This invention also provides a data processing method for scaling a first digital data. The method comprises receiving a ratio signal and generating a Look-up Table (LUT) based on the ratio signal; and receiving and scaling the first digital data based on the LUT, and outputting a second digital data.
The accompanying drawings are included to provide a further understanding of the invention, and are incorporated in and constitute a part of this specification. The drawings illustrate embodiments of the invention and, together with the description, serve to explain the principles of the invention. In the drawings,
A preferred embodiment is given as following to enable one of ordinary skill in the art to make and use the present invention as provided within the context of a particular application and its requirements. Various modifications to the preferred embodiment will, however, be apparent to one skilled in the art, and the general principles defined herein may be applied to other embodiments. Therefore the present invention is not intended to be limited to the particular embodiments shown and described herein, but is to be accorded the widest herein disclosed.
In one aspect, the present invention is directed to provide a data processing apparatus for receiving a first digital data and scaling the first digital data according to a ratio signal.
In another aspect, the present invention is directed to provide a data processing method for receiving a first digital data and scaling the first digital data according to a ratio signal.
Referring to
The ratio signal 26 shown in
and the ratio transformation module 22 generates a Look-up Table based on
when receiving the ratio signal 26 and obtaining the scaling ratio
As shown in
to accumulate from zero, make an arithmetic sequence comprises
totally n terms. Then the ratio transformation module 22 takes round down operation on each term, counts the number of times each integer appears and records the frequency each integer appears in binary in the corresponding field of sub-segment.
Referring to
for example, received by the ratio transformation module 22, a LUT comprising six fields of sub-segment (0th field of sub-segment, 1st field of sub-segment, . . . , 5th field of sub-segment) will be generated by the ratio transformation module 22 in accordance with the scaling ratio
One embodiment is that the ratio transformation module 22 uses inverse of the scaling ratio
to accumulate from zero, make an arithmetic sequence comprises
totally 5 terms. Then the ratio transformation module 22 takes round down operation on each term, the sequence changes to 0, 1, 2, 4, and 5. According to value of the number corresponding to the field of sub-segment and counts of appearance of the number, we can get the content of field of the sub-segment. For example, the number 0 in the sequence presents one time, so the ratio transformation module 22 records 01 in 0th field of sub-segment, the number 1 in the sequence presents one time, so the ratio transformation module 22 records 01 in 1st field of sub-segment, and so on. However, there is no number 3 in the sequence, the ratio transformation module 22 records 00 in 3rd field of sub-segment thereof By doing so, the LUT is generated by the ratio transformation module 22, which is corresponding to the scaling ratio
In another embodiment, when information of the scaling ratio of the ratio signal 26 is
received by the ratio transformation module 22, a LUT comprising six fields of sub-segment (0th field of sub-segment, 1st field of sub-segment, . . . , 5th field of sub-segment) will be generated by the ratio transformation module 22 in accordance with the scaling ratio
The ratio transformation module 22 uses inverse of the scaling ratio,
to accumulate from zero, make an arithmetic sequence comprises
totally 7 terms. Then the ratio transformation module 22 takes round down operation on each term, the sequence changes 0, 1, 2, 3, 3 and 4. According to value of the number corresponding to the field of sub-segment and counts of appearance of the number, we can get the content of field of the sub-segment. For instance, the number 0 in the sequence presents one time, so the ratio transformation module 22 records 01 in 0th field of sub-segment, the number 1 in the sequence presents one time, so the ratio transformation module 22 records 01 in 1st field of sub-segment, and so on. However, the number 3 presents twice in the sequence, the ratio transformation module 22 records 10 in 3rd field of sub-segment thereof By doing so, the LUT is generated by the ratio transformation module 22, which is corresponding to the scaling ratio
Due to few times of presentation of the number in the sequence, all contents of the LUTs mentioned above are 2 bits. However, the ratio transformation module 22 will give sufficient bits for recording considering the maximum of times of presentation among these numbers. For instance, the scaling ratio is
inverse of the scaling ratio is
and an arithmetic sequence is
After round down, the sequence changes to 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3 and 3, wherein the number 1 and 2 in the sequence present four times respectively, the contents in 1st field of sub-segment and 2nd field of sub-segment are 100 thereof.
Referring to
received by the ratio transformation module 22, the LUT generated in accordance with the scaling ratio and stored in the ratio transformation module 22. The process was described as above, therefore no longer gives unnecessary detail in this. The LUT comprises six fields of sub-segments 32, 34, 36, 38, 40 and 42 corresponds to the sub-segments 32a, 34a, 36a, 38a, 40a and 42a of a digital image source 44 respectively. The sub-segments are sets of the pixels located in the same horizontal direction. There are two bits in each one of the fields of sub-segment; all contents are 01 except 00 in the 38th field of sub-segment. Therefore, the scaling module 24 deletes the sub-segment 38a of the digital image source 44 according to the content in the field of the 38th sub-segment in the LUT, keeps other sub-segments the same, and outputting a processed digital image 45. Repeating the same way on other successive segments, size of the processed digital image 45 is
of the digital image source 44 in the vertical direction.
Referring to
received by the ratio transformation module 22, the LUT generated in accordance with the scaling ratio and stored in the ratio transformation module 22. The process was described as above, therefore no longer gives unnecessary detail in this. The LUT comprises six fields of sub-segments 46, 48, 50, 52,54 and 56 corresponds to the sub-segments 46a, 48a, 50a, 52a, 54a and 56a of a digital image source 58 respectively. The sub-segments are sets of the pixels located in the same horizontal direction. There are two bits in each one of the fields of sub-segment; all contents are 01 except 10 in the 52th field of sub-segment. Therefore, the scaling module 24 duplicates the sub-segment 52a of the digital image source 58 according to the content in the field of the 52th sub-segment in the LUT, places the duplicate followed the 52th sub-segment, then keeps other sub-segments the same, and outputting a processed digital image 45. Repeating the same way on other successive segments, size of the processed digital image 59 is
of the digital image source 58 in the vertical direction.
Referring to
Step S90: receiving a ratio signal and generating a LUT based on the ratio signal.
Step S92: receiving a first digital data.
Step S94: scaling the first digital data based on the LUT.
Step S96: outputting a second digital data.
Referring to
Step 902: utilizing inverse of the scaling ratio as a common difference to accumulate from zero and making an arithmetic sequence comprising at least one term.
Step 904: taking round down operation on each term of the arithmetic sequence for a new sequence comprising terms which are all integers.
Step 906: recording a binary value comprising at least one bit in the corresponding field of sub-segment of the LUT based on the new sequence.
In the step 904, there are many methods to changes the arithmetic sequence except the round down operation, such as round up operation, gauss operation, etc.
Referring to
Step S942: whether the value of the binary number in the field of sub-segment is zero or not; if yes, processing step S944, or processing step S946.
Step S944: deleting the sub-segment corresponding to the field of the sub-segment.
Step S946: duplicating the sub-segment corresponding to the field of the sub-segment based on value of binary number in the corresponding field of the sub-segment as a multiple.
This invention provides an apparatus and a method for scaling a digital data by calculating an arithmetic sequence to generate a LUT according to a ratio signal, duplicating or deleting the sub-segment of the digital data based on the content of the LUT. Comparing to traditional method, such as interpolation, extrapolation, this invention saves operation time, complicated hardware and circuit, also provides simplification, and efficiency.
Finally, those skilled in the art should appreciate that they can readily use the disclosed conception and specific embodiment as a basis for designing or modify other structures for carrying put the same purpose of the present invention without departing from the spirit and scope of the invention as defined by the appended claims.
| Number | Date | Country | Kind |
|---|---|---|---|
| 093107533 | Mar 2004 | TW | national |