how to change these parts to 0??

조회 수: 1(최근 30일)
DOHYUN JANG 2019년 11월 30일
답변: Sourav Bairagya 2019년 12월 9일
This is the picture of a gray image after DCT porcess. I want make other 4 images which are : 1. make part 1 in picture to 0 and then idct 2. make part 2 in picture to 0 and then idct 3. make part 3 in picture to 0 and then idct 4. make part 4 in picture to 0 and then idct
please help me ....
  댓글 수: 1
Walter Roberson
Walter Roberson 2019년 11월 30일
dctstuff = dct(...);
dct1 = dctstuff;
dct1(1:20, 1:20) = 0;
idct1 = idct(dct1);

댓글을 달려면 로그인하십시오.


Sourav Bairagya
Sourav Bairagya 2019년 12월 9일
Assuming the dct image is ‘dct_img’ and the indexes of the sections are as shown here in this figure, you can create four inverse DCTs in the following way:
%For section 1
dct1 = dct_img;
dct1(1:25, 1:25) = 0;
img1 = idct(dct1);
%For section 2
dct2 = dct_img;
dct2(1:25, 25:256) = 0;
img2 = idct(dct2);
%For section 3
dct3 = dct_img;
dct3(25:256, 1:25) = 0;
img3 = idct(dct3);
%For section 4
dct4 = dct_img;
for i=1:256
for j=256:-1:(256-i+1)
dct4(i, j)=0;
img4 = idct(dct4);

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by