how to code the following program in MATLAB 2010
Mostra commenti meno recenti
open 24-bit color image in read mode
store image height to m and width to n, respectively
declare two 2-D Matrices, matrix[m][n], matrix1[m][n]
read pixel one by one until end of file
{
matrix1[i][j] = bi.getRGB(i,j)
b1[i][j]= (bi.getRGB(i,j)) & 0x000000FF
g1[i][j]= (bi.getRGB(i,j) & 0x0000FF00) >> 8
r1[i][j]= (bi.getRGB(i,j) & 0x00FF0000) >> 16
int avg = (r1[i][j]+g1[i][j]+b1[i][j])/3
int newRGB = 0xFF000000 + (avg << 16) + (avg << 8 ) + avg
matrix[i][j] = newRGB
}
write matrix[m][n] to another image file
close all the files
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Convert Image Type in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!