A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_URI::$config is deprecated

Filename: core/URI.php

Line Number: 101

Backtrace:

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Router::$uri is deprecated

Filename: core/Router.php

Line Number: 127

Backtrace:

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Welcome::$benchmark is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Welcome::$hooks is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Welcome::$config is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Welcome::$log is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Welcome::$utf8 is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Welcome::$uri is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Welcome::$exceptions is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Welcome::$router is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Welcome::$output is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Welcome::$security is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Welcome::$input is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Welcome::$lang is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Welcome::$load is deprecated

Filename: core/Controller.php

Line Number: 78

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Welcome::$db is deprecated

Filename: core/Loader.php

Line Number: 396

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_DB_mysqli_driver::$failover is deprecated

Filename: database/DB_driver.php

Line Number: 371

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::open($save_path, $name) should either be compatible with SessionHandlerInterface::open(string $path, string $name): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 132

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::close() should either be compatible with SessionHandlerInterface::close(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 292

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::read($session_id) should either be compatible with SessionHandlerInterface::read(string $id): string|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 166

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::write($session_id, $session_data) should either be compatible with SessionHandlerInterface::write(string $id, string $data): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 235

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::destroy($session_id) should either be compatible with SessionHandlerInterface::destroy(string $id): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 315

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::gc($maxlifetime) should either be compatible with SessionHandlerInterface::gc(int $max_lifetime): int|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 356

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 282

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: session_set_cookie_params(): Session cookie parameters cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 289

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 304

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 314

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 315

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 316

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 317

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 375

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: ini_set(): Session ini settings cannot be changed after headers have already been sent

Filename: drivers/Session_files_driver.php

Line Number: 108

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: session_set_save_handler(): Session save handler cannot be changed after headers have already been sent

Filename: Session/Session.php

Line Number: 110

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: session_start(): Session cannot be started after headers have already been sent

Filename: Session/Session.php

Line Number: 143

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Welcome::$session is deprecated

Filename: core/Loader.php

Line Number: 1283

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Welcome::$form_validation is deprecated

Filename: core/Loader.php

Line Number: 1283

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 8
Function: __construct

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Welcome::$m_data is deprecated

Filename: core/Loader.php

Line Number: 358

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 11
Function: model

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$benchmark is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 187
Function: view

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$hooks is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 187
Function: view

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$config is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 187
Function: view

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$log is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 187
Function: view

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$utf8 is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 187
Function: view

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$uri is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 187
Function: view

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$exceptions is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 187
Function: view

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$router is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 187
Function: view

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$output is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 187
Function: view

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$security is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 187
Function: view

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$input is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 187
Function: view

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$lang is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 187
Function: view

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$load is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 187
Function: view

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$db is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 187
Function: view

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$session is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 187
Function: view

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$form_validation is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 187
Function: view

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$m_data is deprecated

Filename: core/Loader.php

Line Number: 931

Backtrace:

File: /home/alfe6346/public_html/application/controllers/Welcome.php
Line: 187
Function: view

File: /home/alfe6346/public_html/index.php
Line: 315
Function: require_once

alf-printing Digital-Printing dan Media Pembelajaran
Cepat, Berkualitas, dan Terjangkau Indonesia

Artikel Blog

Source Code Representasi Citra  Pertemuan 2

1. Import Library

  • argparse → untuk parsing argumen dari command line (CLI).
  • os & sys → mengatur path, direktori, dan sistem.
  • cv2 → OpenCV, dipakai untuk manipulasi dan konversi citra (misalnya RGB ke grayscale).
  • tkinter → GUI sederhana (popup dialog, pesan info).
  • filedialog & messagebox → komponen GUI untuk memilih file dan menampilkan pesan.

2. Setup path agar bisa impor modul lokal

  • _FILE_DIR → folder tempat file Python ini berada.
  • _ROOT_DIR → folder induk (parent) dari file ini.
  • sys.path.insert(...) → menambahkan root project ke path Python, supaya bisa impor modul common.

3. Import modul internal

  • read_image → fungsi khusus untuk membaca gambar dari path.
  • show → fungsi khusus untuk menampilkan gambar (dengan jendela GUI/plot).

4. Fungsi utilitas: statistik

  • Input: channel (array piksel, misalnya R, G, B atau grayscale).
  • Output: string berisi statistik → nilai minimum, maksimum, dan rata-rata intensitas.
  • Contoh output: R -> min:0 max:255 mean:123.45.

5. Fungsi utama

  • args.image → path gambar dari CLI (jika ada).

a. Pilih file lewat GUI jika tidak ada argumen

  • Jika tidak ada argumen --image atau user pakai --gui, maka buka dialog pilih file.
  • Jika user batal → tampilkan pesan "Tidak ada file yang dipilih.".

b. Baca gambar & pisahkan channel

  • read_image → membaca gambar ke array numpy.
  • R, G, B → ekstrak tiap channel warna.
  • gray → konversi ke grayscale dengan OpenCV.

c. Hitung statistik intensitas

  • Menghitung statistik tiap channel.
  • Cetak ke terminal.

d. Tampilkan statistik lewat GUI

  • Cek apakah ada root Tkinter aktif.
  • Jika tidak, buat root baru sementara.
  • Tampilkan statistik dalam popup GUI.
  • Hancurkan root sementara setelah selesai agar tidak ada jendela kosong.

e. Tampilkan channel satu per satu

  • Memanggil show untuk menampilkan tiap channel dengan labelnya.

6. Entry Point (jalankan script)

  • Membuat parser argumen:
    • --image → path file gambar (opsional).
    • --gui → flag untuk membuka dialog file.
    • Panggil main(args) dengan argumen tersebut.

Ringkasan

Script ini berfungsi untuk:

  • Membaca gambar dari argumen CLI atau dialog GUI.
  • Memisahkan channel R, G, B, Grayscale.
  • Menghitung statistik intensitas (min, max, mean).
  • Menampilkan statistik di terminal dan GUI popup.
  • Menampilkan channel secara visual satu per satu.