Rabu, 12 September 2018

Menghubungkan Baris Berbentuk Rumah

halo gays........?

kesempatan kali ini saya akan berbagi coding tentang bagaimana cara menghubungkan sebuah garis menjadi bentuk sebuah rumah sederhana menggunakan aplikasi Netbeans IDE 8.0.2
keren kan....?

jika teman-teman ingin mencoba coding ini jalankan saja di aplikasi Netbeans .
ok ini codingnya gays:

package rumah_ian;

import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class Rumahian extends JPanel 
{
 public void paint(Graphics g) {
//int x=100; int y=100;
g.setColor(Color.red);
int addrian = 0;
    while (addrian <=100){    //angka 100 ditunjukan pada panjang garis.
        g.fillRect(300 , 180+addrian, 2, 2);   //angka 300 titik awal koordinat mendekati X
        addrian++; }
int addrian1 = 0;
    while (addrian1 <=200){
        g.fillRect(300+addrian1 , 280, 2, 2);  //angka 2, 2 untuk ketebalan garisnya
        addrian1++; }
int addrian2 = 0;
    while (addrian2 <=200){
        g.fillRect(300+addrian2,180, 2, 2);
        addrian2++; }  
int addrian3 = 0;
    while (addrian3 <=100){
        g.fillRect(500 , 180+addrian3, 2, 2);  //angka 180 ialah titik awal koordinat mendekati Y
        addrian3++; }  
int addrian4 = 0;
    while (addrian4 <=100){
        g.fillRect(400+addrian4 , 80+addrian4, 2, 2);  //kalo baris ini untuk garisnya berbentuk diagonal
        g.fillRect(400-addrian4 , 80+addrian4, 2, 2);  //kalo baris ini untuk garisnya berbentuk diagonal
        addrian4++; }
int addrian5 = 0;
    while (addrian5 <=50){
        g.fillRect(400 , 230+addrian5, 2, 2);
       addrian5++; }
    int addrian6 = 0;
    while (addrian6 <=50){
        g.fillRect(425 , 230+addrian6, 2, 2);
        addrian6++; }
int addrian7 = 0;
    while (addrian7 <=25){
        g.fillRect(399+addrian7,230, 2, 2);
        addrian7++; }
int addrian8 = 0;
    while (addrian8 <=20){
        g.fillRect(350 , 230+addrian8, 2, 2);
        addrian8++; }
    int addrian9 = 0;
    while (addrian9 <=20){
        g.fillRect(375 , 230+addrian9, 2, 2);
        addrian9++; }
int addrian10 = 0;
    while (addrian10 <=25){
        g.fillRect(350+addrian10,230, 2, 2);
        addrian10++; }
int addrian11 = 0;
    while (addrian11 <=25){
        g.fillRect(350+addrian11,250, 2, 2);
        addrian11++; } 
}

    public static void main(String[] args) {
           JFrame frame = new JFrame();
    frame.getContentPane().add(new Rumahian());

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(800,900);
    frame.setVisible(true);

    }
    
}

ini hasil outputnya:

Semoga bermanafaat ya gays.....Terimakasih Atas Kunjungannya !!

Rabu, 25 April 2018

GRAY LEVEL

SOAL:

Di ketahui citra asli dengan Gray Level sebagi berikut:

A

B
200
100
100
100

50
50
50
50
0
200
50
50

10
100
150
200
150
0
200
0

10
100
150
200
50
50
50
200

10
100
150
200
100
100
100
100

10
100
150
200

lakukan Image enhancement dengan :

a. Image Negative
b. Tambah kecerahan 25 % (point operation)
c. Image subtraction dengan citra A dan citra B
d. Lakukan gabungan citra A dan citra B

JAWABAN :

  1.    S       = -r + L – l
    S       = L – l – r
    LA      = 200
    LB      = 200
    SA     = 200 – 255 – r               SB     = 200 – 255 - r
             = -55 – r                                     = -55 – r
    Sehingga Gray Output =

    A

    B
    -255
    -155
    -155
    155

    -105
    -105
    -105
    -105
    -55
    -255
    -105
    -105

    -65
    -155
    -205
    -255
    -205
    -55
    -255
    -55

    -65
    -155
    -205
    -255
    -105
    -105
    -105
    -255

    -65
    -155
    -205
    -255
    -155
    -155
    -155
    -155

    -65
    -155
    -205
    -255
  2.  Point Operation
    PO = r * 25%
    Output

    A

    B
    50
    25
    25
    25

    12,5
    12,5
    12,5
    12,5
    0
    50
    13
    13

    2,5
    25
    37,5
    50
    38
    0
    50
    0

    2,5
    25
    37,5
    50
    13
    13
    13
    50

    2,5
    25
    37,5
    50
    25
    25
    25
    25

    2,5
    25
    37,5
    50
  3. Image Subtraction
    A - B
    Output

    A - B
    150
    50
    50
    50
    -10
    100
    -100
    -150
    140
    -100
    50
    -200
    40
    -50
    -100
    0
    90
    0
    -50
    -100
  4.  Gabung
    A + B
    Output
    A + B
    250
    150
    150
    150
    10
    300
    200
    250
    160
    100
    350
    200
    60
    150
    200
    400
    110
    200
    250
    300





Selasa, 24 April 2018

UTS CITRA DIGITAL : FILTERING

SOAL:

Nilai Citra Asli
         
10.00 200.00 150.00 160.00 150.00
10.00 250.00 0.00 75.00 75.00
10.00 125.00 80.00 0.00 130.00
10.00 125.00 245.00 255.00 0.00
10.00 125.00 5.00 50.00 50.00
50.00 125.00 25.00 5.00 25.00
60.00 125.00 35.00 30.00 5.00
100.00 100.00 90.00 90.00 80.00

Lowpass 1/5

Highpass Spatial 1/9
0.00
1.00
0.00

-1.00
-1.00
-1.00
1.00
1.00
1.00

-1.00
8.00
-1.00
0.00
1.00
0.00

-1.00
-1.00
-1.00







Lowpass Spatial 1/9

LPF 1/9
1.00
1.00
1.00

0.00
1.00
0.00
1.00
1.00
1.00

1.00
5.00
1.00
1.00
1.00
1.00

0.00
1.00
0.00

JAWABAN:

Lowpass 1/5





220.00
610.00
510.00
535.00
385.00
280.00
585.00
555.00
310.00
430.00
155.00
590.00
450.00
540.00
205.00
155.00
630.00
710.00
550.00
435.00
195.00
390.00
450.00
365.00
125.00
245.00
450.00
195.00
135.00
85.00
335.00
445.00
305.00
165.00
140.00
260.00
415.00
315.00
290.00
175.00
Output





44.00
122.00
102.00
107.00
77.00
56.00
117.00
111.00
62.00
86.00
31.00
118.00
90.00
108.00
41.00
31.00
126.00
142.00
110.00
87.00
39.00
78.00
90.00
73.00
25.00
49.00
90.00
39.00
27.00
17.00
67.00
89.00
61.00
33.00
28.00
52.00
83.00
63.00
58.00
35.00

Lowpass Spatial 1/9





470.00
620.00
835.00
610.00
460.00
605.00
835.00
1040.00
820.00
590.00
530.00
855.00
1155.00
860.00
535.00
405.00
735.00
1010.00
815.00
485.00
445.00
720.00
960.00
660.00
385.00
495.00
560.00
525.00
230.00
165.00
560.00
710.00
625.00
385.00
235.00
385.00
510.00
470.00
330.00
205.00

Output





52.22
68.89
92.78
67.78
51.11
67.22
92.78
115.56
91.11
65.56
58.89
95.00
128.33
95.56
59.44
45.00
81.67
112.22
90.56
53.89
49.44
80.00
106.67
73.33
42.78
55.00
62.22
58.33
25.56
18.33
62.22
78.89
69.44
42.78
26.11
42.78
56.67
52.22
36.67
22.78

Highpass Spatial 1/9





-380.00
1180.00
515.00
830.00
890.00
-515.00
1415.00
-1040.00
-145.00
85.00
-440.00
270.00
-435.00
-860.00
635.00
-315.00
390.00
1195.00
1480.00
-485.00
-355.00
405.00
-915.00
-210.00
65.00
-45.00
565.00
-300.00
-185.00
60.00
-20.00
415.00
-310.00
-115.00
-190.00
515.00
390.00
340.00
480.00
515.00

Output





-42.22
131.11
57.22
92.22
98.89
-57.22
157.22
-115.56
-16.11
9.44
-48.89
30.00
-48.33
-95.56
70.56
-35.00
43.33
132.78
164.44
-53.89
-39.44
45.00
-101.67
-23.33
7.22
-5.00
62.78
-33.33
-20.56
6.67
-2.22
46.11
-34.44
-12.78
-21.11
57.22
43.33
37.78
53.33
57.22

LPF 1/9





260.00
1410.00
1110.00
1175.00
985.00
320.00
1585.00
555.00
610.00
730.00
195.00
1090.00
770.00
540.00
725.00
195.00
1130.00
1690.00
1570.00
435.00
235.00
890.00
470.00
565.00
325.00
445.00
950.00
295.00
155.00
185.00
575.00
945.00
445.00
285.00
160.00
660.00
815.00
675.00
650.00
495.00

Output





28.89
156.67
123.33
130.56
109.44
35.56
176.11
61.67
67.78
81.11
21.67
121.11
85.56
60.00
80.56
21.67
125.56
187.78
174.44
48.33
26.11
98.89
52.22
62.78
36.11
49.44
105.56
32.78
17.22
20.56
63.89
105.00
49.44
31.67
17.78
73.33
90.56
75.00
72.22
55.00