Storing Digital Images – Our Sensors Peak Around – 425 Nanometers (Blue) – 550 Nanometers (Green) CSC121, Introduction to Computer – 560 Nanometers (Red) Programming
Total Page:16
File Type:pdf, Size:1020Kb
2/3/18 Color Images • the human visual system samples the visible light spectrum Storing Digital Images – our sensors peak around – 425 nanometers (blue) – 550 nanometers (green) CSC121, Introduction to Computer – 560 nanometers (red) Programming Color Images RGB Color • We represent color images using composite • most digital photography uses the RGB color color models model employing additive color primaries – separate planes represent specific color channels pigments light 1 2/3/18 RGB Color RGB Color • has three distinct channels: RED, GREEN, and • We will separate the image to compare the BLUE color channels each channel is shown as an intensity image to indicate the relative amount that the color contributes to the composite image RGB Color RGB Color • We will separate the image to compare the • We will separate the image to compare the color channels color channels RED CHANNEL GREEN CHANNEL NOTE: high intensity means high amounts of red; dark means low amounts 2 2/3/18 RGB Color CMYK Color • We will separate the image to compare the • The CYAN-MAGENTA- CYAN color channels YELLOW-BLACK* or CMYK color model is GREEN used for printing and BLUE based on subtractive BLACK WHITE BLUE CHANNEL primaries YELLOW MAGENTA RED *Black is added for print efficiency CMY Color Cube Color Images Color Images • the alpha channel is a fourth channel that is • We will be using mostly used as a mask to specify the JPEG images for our transparency/opacity of pixels in the programming composite image • Joint Photographers Expert Group images – baseline: lossy compression algorithm – variable compression rates 3 2/3/18 Example Example Quality = 100, Compression = 2.6:1 Quality = 50, Compression = 15:1 Quality = 25, Compression = 23:1 Quality = 10, Compression = 48:1 Example The If statement • We have used the If statement in two forms one-way if (condition): decision statement block if (condition): two-way statement block-1 decision Quality = 1, Compression = 144:1 else: statement block-2 4 2/3/18 Conditional Logic The elif statement • We can extend the range of choice with Python’s elif if (condition): statement block-a elif (condition): three-way statement block-b decision else: statement block-c if statement if-else statement Conditional Logic Conditional Logic def choice(): choice = input("Enter your choice: 1 or 2: ") if choice == 1: print "Your choice is 1” elif choice == 2: print "Your choice is 2” else: print "Invalid choice" if-elif-else statement 5.