Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Q36の問題文, Q37の解答(C++)の修正 #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Question_31_40/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ DFTによって得られた周波数成分は左上、右上、左下、右下

## Q.36. JPEG圧縮 (Step.1)離散コサイン変換

*imori.jpg*をグレースケール化し離散コサイン変換を行い、逆離散コサイン変換を行え。
*imori.jpg*に対して離散コサイン変換を行い、逆離散コサイン変換を行え。

離散コサイン変換(DCT: Discrete Cosine Transformation)とは、次式で定義される周波数変換の一つである。

Expand Down
4 changes: 2 additions & 2 deletions Question_31_40/answers_cpp/answer_37.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ double MSE(cv::Mat img1, cv::Mat img2){
}
}

mse /= (height * width);
mse /= (height * width * channel);
return mse;
}

Expand All @@ -122,7 +122,7 @@ double PSNR(double mse, double v_max){

// Compute bitrate
double BITRATE(){
return T * K * K / T * T;
return T * K * K / T / T;
}

// Main
Expand Down