# How to get the original Image matrix from the Integral Image of a N*N matrix?

조회 수: 1(최근 30일)
IF the original image matrix is represented by r=[ 1 2 3 4;5 6 7 8;9 10 11 12;13 14 15 16]. Then it's integral image using the inbuilt 'integralImage' function is given by
0 0 0 0 0
0 1 3 6 10
0 6 14 24 36
0 15 33 54 78
0 28 60 96 136
Excluding first row and first column we get
1 3 6 10
6 14 24 36
15 33 54 78
28 60 96 136
My requirement is to obtain the original image from the given integral image provided.

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

### 채택된 답변

Stephen Cobeldick 13 Dec 2018
편집: Stephen Cobeldick 13 Dec 2018
A simple solution based on the explanation given on the integralImage help page:
>> II = [0,0,0,0,0;0,1,3,6,10;0,6,14,24,36;0,15,33,54,78;0,28,60,96,136]
II =
0 0 0 0 0
0 1 3 6 10
0 6 14 24 36
0 15 33 54 78
0 28 60 96 136
>> II(2:end,2:end)-II(2:end,1:end-1)-II(1:end-1,2:end)+II(1:end-1,1:end-1)
ans =
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
##### 댓글 수: 1표시숨기기 없음
Karthik Nagaraj 13 Dec 2018
Thank you so much!

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

### 추가 답변(1개)

Diarmaid Cualain 18 Dec 2018
To supplement stephens answer, you can also use the Matlab function "diff":
>>II = [0,0,0,0,0;0,1,3,6,10;0,6,14,24,36;0,15,33,54,78;0,28,60,96,136]
>>diff(diff(II,1,2),[])
ans =
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
##### 댓글 수: 2표시숨기기 이전 댓글 수: 1
Diarmaid Cualain 15 Jan 2019

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

### Community Treasure Hunt

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

Start Hunting!

Translated by