Mavzu: Chiziqli tiniqlashtirish algoritmi


Download 0.81 Mb.
Sana09.06.2020
Hajmi0.81 Mb.
#116442
Bog'liq
TRIB- Rayimov Muxriddin 1-mustaqil ish


O‘ZBEKISTON XALQARO ISLOM AKADEMIYASI IIXM FAKULTETI INFORMATIKA VA AXBOROT TEXNOLOGIYALARI YO’NALISHI

MUSTAQIL ISH

Mavzu: Chiziqli tiniqlashtirish algoritmi

Topshirdi: Rayimov M.

Qabul qildi: Jumayev T.

Toshkent-2020

Mavzu: Chiziqli tiniqlashtirish algoritmi

Chiziqli tiniqlashtirish algoritmi quyidagi bosqichlarda amalga oshiriladi:



  1. Tasvir kiritiladi;

  2. RGB rang fazosidagi tasvirni har bir R,G,B fazolari olinadi;

  3. Tasvirning har bir rang fazosida eng katta va eng kichik qiymatlari hisoblaniladi;

  4. Tasvirning har bir rang fazosida R`(x,y) = 255*

  5. Tamom.

Endi esa dastur kodini korishimiz mumkin:

public class NewRGB1 {


public static void main(String[] args) throws IOException {
BufferedImage image = ImageIO.read(new File("F:/123.jpg"));
int Width = image.getWidth();
int Height = image.getHeight();
int r[][] = new int[Width][Height];
int g[][] = new int[Width][Height];
int b[][] = new int[Width][Height];
int a[][] = new int[Width][Height];
System.out.println(Width+ " \t" + Height);
for (int i = 0; i < Width; i++) {
for (int j = 0; j < Height; j++) {
int p = image.getRGB(i,j);
r[i][j] = (p>>16)&0xff;
g[i][j] = (p>>8)&0xff;
b[i][j] = (p)&0xff;
a[i][j] = (p>>24)&0xff;
}
}
light(r);
light(b);
light(g);
BufferedImage imageO = new BufferedImage(Width, Height, BufferedImage.TYPE_INT_RGB);

for (int x = 0; x < Width; x++) {


for (int y = 0; y < Height; y++) {

int rgb = (a[x][y] << 24) | (r[x][y] << 16) | (g[x][y] << 8) | b[x][y];


imageO.setRGB(x, y, rgb);
}
}
ImageIO.write(imageO, "jpg", new File("F:/1234.jpg"));
System.out.println(" - ");
}

public static void light(int a[][]){


int max = 0;
int min = 255;
for (int i = 0; i < a.length; i++) {
for (int j = 0; j < a.length; j++) {
max = Math.max(max, a[i][j]);
min = Math.min(min, a[i][j]);
}
}
for (int i = 0; i < a.length; i++) {
for (int j = 0; j < a.length; j++) {
int r = 255 * (a[i][j] - min)/(max - min);
a[i][j] = r;
}
}
}
}

Oldingi va keying holatlari.




Download 0.81 Mb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling