62,614
社区成员
发帖
与我相关
我的任务
分享
public void filtrate(){
BufferedImage fbi = bi;
int bi_width = bi.getWidth();
int bi_height = bi.getHeight();
for(int i = 1;i < bi_width-1;++ i){
for(int j = 1;j < bi_height-1;++ j){
int blackCount = 0;
for(int temp1 = -1;temp1 <=1;++ temp1){
for(int temp2 = -1;temp2 <= 1;++ temp2)
if(MusicHelper.isBlack(bi, i+temp1, j+temp2)){
blackCount ++;
if((i == 250) && (j == 200)){
System.out.println(i+temp1+", "+j+temp2);
}
}
}
if(blackCount >= 4)
fbi.setRGB(i, j, 0xff000000);
else {
fbi.setRGB(i, j, 0xffffffff);
}
}
}
setBi(fbi);
}
BufferedImage fbi = bi;
int bi_width = bi.getWidth();
int bi_height = bi.getHeight();
for(int i = 1;i < bi_width-1;++ i){
for(int j = 1;j < bi_height-1;++ j){
int blackCount = 0;
for(int temp1 = -1;temp1 <=1;++ temp1){
for(int temp2 = -1;temp2 <= 1;++ temp2)
if(MusicHelper.isBlack(bi, i+temp1, j+temp2)){
blackCount ++;
}
}
if(blackCount >= 4)
fbi.setRGB(i, j, 0xff000000);
else {
fbi.setRGB(i, j, 0xffffffff);
}