Praktikum 2 Konversi RGB.

Slides:



Advertisements
Similar presentations
For(int i = 1; i
Advertisements

Revision.
Most-to-Least Legible Color Combinations for Viewing on Slide Shows Color and contrast are very important tools in communication. They can be used to enhance.
Copyright © 2012 Pearson Education, Inc. Chapter 11 MORE WINDOWS CONTROLS & STANDARD DIALOG BOXES.
.NET Class 4 – Windows-based Application. WinForm Application Homogeny programming model. Rich class library Classes are shared by all.NET languages.
Color (1) Turtle class contains a method to change the pen color Note: before using Color class, you should add following line in the top of the source.
Chapter 6 Color Image Processing Chapter 6 Color Image Processing.
Fonts Typeface Typography. Leading Spacing between lines.
WEB GRAPHICS. The Pixel Computer displays are comprised of rows and columns of pixels. Pixels are indivisible. Some common screen resolutions are:, 600.
Computer Graphics Prepared by Dragon Lee 1 January 2003.
Dr Dat Tran - Week 4 Lecture Notes 1 MenuStrip Programming Graphical User Interfaces PG (7110) University of Canberra School of Information Sciences &
Image Storage Bitmapped Graphics – in which an image is represented as a collection of dots Vector Graphics – in which an image is represented as a set.
Lecture 8 Building an MDI Application. Introduction The MDI (Multiple Document Interface) provides a way to display multiple (child) windows forms inside.
Object Oriented Programming Graphics and Multimedia Dr. Mike Spann
Dr Dat Tran - Week 4 Lecture Notes 1 ToolStrip Programming Graphical User Interfaces PG (7110) University of Canberra School of Information Sciences &
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 5 Working with Images Starting Out with Games & Graphics in.
Color and Resolution Introduction to Digital Imaging.
Lecture 16: Multithreaded Programming. public partial class Form1 : Form { Thread ct; Thread rt; public static int circle_sleep = 0; public static int.
BIL528 – Bilgisayar Programlama II Introduction 1.
Field Trip #33 Creating and Saving Fractals. Julia Set We consider a complex function, f(z) For each point on the complex plane (x,y), where z = x + iy,
MAT 150 – Class #24 Topics: Graphing Rational Functions Asymptotes Vertical Slanted Horizontals Holes.
Lecture 6: Advanced GUI Controls. Up to now we have used simple controls such as buttons and textboxes. Now we will review some interactive (e.g. dialog)
Digital Media Lecture 4.1: Image Encoding Practice Georgia Gwinnett College School of Science and Technology Dr. Jim Rowan.
Lecture 7 Dialog Controls MDI Parent/Child Interaction.
Too Big Practice Making the File Size Smaller. What Size is My File? To determine the size of a file: PC: With the file closed, right click on the icon.
Using Banner Vision Products with OCS Controllers Ken Jannotta Jr. Horner APG August 2007.
Lecture 14: File I/O Common Dialogs Toolbox Widgets.
01/anthropology.jpg.
Different frequencies of “visible light”
MAT 150 – Class #16 Topics: Graphing Rational Functions Asymptotes Vertical Slanted Horizontals Holes.
RGB lesson Mrs Ras. Open illustrator File > new change color mode to RGB.
PART TWO Electronic Color & RGB values 1. Electronic Color Computer Monitors: Use light in 3 colors to create images on the screen Monitors use RED, GREEN,
Textures – Basic Principles Lecture 29 Fri, Nov 14, 2003.
Int fact (int n) { If (n == 0) return 1; else return n * fact (n – 1); } 5 void main () { Int Sum; : Sum = fact (5); : } Factorial Program Using Recursion.
Digital Media Lecture 4.2: Image Encoding Practice Georgia Gwinnett College School of Science and Technology Dr. Jim Rowan.
An urn contains 1 green, 2 red, and 3 blue marbles. Draw two without replacement. 1/6 2/6 3/6 2/5 3/5 1/5 3/5 1/5 2/5 2/30 3/30 2/30 6/30 3/30 6/30.
Scientific Notation. = 5.4 =3.47 Write the following in standard form A 1.8 X 10⁴ B 3.47 X 10⁷ C 4.3 X 10⁰ D 5.4 X 10⁻⁴ E 5 X 10⁻⁶ F (6 X 10⁴) (7 X 10⁵)
Building a Simple Text Editor. Create a text editor with the following features: (1) Uses a MenuStrip with File, and Edit tabs (2) The user can create.
Windows form programming. namespace MyNamespace { public class MyForm : System.Windows.Forms.Form { public MyForm() { this.Text = "Hello Form"; }
2.2: Translations.
Image Processing CS177.
Water Quality Image Analysis
Digital Media Lecture 4.1: Image Encoding Practice
Colors.
CS320n –Visual Programming
Getting Image Data Image Data Files 11/15/2018
Picture Viewer.
How to Add Images Using an 'openFile' Dialog
MDI Picture Viewer Application
Name: _______________________________
Average Number of Photons
Image Processing Results
- orange white green - cyan - red - blue Example 1 24 bit RGB
a = imread(‘picture.jpg’); imshow(a);
Graph Transformations
Can I color yellow?. Can I color yellow?
COMS 161 Introduction to Computing
Colors Computers build colors from Red, Green, and Blue; not Red, Blue, and Yellow. RGB = Red Green Blue Creating Colors Red + Blue = Purple No Red, No.
Object Oriented Programming
Using Slope Intercept Form to Graph Day 2
What Color is it?.
Color Image Processing
monochrome AgX material
Using Slope Intercept Form to Graph Day 2
Color Box Button - Gray Type : object Type : object Type : object
- orange white green - cyan - red - blue Example 1 24 bit RGB
label1 Name label2 Time (0-23) textBox1 textBox2 textBox3 button1
Let’s Learn the Basic Colors
Poker2.jpg Poker14.jpg int num1, num2;
form1 Runner pictureBox1 imageList1 timer1 label1 原地跑步計時 label2 共用了…秒
Presentation transcript:

Praktikum 2 Konversi RGB

Open and Save Image

Open Image private void openToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "jpg (*.jpg)|*.jpg|bmp (*.bmp)|*.bmp"; if (ofd.ShowDialog() == DialogResult.OK && ofd.FileName.Length > 0) pictureBox1.SizeMode = PictureBoxSizeMode.Zoom; pictureBox1.Image = Image.FromFile(ofd.FileName); }

Save As private void saveASToolStripMenuItem_Click(object sender, EventArgs e) { SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "jpg (*.jpg)|*.jpg|bmp (*.bmp)|*.bmp"; if (sfd.ShowDialog() == DialogResult.OK && sfd.FileName.Length > 0) pictureBox1.Image.Save(sfd.FileName); }

RGB Color //pictureBox3 Bitmap bmp1 = new Bitmap(200,140); Color merah = Color.FromArgb(255, 0, 0); Color putih = Color.FromArgb(255, 255, 255); for (int y = 0; y < 70; y++) { for (int x = 0; x < 200; x++) bmp1.SetPixel(x, y, merah); } for (int y = 70; y < 140; y++) bmp1.SetPixel(x, y, putih); pictureBox3.Image=new Bitmap(bmp1.Height, bmp1.Width); pictureBox3.Image = bmp1;

RGB Color int number1, number2, number3; Int32.TryParse(tb_1.Text, out number1); Int32.TryParse(tb_2.Text, out number2); Int32.TryParse(tb_3.Text, out number3); //panel4.BackColor = Color.FromArgb(number1, number2, number3); Bitmap bitCampur = new Bitmap(100, 100); Bitmap bitRed = new Bitmap(100, 100); Bitmap bitGreen = new Bitmap(100, 100); Bitmap bitBlue = new Bitmap(100, 100); Color red = Color.FromArgb(255, 0, 0); Color green = Color.FromArgb(0, 255, 0); Color blue = Color.FromArgb(0, 0, 255); Color campur=Color.FromArgb(number1,number2,number3); for (int y = 0; y < 100; y++) { for (int x = 0; x < 100; x++) bitRed.SetPixel(x, y, red); bitGreen.SetPixel(x, y, green); bitBlue.SetPixel(x, y, blue); bitCampur.SetPixel(x, y, campur); } boxColor1.Image = new Bitmap(bitRed.Height, bitRed.Width); boxColor1.Image = bitRed; boxColor2.Image = new Bitmap(bitGreen.Height, bitGreen.Width); boxColor2.Image = bitGreen; boxColor3.Image = new Bitmap(bitBlue.Height, bitBlue.Width); boxColor3.Image = bitBlue; boxColor4.Image = new Bitmap(bitCampur.Height, bitCampur.Width); boxColor4.Image = bitCampur;

Bitmap bmp3 = (Bitmap)pbox3.Image; Color pixelColor; pbox6.Image = new Bitmap(pbox6.Width, pbox6.Height); for (int y = 0; y < bmp3.Height; y++) { for (int x = 0; x < bmp3.Width; x++) pixelColor = bmp3.GetPixel(x, y); int red = pixelColor.R; int green = pixelColor.G; int blue = pixelColor.B; int rata = (int)(red + green + blue) / 3; bmp3.SetPixel(x, y, Color.FromArgb(rata, rata, rata)); } pbox6.SizeMode = PictureBoxSizeMode.StretchImage; pbox6.Image = bmp3;

Bitmap bmp4 = (Bitmap)pbox3.Image; Color pixelColor; for (int y = 0; y < bmp4.Height; y++) { for (int x = 0; x < bmp4.Width; x++) pixelColor = bmp4.GetPixel(x, y); int red = pixelColor.R; int green = pixelColor.G; int blue = pixelColor.B; int rata = (int)(red + green + blue) / 3; if (rata < 128) { rata = 0; } else { rata = 255; } bmp4.SetPixel(x, y, Color.FromArgb(rata, rata, rata)); } pbox7.SizeMode = PictureBoxSizeMode.StretchImage; pbox7.Image = bmp4;

//Flip Horizontal Bitmap source = (Bitmap)pbox3.Image; Color pC; //pixelColor int size=source.Height; if (source.Width < source.Height) size = source.Width; Bitmap bmp1 = new Bitmap(size,size); for (int y = 0; y < size; y++) { for (int x = 0; x < size; x++) pC = source.GetPixel(size-1-x, y); bmp1.SetPixel(x, y, Color.FromArgb(pC.R, pC.G, pC.B)); } pbox4.SizeMode = PictureBoxSizeMode.StretchImage; pbox4.Image = bmp1;

//Flip Vertical Bitmap bmp2 = new Bitmap(size, size); for (int y = 0; y < size; y++) { for (int x = 0; x < size; x++) int a = size - y; pC = source.GetPixel(x, size-1-y); bmp2.SetPixel(x, y, Color.FromArgb(pC.R, pC.G, pC.B)); } pbox5.SizeMode = PictureBoxSizeMode.StretchImage; pbox5.Image = bmp2;

// fungsi Contrast Bitmap source = (Bitmap)pbox3.Image; Bitmap bmp1 = new Bitmap(source.Height,source.Width); bmp1 = source; Color pixelColor; int k = 30; for (int y = 0; y < source.Height; y++) { for (int x = 0; x < source.Width; x++) pixelColor = source.GetPixel(x, y); int red = pixelColor.R; int green = pixelColor.G; int blue = pixelColor.B; if ((red + k) <= 255) { red = red + k; } ; if ((green + k) <= 255) { green = green + k; }; if ((blue + k) <= 255) { blue = blue + k; } ; bmp1.SetPixel(x, y, Color.FromArgb(red,green,blue)); } pbox8.SizeMode = PictureBoxSizeMode.StretchImage; pbox8.Image = bmp1;