#include <iostream>
#include <fstream>
using namespace std;
#define frameH 1920
#define frameV 1080
int main()
{
unsigned char *fp = new unsigned char [frameH*frameV];
fstream file;
file.open("W:\a.raw", fstream::in | fstream::binary);
if( !file.good())
cout << "file讀檔失敗" << endl;
file.read((char*) fp, frameH*frameV); //轉態unsigned char* 轉態成 char* 放入函式
file.close();
int *ifp = new int [frameH*frameV];
for(int i = 0 ; i < frameH ; ++i){
for(int j = 0 ; j < frameV ; ++j){
*(ifp+i+j*frameH) = *(fp+i+j*frameH);
}}
int temp;
for(int i = 1 ; i < frameH-1 ; ++i){
for(int j = 1 ; j < frameV-1 ; ++j){
temp =
*(ifp + (i-1) + (j-1)* frameH) +
*(ifp + i + (j-1)* frameH) +
*(ifp + (i+1) + (j-1)* frameH) +
*(ifp + (i-1) + j * frameH) +
*(ifp + i + j * frameH) +
*(ifp + (i+1) + j * frameH) +
*(ifp + (i-1) + (j+1)* frameH) +
*(ifp + i + (j+1)* frameH) +
*(ifp + (i+1) + (j+1)* frameH);
*(ifp+i+j*frameH) = (temp /9);
}}
for(int i = 0 ; i < frameH ; ++i){
for(int j = 0 ; j < frameV ; ++j){
*(fp+i+j*frameH) = *(ifp+i+j*frameH);
}}
fstream ofile;
ofile.open("W:\ba.raw", fstream::out | fstream::binary);
if( !ofile.good())
cout << "ofile讀檔失敗" << endl;
ofile.write((char*) fp, frameH*frameV); //轉態unsigned char* 轉態成 char* 放入函式
ofile.close();
delete [] fp;
delete [] ifp;
system("PAUSE");
return 0;
}
.RAW的Smooth
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言
(什麼是留言欄訊息?)