SlideShare a Scribd company logo
clear all,clc
I = imread('Market.png');
I=rgb2gray(I);

fun = @dct2;
mn=max(max(I))
% I1=im2double(I);

I2=I-128;
mn2=max(max(I2))

J = blkproc(I2,[8 8],fun);
imagesc(J), colormap(hot)

fun2=@idct2;

J1 = blkproc(J,[8 8],fun2);

figure(2),imshow(uint8(J1));
Original Image
After restoring the image without
           shifting back
After shifting back some values are
                 lost
We see a problem with the values
                 under 127
•   I(9:16,9:16)

•   ans =

•    45     56   81   129 148 151 152 145
•    43     46   69   115 147 154 152 147
•    41     44   59   96 138 151 153 152
•    38     40   52   78 124 148 152 151
•    39     42   47   59 104 139 151 148
•    46     43   45   47 89 130 150 152
•    56     46   44   44 71 114 146 152
•    61     45   40   47 50 95 138 149

•   >> I3(9:16,9:16)

•   ans =

•    128     128      128   129   148   151   152   145
•    128     128      128   128   147   154   152   147
•    128     128      128   128   138   151   153   152
•    128     128      128   128   128   148   152   151
•    128     128      128   128   128   139   151   148
•    128     128      128   128   128   130   150   152
•    128     128      128   128   128   128   146   152
•    128     128      128   128   128   128   138   149
Now fixing the values using int16
clear all,clc
I = imread('Market.png');
I=rgb2gray(I);

I=int16(I);
fun = @dct2;
mn=max(max(I))
% I1=im2double(I);

I2=I-128;
mn2=max(max(I2))

J = blkproc(I2,[8 8],fun);
imagesc(J), colormap(hot)
title('Color map of DCT of image');

fun2=@idct2;

J1 = blkproc(J,[8 8],fun2);

J1=J1+128;


figure(2),imshow(uint8(J1));

title('Restoring the image after shifting back');
Shifting before the DCT
J(1:8,1:8)

ans =

-638.8750 -29.3727 4.1062 -16.0527 0.1250 -7.0450 -0.2126 -4.8849
  85.6364 65.3826 33.3134 -17.2827 8.4377 -6.4442 -0.1027 -3.7384
 -39.9354 -15.6904 30.2180 9.2577 4.1787 -2.2267 2.9812 2.4027
  2.5924 -13.6623 -5.4940 -7.8364 3.6032 2.0654 1.9024 -1.0399
  2.3750 4.8097 8.6232 -5.1047 -5.6250 0.9445 0.8930 0.3232
  2.9945 -3.2131 -0.8315 6.9848 4.8601 0.3043 -1.6718 1.9621
  1.2530 -0.0697 0.7312 -0.2981 1.9222 2.9600 -0.7180 -2.5778
  2.9642 0.1810 -0.3388 -2.6802 0.8737 -1.0296 -2.5350 -1.8505

>> J(9:16,9:16)

ans =

-258.2500 -337.8517 15.4053 44.1097 -3.0000 3.1585 -0.6985 2.7715
 93.1163 -12.7923 -105.2548 6.4951 21.3826 -6.4124 -5.7623 -1.4411
  3.9429 29.0674 5.5570 -20.2654 8.7304 15.5683 -4.3624 -6.9161
  6.3625 -0.4752 -3.8135 1.3667 -8.5273 -3.2138 1.0229 2.4084
 -4.7500 5.8781 -0.2078 -5.6255 -0.5000 3.6717 -1.8081 -3.3458
  5.5093 -0.4890 -0.0957 -0.4586 -0.3461 -1.6795 0.1375 1.1942
 -0.2802 0.6512 1.8876 -2.0940 0.1721 -0.2394 -0.8070 -0.5737
  0.1225 1.8141 1.4955 -0.7570 -1.3032 -0.4243 -1.4556 0.1052
Now without shifting
DCT without shifting
J(1:8,1:8)

ans =

 385.1250 -29.3727 4.1062 -16.0527 0.1250 -7.0450 -0.2126 -4.8849
  85.6364 65.3826 33.3134 -17.2827 8.4377 -6.4442 -0.1027 -3.7384
 -39.9354 -15.6904 30.2180 9.2577 4.1787 -2.2267 2.9812 2.4027
  2.5924 -13.6623 -5.4940 -7.8364 3.6032 2.0654 1.9024 -1.0399
  2.3750 4.8097 8.6232 -5.1047 -5.6250 0.9445 0.8930 0.3232
  2.9945 -3.2131 -0.8315 6.9848 4.8601 0.3043 -1.6718 1.9621
  1.2530 -0.0697 0.7312 -0.2981 1.9222 2.9600 -0.7180 -2.5778
  2.9642 0.1810 -0.3388 -2.6802 0.8737 -1.0296 -2.5350 -1.8505

>> J(9:16,9:16)

ans =

 765.7500 -337.8517 15.4053 44.1097 -3.0000 3.1585 -0.6985 2.7715
 93.1163 -12.7923 -105.2548 6.4951 21.3826 -6.4124 -5.7623 -1.4411
  3.9429 29.0674 5.5570 -20.2654 8.7304 15.5683 -4.3624 -6.9161
  6.3625 -0.4752 -3.8135 1.3667 -8.5273 -3.2138 1.0229 2.4084
 -4.7500 5.8781 -0.2078 -5.6255 -0.5000 3.6717 -1.8081 -3.3458
  5.5093 -0.4890 -0.0957 -0.4586 -0.3461 -1.6795 0.1375 1.1942
 -0.2802 0.6512 1.8876 -2.0940 0.1721 -0.2394 -0.8070 -0.5737
  0.1225 1.8141 1.4955 -0.7570 -1.3032 -0.4243 -1.4556 0.1052
Why Shift data?
• Because the DCT is designed to work on pixel
  values ranging from -128 to 127, the original
  block is “leveled off” by subtracting 128 from
  each entry.
With shifting DC component
    becomes negative
dct2(int16(I(17:24,17:24))-128)

ans =

-257.2500 113.9048 190.8229 -14.2258 -31.7500 -26.0361 -7.0623 2.5148
 -2.2054 -19.3567 26.7378 49.5825 18.4131 11.2723 -8.1334 -1.2940
 -3.0683 -6.7897 -8.6176 -2.1773 0.6929 2.1958 0.9660 -1.2293
  2.3132 3.9376 3.2723 8.6746 4.5256 2.9021 1.4571 1.7553
     0 1.4061 -3.0190 -1.6145 1.5000 1.3845 -0.1025 -2.3183
 -0.8553 -1.8905 2.8431 0.5789 3.0710 -1.4592 0.0228 -1.5351
 -4.1410 2.3969 2.2160 2.8282 -0.2870 -0.1222 -0.1324 1.9538
  1.8516 1.3828 -0.3954 2.7004 0.8187 1.7177 -0.6069 -1.3586

K>> dct2(int16(I(17:24,17:24)))

ans =

 766.7500 113.9048 190.8229 -14.2258 -31.7500 -26.0361 -7.0623 2.5148
 -2.2054 -19.3567 26.7378 49.5825 18.4131 11.2723 -8.1334 -1.2940
 -3.0683 -6.7897 -8.6176 -2.1773 0.6929 2.1958 0.9660 -1.2293
  2.3132 3.9376 3.2723 8.6746 4.5256 2.9021 1.4571 1.7553
     0 1.4061 -3.0190 -1.6145 1.5000 1.3845 -0.1025 -2.3183
 -0.8553 -1.8905 2.8431 0.5789 3.0710 -1.4592 0.0228 -1.5351
 -4.1410 2.3969 2.2160 2.8282 -0.2870 -0.1222 -0.1324 1.9538
  1.8516 1.3828 -0.3954 2.7004 0.8187 1.7177 -0.6069 -1.3586

More Related Content

What's hot

solucionario mecanica vectorial para ingenieros - beer & johnston (dinamica)...
solucionario mecanica vectorial para ingenieros - beer  & johnston (dinamica)...solucionario mecanica vectorial para ingenieros - beer  & johnston (dinamica)...
solucionario mecanica vectorial para ingenieros - beer & johnston (dinamica)...
Sohar Carr
 
Poster of surveying tasks
Poster of surveying tasksPoster of surveying tasks
Poster of surveying tasks
Talha Hussain
 
vibration of machines and structures
vibration of machines and structuresvibration of machines and structures
vibration of machines and structures
Aniruddhsinh Barad
 
Capítulo 02 considerações estatísticas
Capítulo 02   considerações estatísticasCapítulo 02   considerações estatísticas
Capítulo 02 considerações estatísticas
Jhayson Carvalho
 
Analisis gap dan thurstone
Analisis gap dan thurstoneAnalisis gap dan thurstone
Analisis gap dan thurstone
M Taufiq Budi H
 
Solución al ejercicio 1
Solución al ejercicio 1Solución al ejercicio 1
Solución al ejercicio 1
Jesthiger Cohil
 
電路學 - [第二章] 電路分析方法
電路學 - [第二章] 電路分析方法電路學 - [第二章] 電路分析方法
電路學 - [第二章] 電路分析方法
Simen Li
 
solucionario mecanica vectorial para ingenieros - beer & johnston (dinamica)...
solucionario mecanica vectorial para ingenieros - beer  & johnston (dinamica)...solucionario mecanica vectorial para ingenieros - beer  & johnston (dinamica)...
solucionario mecanica vectorial para ingenieros - beer & johnston (dinamica)...
Sohar Carr
 
W ee network_theory_10-06-17_ls2-sol
W ee network_theory_10-06-17_ls2-solW ee network_theory_10-06-17_ls2-sol
W ee network_theory_10-06-17_ls2-sol
Ankit Chaurasia
 
Design of a Lift Mechanism for Disabled People
Design of a Lift Mechanism for Disabled PeopleDesign of a Lift Mechanism for Disabled People
Design of a Lift Mechanism for Disabled People
Samet Baykul
 
Deep Learning A-Z™: Artificial Neural Networks (ANN) - How do Neural Networks...
Deep Learning A-Z™: Artificial Neural Networks (ANN) - How do Neural Networks...Deep Learning A-Z™: Artificial Neural Networks (ANN) - How do Neural Networks...
Deep Learning A-Z™: Artificial Neural Networks (ANN) - How do Neural Networks...
Kirill Eremenko
 
Cap 12
Cap 12Cap 12
Clase 16 dsp
Clase 16 dspClase 16 dsp
Clase 16 dsp
Marcelo Valdiviezo
 
Cap 03
Cap 03Cap 03
Cap 03
UO
 
Sol cap 10 edicion 8
Sol cap 10   edicion 8Sol cap 10   edicion 8
Sol cap 10 edicion 8
Sandrai Vargasl
 
Solution shigley's
Solution shigley'sSolution shigley's
Solution shigley's
Alemu Abera
 
Capítulo 10 mola
Capítulo 10   molaCapítulo 10   mola
Capítulo 10 mola
Jhayson Carvalho
 
電路學 - [第八章] 磁耦合電路
電路學 - [第八章] 磁耦合電路電路學 - [第八章] 磁耦合電路
電路學 - [第八章] 磁耦合電路
Simen Li
 

What's hot (18)

solucionario mecanica vectorial para ingenieros - beer & johnston (dinamica)...
solucionario mecanica vectorial para ingenieros - beer  & johnston (dinamica)...solucionario mecanica vectorial para ingenieros - beer  & johnston (dinamica)...
solucionario mecanica vectorial para ingenieros - beer & johnston (dinamica)...
 
Poster of surveying tasks
Poster of surveying tasksPoster of surveying tasks
Poster of surveying tasks
 
vibration of machines and structures
vibration of machines and structuresvibration of machines and structures
vibration of machines and structures
 
Capítulo 02 considerações estatísticas
Capítulo 02   considerações estatísticasCapítulo 02   considerações estatísticas
Capítulo 02 considerações estatísticas
 
Analisis gap dan thurstone
Analisis gap dan thurstoneAnalisis gap dan thurstone
Analisis gap dan thurstone
 
Solución al ejercicio 1
Solución al ejercicio 1Solución al ejercicio 1
Solución al ejercicio 1
 
電路學 - [第二章] 電路分析方法
電路學 - [第二章] 電路分析方法電路學 - [第二章] 電路分析方法
電路學 - [第二章] 電路分析方法
 
solucionario mecanica vectorial para ingenieros - beer & johnston (dinamica)...
solucionario mecanica vectorial para ingenieros - beer  & johnston (dinamica)...solucionario mecanica vectorial para ingenieros - beer  & johnston (dinamica)...
solucionario mecanica vectorial para ingenieros - beer & johnston (dinamica)...
 
W ee network_theory_10-06-17_ls2-sol
W ee network_theory_10-06-17_ls2-solW ee network_theory_10-06-17_ls2-sol
W ee network_theory_10-06-17_ls2-sol
 
Design of a Lift Mechanism for Disabled People
Design of a Lift Mechanism for Disabled PeopleDesign of a Lift Mechanism for Disabled People
Design of a Lift Mechanism for Disabled People
 
Deep Learning A-Z™: Artificial Neural Networks (ANN) - How do Neural Networks...
Deep Learning A-Z™: Artificial Neural Networks (ANN) - How do Neural Networks...Deep Learning A-Z™: Artificial Neural Networks (ANN) - How do Neural Networks...
Deep Learning A-Z™: Artificial Neural Networks (ANN) - How do Neural Networks...
 
Cap 12
Cap 12Cap 12
Cap 12
 
Clase 16 dsp
Clase 16 dspClase 16 dsp
Clase 16 dsp
 
Cap 03
Cap 03Cap 03
Cap 03
 
Sol cap 10 edicion 8
Sol cap 10   edicion 8Sol cap 10   edicion 8
Sol cap 10 edicion 8
 
Solution shigley's
Solution shigley'sSolution shigley's
Solution shigley's
 
Capítulo 10 mola
Capítulo 10   molaCapítulo 10   mola
Capítulo 10 mola
 
電路學 - [第八章] 磁耦合電路
電路學 - [第八章] 磁耦合電路電路學 - [第八章] 磁耦合電路
電路學 - [第八章] 磁耦合電路
 

Similar to Image dct shifting

Convolution as matrix multiplication
Convolution as matrix multiplicationConvolution as matrix multiplication
Convolution as matrix multiplication
Edwin Efraín Jiménez Lepe
 
Ejerciciooo3
Ejerciciooo3Ejerciciooo3
Ejerciciooo3
DanielRojas118002
 
Matlab Assignment JK Institute
Matlab Assignment JK InstituteMatlab Assignment JK Institute
Matlab Assignment JK Institute
Om Prakash
 
Data Science Is More Than Just Statistics
Data Science Is More Than Just StatisticsData Science Is More Than Just Statistics
Data Science Is More Than Just Statistics
Digital Transformation EXPO Event Series
 
Tablas normal chi cuadrado y t student 1-semana 6
Tablas normal chi cuadrado y t student 1-semana 6Tablas normal chi cuadrado y t student 1-semana 6
Tablas normal chi cuadrado y t student 1-semana 6
Karla Diaz
 
Introduction to MATLAB
Introduction to MATLAB Introduction to MATLAB
Introduction to MATLAB
COMSATS Abbottabad
 
project designa.docx
project designa.docxproject designa.docx
project designa.docx
Mahamad Jawhar
 
Discrete cosine Transform and Digital Image compression.ppt
Discrete cosine Transform and Digital Image compression.pptDiscrete cosine Transform and Digital Image compression.ppt
Discrete cosine Transform and Digital Image compression.ppt
kanimozhirajasekaren
 
Geometry Commands
Geometry CommandsGeometry Commands
Geometry Commands
Jared Erickson
 
Attention-Based Adaptive Selection of Operations for Image Restoration in the...
Attention-Based Adaptive Selection of Operations for Image Restoration in the...Attention-Based Adaptive Selection of Operations for Image Restoration in the...
Attention-Based Adaptive Selection of Operations for Image Restoration in the...
MasanoriSuganuma
 
Scaling the #2ndhalf
Scaling the #2ndhalfScaling the #2ndhalf
Scaling the #2ndhalf
Salo Shp
 
Financial Data Mining Talk
Financial Data Mining TalkFinancial Data Mining Talk
Financial Data Mining Talk
Mike Bowles
 
Compressible Flow Tables and Plots
Compressible Flow Tables and PlotsCompressible Flow Tables and Plots
Compressible Flow Tables and Plots
Engineering Software
 
Arna Friend Controls II Final
Arna Friend Controls II FinalArna Friend Controls II Final
Arna Friend Controls II Final
Arna Friend
 
Acrylic gearbox creative journey
Acrylic gearbox creative journeyAcrylic gearbox creative journey
Acrylic gearbox creative journey
Raymond Bell
 
Tarea 2 hidraulica iii-cabrera arias roberto alejandro
Tarea 2 hidraulica iii-cabrera arias roberto alejandroTarea 2 hidraulica iii-cabrera arias roberto alejandro
Tarea 2 hidraulica iii-cabrera arias roberto alejandro
Alejandro Cabrera
 
Ch02
Ch02Ch02
Perhitunngan
PerhitunnganPerhitunngan
Perhitunngan
Nadya Herida
 
Calculation template
Calculation templateCalculation template
Calculation template
Yekian Ian
 
Elliptic Curve Cryptography
Elliptic Curve CryptographyElliptic Curve Cryptography
Elliptic Curve Cryptography
JorgeVillamarin5
 

Similar to Image dct shifting (20)

Convolution as matrix multiplication
Convolution as matrix multiplicationConvolution as matrix multiplication
Convolution as matrix multiplication
 
Ejerciciooo3
Ejerciciooo3Ejerciciooo3
Ejerciciooo3
 
Matlab Assignment JK Institute
Matlab Assignment JK InstituteMatlab Assignment JK Institute
Matlab Assignment JK Institute
 
Data Science Is More Than Just Statistics
Data Science Is More Than Just StatisticsData Science Is More Than Just Statistics
Data Science Is More Than Just Statistics
 
Tablas normal chi cuadrado y t student 1-semana 6
Tablas normal chi cuadrado y t student 1-semana 6Tablas normal chi cuadrado y t student 1-semana 6
Tablas normal chi cuadrado y t student 1-semana 6
 
Introduction to MATLAB
Introduction to MATLAB Introduction to MATLAB
Introduction to MATLAB
 
project designa.docx
project designa.docxproject designa.docx
project designa.docx
 
Discrete cosine Transform and Digital Image compression.ppt
Discrete cosine Transform and Digital Image compression.pptDiscrete cosine Transform and Digital Image compression.ppt
Discrete cosine Transform and Digital Image compression.ppt
 
Geometry Commands
Geometry CommandsGeometry Commands
Geometry Commands
 
Attention-Based Adaptive Selection of Operations for Image Restoration in the...
Attention-Based Adaptive Selection of Operations for Image Restoration in the...Attention-Based Adaptive Selection of Operations for Image Restoration in the...
Attention-Based Adaptive Selection of Operations for Image Restoration in the...
 
Scaling the #2ndhalf
Scaling the #2ndhalfScaling the #2ndhalf
Scaling the #2ndhalf
 
Financial Data Mining Talk
Financial Data Mining TalkFinancial Data Mining Talk
Financial Data Mining Talk
 
Compressible Flow Tables and Plots
Compressible Flow Tables and PlotsCompressible Flow Tables and Plots
Compressible Flow Tables and Plots
 
Arna Friend Controls II Final
Arna Friend Controls II FinalArna Friend Controls II Final
Arna Friend Controls II Final
 
Acrylic gearbox creative journey
Acrylic gearbox creative journeyAcrylic gearbox creative journey
Acrylic gearbox creative journey
 
Tarea 2 hidraulica iii-cabrera arias roberto alejandro
Tarea 2 hidraulica iii-cabrera arias roberto alejandroTarea 2 hidraulica iii-cabrera arias roberto alejandro
Tarea 2 hidraulica iii-cabrera arias roberto alejandro
 
Ch02
Ch02Ch02
Ch02
 
Perhitunngan
PerhitunnganPerhitunngan
Perhitunngan
 
Calculation template
Calculation templateCalculation template
Calculation template
 
Elliptic Curve Cryptography
Elliptic Curve CryptographyElliptic Curve Cryptography
Elliptic Curve Cryptography
 

More from Amr Nasr

Comparison of image fusion methods
Comparison of image fusion methodsComparison of image fusion methods
Comparison of image fusion methods
Amr Nasr
 
6 big google buys of 2012
6 big google buys of 20126 big google buys of 2012
6 big google buys of 2012
Amr Nasr
 
Video watermarking
Video watermarkingVideo watermarking
Video watermarking
Amr Nasr
 
Scaling compression2
Scaling compression2Scaling compression2
Scaling compression2
Amr Nasr
 
Compression one example
Compression one exampleCompression one example
Compression one example
Amr Nasr
 
Video watermarking
Video watermarkingVideo watermarking
Video watermarking
Amr Nasr
 
Watermark
WatermarkWatermark
Watermark
Amr Nasr
 
Whitebalance
WhitebalanceWhitebalance
Whitebalance
Amr Nasr
 
Wavelet
WaveletWavelet
Wavelet
Amr Nasr
 
Wavelet watermark level3
Wavelet watermark level3Wavelet watermark level3
Wavelet watermark level3
Amr Nasr
 
Wavelet watermark level2
Wavelet watermark level2Wavelet watermark level2
Wavelet watermark level2
Amr Nasr
 
Two dimensional true wavelet compression
Two dimensional true wavelet compressionTwo dimensional true wavelet compression
Two dimensional true wavelet compression
Amr Nasr
 
Image fft
Image fftImage fft
Image fft
Amr Nasr
 
Tcp snoop protocols
Tcp snoop protocols  Tcp snoop protocols
Tcp snoop protocols
Amr Nasr
 
Digital forensics lessons
Digital forensics lessons   Digital forensics lessons
Digital forensics lessons
Amr Nasr
 
Crypt
CryptCrypt
Crypt
Amr Nasr
 

More from Amr Nasr (16)

Comparison of image fusion methods
Comparison of image fusion methodsComparison of image fusion methods
Comparison of image fusion methods
 
6 big google buys of 2012
6 big google buys of 20126 big google buys of 2012
6 big google buys of 2012
 
Video watermarking
Video watermarkingVideo watermarking
Video watermarking
 
Scaling compression2
Scaling compression2Scaling compression2
Scaling compression2
 
Compression one example
Compression one exampleCompression one example
Compression one example
 
Video watermarking
Video watermarkingVideo watermarking
Video watermarking
 
Watermark
WatermarkWatermark
Watermark
 
Whitebalance
WhitebalanceWhitebalance
Whitebalance
 
Wavelet
WaveletWavelet
Wavelet
 
Wavelet watermark level3
Wavelet watermark level3Wavelet watermark level3
Wavelet watermark level3
 
Wavelet watermark level2
Wavelet watermark level2Wavelet watermark level2
Wavelet watermark level2
 
Two dimensional true wavelet compression
Two dimensional true wavelet compressionTwo dimensional true wavelet compression
Two dimensional true wavelet compression
 
Image fft
Image fftImage fft
Image fft
 
Tcp snoop protocols
Tcp snoop protocols  Tcp snoop protocols
Tcp snoop protocols
 
Digital forensics lessons
Digital forensics lessons   Digital forensics lessons
Digital forensics lessons
 
Crypt
CryptCrypt
Crypt
 

Recently uploaded

UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
Zilliz
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 

Recently uploaded (20)

UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 

Image dct shifting

  • 1.
  • 2. clear all,clc I = imread('Market.png'); I=rgb2gray(I); fun = @dct2; mn=max(max(I)) % I1=im2double(I); I2=I-128; mn2=max(max(I2)) J = blkproc(I2,[8 8],fun); imagesc(J), colormap(hot) fun2=@idct2; J1 = blkproc(J,[8 8],fun2); figure(2),imshow(uint8(J1));
  • 4. After restoring the image without shifting back
  • 5. After shifting back some values are lost
  • 6. We see a problem with the values under 127 • I(9:16,9:16) • ans = • 45 56 81 129 148 151 152 145 • 43 46 69 115 147 154 152 147 • 41 44 59 96 138 151 153 152 • 38 40 52 78 124 148 152 151 • 39 42 47 59 104 139 151 148 • 46 43 45 47 89 130 150 152 • 56 46 44 44 71 114 146 152 • 61 45 40 47 50 95 138 149 • >> I3(9:16,9:16) • ans = • 128 128 128 129 148 151 152 145 • 128 128 128 128 147 154 152 147 • 128 128 128 128 138 151 153 152 • 128 128 128 128 128 148 152 151 • 128 128 128 128 128 139 151 148 • 128 128 128 128 128 130 150 152 • 128 128 128 128 128 128 146 152 • 128 128 128 128 128 128 138 149
  • 7. Now fixing the values using int16 clear all,clc I = imread('Market.png'); I=rgb2gray(I); I=int16(I); fun = @dct2; mn=max(max(I)) % I1=im2double(I); I2=I-128; mn2=max(max(I2)) J = blkproc(I2,[8 8],fun); imagesc(J), colormap(hot) title('Color map of DCT of image'); fun2=@idct2; J1 = blkproc(J,[8 8],fun2); J1=J1+128; figure(2),imshow(uint8(J1)); title('Restoring the image after shifting back');
  • 8.
  • 9.
  • 10. Shifting before the DCT J(1:8,1:8) ans = -638.8750 -29.3727 4.1062 -16.0527 0.1250 -7.0450 -0.2126 -4.8849 85.6364 65.3826 33.3134 -17.2827 8.4377 -6.4442 -0.1027 -3.7384 -39.9354 -15.6904 30.2180 9.2577 4.1787 -2.2267 2.9812 2.4027 2.5924 -13.6623 -5.4940 -7.8364 3.6032 2.0654 1.9024 -1.0399 2.3750 4.8097 8.6232 -5.1047 -5.6250 0.9445 0.8930 0.3232 2.9945 -3.2131 -0.8315 6.9848 4.8601 0.3043 -1.6718 1.9621 1.2530 -0.0697 0.7312 -0.2981 1.9222 2.9600 -0.7180 -2.5778 2.9642 0.1810 -0.3388 -2.6802 0.8737 -1.0296 -2.5350 -1.8505 >> J(9:16,9:16) ans = -258.2500 -337.8517 15.4053 44.1097 -3.0000 3.1585 -0.6985 2.7715 93.1163 -12.7923 -105.2548 6.4951 21.3826 -6.4124 -5.7623 -1.4411 3.9429 29.0674 5.5570 -20.2654 8.7304 15.5683 -4.3624 -6.9161 6.3625 -0.4752 -3.8135 1.3667 -8.5273 -3.2138 1.0229 2.4084 -4.7500 5.8781 -0.2078 -5.6255 -0.5000 3.6717 -1.8081 -3.3458 5.5093 -0.4890 -0.0957 -0.4586 -0.3461 -1.6795 0.1375 1.1942 -0.2802 0.6512 1.8876 -2.0940 0.1721 -0.2394 -0.8070 -0.5737 0.1225 1.8141 1.4955 -0.7570 -1.3032 -0.4243 -1.4556 0.1052
  • 12. DCT without shifting J(1:8,1:8) ans = 385.1250 -29.3727 4.1062 -16.0527 0.1250 -7.0450 -0.2126 -4.8849 85.6364 65.3826 33.3134 -17.2827 8.4377 -6.4442 -0.1027 -3.7384 -39.9354 -15.6904 30.2180 9.2577 4.1787 -2.2267 2.9812 2.4027 2.5924 -13.6623 -5.4940 -7.8364 3.6032 2.0654 1.9024 -1.0399 2.3750 4.8097 8.6232 -5.1047 -5.6250 0.9445 0.8930 0.3232 2.9945 -3.2131 -0.8315 6.9848 4.8601 0.3043 -1.6718 1.9621 1.2530 -0.0697 0.7312 -0.2981 1.9222 2.9600 -0.7180 -2.5778 2.9642 0.1810 -0.3388 -2.6802 0.8737 -1.0296 -2.5350 -1.8505 >> J(9:16,9:16) ans = 765.7500 -337.8517 15.4053 44.1097 -3.0000 3.1585 -0.6985 2.7715 93.1163 -12.7923 -105.2548 6.4951 21.3826 -6.4124 -5.7623 -1.4411 3.9429 29.0674 5.5570 -20.2654 8.7304 15.5683 -4.3624 -6.9161 6.3625 -0.4752 -3.8135 1.3667 -8.5273 -3.2138 1.0229 2.4084 -4.7500 5.8781 -0.2078 -5.6255 -0.5000 3.6717 -1.8081 -3.3458 5.5093 -0.4890 -0.0957 -0.4586 -0.3461 -1.6795 0.1375 1.1942 -0.2802 0.6512 1.8876 -2.0940 0.1721 -0.2394 -0.8070 -0.5737 0.1225 1.8141 1.4955 -0.7570 -1.3032 -0.4243 -1.4556 0.1052
  • 13. Why Shift data? • Because the DCT is designed to work on pixel values ranging from -128 to 127, the original block is “leveled off” by subtracting 128 from each entry.
  • 14.
  • 15. With shifting DC component becomes negative dct2(int16(I(17:24,17:24))-128) ans = -257.2500 113.9048 190.8229 -14.2258 -31.7500 -26.0361 -7.0623 2.5148 -2.2054 -19.3567 26.7378 49.5825 18.4131 11.2723 -8.1334 -1.2940 -3.0683 -6.7897 -8.6176 -2.1773 0.6929 2.1958 0.9660 -1.2293 2.3132 3.9376 3.2723 8.6746 4.5256 2.9021 1.4571 1.7553 0 1.4061 -3.0190 -1.6145 1.5000 1.3845 -0.1025 -2.3183 -0.8553 -1.8905 2.8431 0.5789 3.0710 -1.4592 0.0228 -1.5351 -4.1410 2.3969 2.2160 2.8282 -0.2870 -0.1222 -0.1324 1.9538 1.8516 1.3828 -0.3954 2.7004 0.8187 1.7177 -0.6069 -1.3586 K>> dct2(int16(I(17:24,17:24))) ans = 766.7500 113.9048 190.8229 -14.2258 -31.7500 -26.0361 -7.0623 2.5148 -2.2054 -19.3567 26.7378 49.5825 18.4131 11.2723 -8.1334 -1.2940 -3.0683 -6.7897 -8.6176 -2.1773 0.6929 2.1958 0.9660 -1.2293 2.3132 3.9376 3.2723 8.6746 4.5256 2.9021 1.4571 1.7553 0 1.4061 -3.0190 -1.6145 1.5000 1.3845 -0.1025 -2.3183 -0.8553 -1.8905 2.8431 0.5789 3.0710 -1.4592 0.0228 -1.5351 -4.1410 2.3969 2.2160 2.8282 -0.2870 -0.1222 -0.1324 1.9538 1.8516 1.3828 -0.3954 2.7004 0.8187 1.7177 -0.6069 -1.3586