The document discusses the concept of segments in image display, detailing their creation, management, and attributes such as visibility. It explains the structure of segment tables, the advantages of using segmentation for organizing display files, and the processes for creating, closing, deleting, and renaming segments. Additionally, it touches on visibility attributes and introduces the topics of coloring and illumination models.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
123 views62 pages
CG Unit-IV
The document discusses the concept of segments in image display, detailing their creation, management, and attributes such as visibility. It explains the structure of segment tables, the advantages of using segmentation for organizing display files, and the processes for creating, closing, deleting, and renaming segments. Additionally, it touches on visibility attributes and introduces the topics of coloring and illumination models.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 62
Unit- IV
Segments, Illumination models, colour models and shading
Segment Introduction • To view an entire image or a part of image with various attributes, we need to organize image information in a particular manner since existing structure of display file does not satisfy our requirements of viewing an image. • To achieve this display, file is divided into Segments. • Each segment corresponds to a component and is associated with a set of attributes and image transformation parameters like scaling, rotation. • Presence of Segment allows : • Subdivision of picture. • Visualization of particular part of picture. • Scaling, rotation and translation of picture. Introduction Introduction • Types of Segments : • Posted Segment : • When visible attribute of segment is set to 1, it is called Posted segment. • This is included in active segment list. • Unposted Segment : • When visible attribute of segment is set to 0, it is called Unposted segment. • This is not included in active segment list. Segment Table Segment Table • The segment table is formed by using arrays. An alternative approach is linked list • In case of arrays, maximum no. of segments that can be included in the segment table are equal to the length of the arrays. But with linked list there is no such limit on the maximum no. of segments; as list is dynamic • In linked List ordering is achieved by simply adjusting the links. In case of arrays we have to move actual segment information in the process of sorting the segments. • The Disadvantage of linked list is that it requires more storage to hold the links and that it is costly to locate arbitrary cells. • In the linked list deleting the cell means changing two links. Segment creation, closing, deleting and renaming, • Functions for Segmenting the display : • Segment Creation : • Segment must be created or opened when no other segment is open, since two segments can’t be opened at the same time because it’s difficult to assign drawing instruction to particular segment. • The segment created must be given a name to identify it which must be a valid one and there should be no segment with the same name. • After this, we initialize items in segment table under our segment name and the first instruction of this segment is allocated at next free storage in display file and attributes of segments are initialized to default. Segment creation, closing, deleting and renaming, • Algorithm for creating segment: 1) If any segment is open, give error message : “Segment is still open” and go to step 8. 2) Read the name of the new segment. 3) If the segment name is not valid, give error message : “Segment name not a valid name” and go to step 8. 4) If given segment name already exists, give error message : “Segment name already exists in name list” and go to step 8. 5) Make next free storage area in display file as start of new segment. 6) Initialize size of new segment to 0 and all its attributes to their default values. 7) Inform that the new segment is now open. 8) Stop. Segment creation, closing, deleting and renaming, • Closing a Segment : • After completing entry of all display file instructions, the segment needs to be closed which is done by changing the name of currently open segment as 0. Segment creation, closing, deleting and renaming, Deleting a Segment : 1.To delete a particular segment from display file, we must just delete that one segment without destroying or reforming the entire display and recover space occupied by this segment. 2.Use this space for some other segment. 3.The method to achieve this depends upon the data structure used to represent display file. 4.In case of arrays, the gap left by deleted segment is filled by shifting up all the segments following it. Segment creation, closing, deleting and renaming, • Algorithm : 1. Read the name of the segment to be deleted. 2. If segment name is not valid, give error message : “Segment name is not a valid name” and go to step 8. 3. If the segment is open, give error message : “Can’t delete an open segment” and go to step 8. 4. If size of segment is less than 0, no processing is required and go to step 8. 5. The segments which follow the deleted segment are shifted by its size. 6. Recover deleted space by resetting index of next free instruction. 7. The starting position of shifted segments is adjusted by subtracting the size of deleted segment from it. 8. Stop. Segment creation, closing, deleting and renaming, Segment creation, closing, deleting and renaming, • Renaming a Segment : • Algorithm : 1. If both old and new segment names are not valid, give error message : “Segment names are not valid names” and go to step 6. 2. If any of two segments is open, give error message : “Segments are still open” and go to step 6. 3. If new segment name given already exists in the display list, give error message : “Segment name already exists” and go to step 6. 4. The old segment table entry are copied into new position. 5. Delete the old segment. 6. Stop. Segment creation, closing, deleting and renaming, • Advantages of using segmented display : • Segmentation allows to organize display files in sub-picture structure. • It allows to apply different set of attributes to different portions of image. • It makes it easier to the picture by changing/replacing segments. • It allows application of transformation on selective portions of image. Visibility • Each Segment is given a visibility attribute. • The segment’s visibility is stored in an array as part of the segment table. • By checking this array we can determine whether or not the segment should be displayed. Colouring Models https://www.youtube.com/watch?v=-b2pAEHEQZc Illumination Models -/