setblue( ) p.setblue(87) Set the blue component intensity to 87. setgreen( ) p.setgreen(45) Set the green component intensity to 45. DISTRIBUTION setred( ) p.setred(100) Set the red component intensity to 100. LLC getblue( SALE ) OR DISTRIBUTION g = p.getblue( ) Return the blue component SALE OR intensity. Jones getgreen( & Bartlett ) Learning, g = p.getgreen( LLC ) Return the Jones green& component Bartlett Learning, intensity. getred( ) r = p.getred( ) Return the red component intensity. Color Red Green Blue Red Green Blue Jones & Bartlett MagentaLearning, 255 LLC SALE Yellow OR DISTRIBUTION Cyan White Black Table 6.1 Red, green, and blue intensities for some common colors.ģ O 6.2 What Is Digital Image Processing? 187 Method Name Example Use Explanation Pixel(r, g, b) p = Pixel(25, 200, 143) Create a pixel with 25 red, 200 green, and 143 blue. In addition, we can create windowswhere imagescan be displayed. We can also construct an image from a file or create a blank image that we can fill in later. OR DISTRIBUTION Thismodule containsobjectsthat allow usto SALE construct OR DISTRIBUTION and manipulate pixels. (See Jones Installing & Bartlett the Learning, Required Software LLC (Appendix A) for Jones instructions & Bartlett on downloading Learning, LLC and installing SALE cimage.py). All of these colorsmake up the Jones color& palette Bartlett for Learning, the RGB color LLCmodel The cimage Module In order to manipulate imageswe will use a group of objectsfound in our cimage module. Since each of the three colorshas256 intensity levels, there are = 16,777,216 different combinations of red, green, and blue intensities. An interesting question arises when you consider how many colors there might be using the RGB color model. TableLLC 6.1 shows some common combinations. Black will have zero intensity for all primary color components and white will have full color intensity, s & Bartlett 255, for Learning, all. For example, a color with 255 red intensity, 0 green intensity, and 255 blue intensity will be purple (or magenta). Intensities will range from a minimum of 0 to a maximum of 255. Learning, LLC The amount of each primary color component isreferred to asitsintensity. Viewing colorsasa combination of red, green, and blue isoften referred to asthe RGB Jones color & Bartlett model. The specific color dependson a formula that mixesvariousamountsof the primary colorsred, green, and blue. An 8 megapixel Jones camera & Bartlett is capablelearning, of taking allc picture SALE with up OR todistribution 8 million pixelsĢ O 186 CHAPTER 6 Pycture Perfect Programs The RGB Color Jones Model & Bartlett Learning, LLC Each pixel in the digital image is limited to having a single color. One megapixel means that the picture Jones you take & Bartlett is composed Learning, of 1 million LLC pixels. Typically resolution is expressed as a number of megapixels. Digital camerasare often rated according to how much resolution they provide. More pixels in your image mean more SALE detailor DIST or resolution. If you look closely Jones at an & Bartlett image, Learn pixels can sometimes appear SALE as OR small DISTRIBUTION dots. These pixels are organized in a two-dimensional grid and represent the smallest amount Jones of picture & Bartlett information Learning, thatllc is available. A digital image is a finite collection of small, discrete picture elements called pixels. Digital image processing refersto the processof using algorithmsto edit and manipulate digital images. Learning, In LLC thischapter we consider digital Jones imagesand & Bartlett many Learning, of the LLC techniquesthat R SALE OR can DISTRIBUTION be used to modify them. It seemsthat almost everyone hasa digital camera aswell assoftware that can organize and manipulate s & Bartlett photographs. 1 O CHAPTER 6 Pycture Perfect Programs 6.1 Objectives To understand pixel-based image processing To use nested iteration To use and understand tuples To implement a number of image processing algorithms To understand passing functions as parameters 6.2 What Is Digital Image Processing? Digital photography isa very common way to produce photographstoday.
0 Comments
Leave a Reply. |