• No se han encontrado resultados

IV. ANÁLISIS Y DESARROLLO

4.2 Modelamiento del negocio

An Image Radices

r r r r r r 1 2 3 4 5 6

Number of

Black Pixels White PixelsNumber of Method 1(time) Method 2(time)

Image a 99 99 2875 6926 1.08 secs 0.55 secs

Image a 11 11 3 3 3 3 2875 6926 1.12 secs 1.00 secs

Image b 99 99 3134 6667 1.20 secs 1.05 secs

Image b 3 3 3 3 11 11 3134 6667 1.30 secs 1.20 secs

Image c 99 99 6246 3555 2.29secs 2.17secs

Image c 11 11 3 3 3 3 6246 3555 2.10 secs 2.00 secs

Table 4.3. Comparison betweeen the Linear murray scan and the General murray scan.

As Shown in Table 4.3, the linear murray scan takes less time than the one which breaks an image into the small tiles. In all the cases except the last one (i.e image c),the result is in favour of linear murray scan.The reason for this is, in the case of linear murray scan the whole image is assumed to be of a single block whereas in the general murray scan an image is divided into small tiles each of size r-; *rg and hence finding a particular point of scani in scan2 will take longer. In the case of a linear murray scan we will use only lemma 3 (section 4-2.2), whereas in the case of the general murray scan we have to use both the lemmas given in section 4-2.2, In the case of image c (see Table 4.3), a linear scan takes more time than that of standard murray scan. The reason is that the number of black runlengths obtained by the two scans i.e., a general murray scan and a linear murray scan. With a linear scan the total number of black runlengths obtained is 255, whereas with general

CHAPTER 4. SCAN CONVERSION AND SCALING OF IMAGES.

murray scan this number is 154. Since a general murray scan is frequently changing direction, there will be some long runlengths belonging to an Image, whereas in the case of a linear scan these long runlengths may be broken into a large number of runlengths. Hence this time of processing one large black runlength corresponding to an area will be less than the runlengths which are originated from the same area.

From the above discussion we can conclude that the efficiency corresponding to a linear scan and the general murray scan depend upon the image. But as discussed above, a linear scan has only one tile (i.e. image) to process whereas a standard murray scan has rg^r^* *rn tiles to process, so in most of the case a linear scan will be faster than the standard murray scan. But a large number of radices will have a better chances of exploiting the coherence between the pixels and hence may result in better compression.

4-4 Scaling :

4-4.1 Introduction :

Scaling is the process of expanding or reducing the dimensions of an image. The factor by which an image is enlarged or reduced is called the scaling factor and the operation that changes the size is called scaling. Positive scaling constants Sx and Sy are used to describe changes in length with respect to the x-direction and to the y-direction.lf the scaling factor Is greater than one then this indicates an expansion of length, and if it is less than one, then a reduction of length. In the case of a picture the scaling effects can be obtained by multiplying the x and the y co-ordinate of every point in the picture by their corresponding scaling factors. Figure 4.6 shows scaling transformation with scaling factors Sy = 2 and Sy = 1/2.

CHAPTER 4. SCAN CONVERSION AND SCALING OF IMAGES. Y V ( 1.2 ) (2.2) (4.1) (2 .1) (2.1) , (4.1/2) (2.1/2)

Figure 4.6. Scaling transformation with scaling factor Sx =2 and Sy = 1/2

In the case of a picture the new co-ordinate can either be an integer or a real number. But if we want to scale an image then our scaling factor should be such that it gives integer co-ordinates when multiplied by the co­ ordinates of the image. Exceptionally, a real factor may be used provided it gives an integer co-ordinate. For example 8% = 1/2 , Sy = 1/2 and (x,y) = (2,4). In this case the new co-ordinate will be (1,2), which is acceptable. A scaling factor to be real depends very much on the images also. Consider two images given below.

(a)

(b)

In the case of (a) the aliasing effect will be there, since in some case we have to truncate a real number to get an integer number. But since the

CHAPTER 4. SCAN CONVERSION AND SCALING OF IMAGES.

shape of the image is very irregular, this effect will not be easily seen. Whereas in case of (b) this effect will be very clear since the image is very smooth.Since each point on an image is going to be scaled, the time of

completion will be very large. The computer time can be reduced if we work only on the runlengths encoding of an image, since a large number of pixels belonging to a runlength will be dealt with together. Further if a runlength is not completely divisible by the scaling factor then the remainder term can be added to the next runlength, thus keeping the shape of the image. Here murray scan techniques are used to scale the Images. Different images are scaled up and down and the result corresponding to the different algorithms which uses murray techniques are presented. Finally the algorithm has been compared with those obtained from linear runlength encoding and quadtree encoding.

4-4.2 Scaling using murray polygons and its implementation :

In the next following paragraphs we will discuss an algorithm which uses murray techniques, to scale the images up and down. Later on some modifications to the algorithm are discussed in detail.

Let r-j/r'-j be the rational scaling factor which is to be applied in the x-direction, where r'-j is the x-dimension of initial smallest tile and r-^ is the x-dimension of final smallest tile. The runlengths are obtained by using a murray scan, whose initial movement was in the x-direction. For scaling, each runlength is multiplied by the factor r-j/r'-|. The remainder term will be added into the next runlength. That is if r; is the runlength and Rj_i was the

previous remainder then the new runlength Is (rfr-i+ R j.i) div r’-j and the remainder term which is to be added to the next runlength is given by (rj*r-| + Rj.-f) rem r'-j. For example.

CHAPTER 4. SCAN CONVERSION AND SCALING OF IMAGES.

let 4,3,5, be the runlength encoding for an image where r'-j= 3 and r-j = 5. The scaling factor is given by r'-|/ri. Let x-|, X2, xg are the new runlengths for the enlarged image, where.

Remainder = 0

XI (4*5 + Remainder) div 3

6

Remainder (4*5 + Remainder) rem 3 2 X2 (3*5 + 2) div 3 = 5 Remainder (3*5 + 2) rem 3 = 2 X3 = (5*5 + 2) div 3 = 9 Remainder = 0

The changed runlengths are 6,5,9.

Note: When we reach the corner of a fife the remainder term will be zero. Consider an expression ,

X = a/b

Here the remainder term will be zero if the quantity 'a' is either zero or it is

multiple of b. Let us assume that the initial length of an image is I and the final length is F , where F > I. Since F > I this implies we are distributing F-/ pixels equally in I pixels thus keeping the final size to F. Further if there is a remainder term we add this remainder term to the next runlength, without loosing any information. Hence when we reach the corner of a tile the remainder term will be zero . A lemma has discussed later to prove this . The procedure is given below, which takes a sequence of runlengths and then scales them according to the scaling factor.

CHAPTER 4. SCAN CONVERSION AND SCALING OF IMAGES, I This procedure takes two lists and returns

I a linked list with name list.

le t enter = p ro c (p n tr list,new > pntr) if list = nil then new e ls e

b eg in

le t temp := list

w h ile temp(next) ~= nil do temp := temp(next)

temp(next) := new l i s t

end

I The input is a file containing all the runlengths, I The scaling factor is equal to R/r.

I The output is a list with the scaled runlengths. structure int.list(int run; pntr next)

le t scaling.1 = p r o c ( p n t r list;file f;lnt R,r > pntr) begin

let remainder := 0 w hile ~eoi(f) d o b eg in

let X readi(f) I This takes a integer from the file named T.

Documento similar