how to code the following program in MATLAB 2010
이전 댓글 표시
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
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Convert Image Type에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!