34
On a Generalization of the GCD for Intervals in R + Stan Baggen June 4, 2014 or how can a camera see at least 1 tone for unkown T ex

On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Embed Size (px)

Citation preview

Page 1: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

On a Generalization of the GCD for Intervals in R+

Stan Baggen June 4, 2014

orhow can a camera see at least 1 tone for unkown Texp

Page 2: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen

Contents

• Introduction

• Cameras, exposure times and problem definition

• Introduction to Solution using GCD for Integer Frequencies

• Extension of GCD to intervals over R+

• Application to the Original Problem

• Discussion

• Yet another generalization

2

Page 3: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen 3

Introduction

• Transmit digital information from a luminaire to a smartphone or tablet using Visible Light Communication (VLC)

– Bits are encoded in small intensity variations of the emitted light

– Detect bits using the camera of a smartphone

• We consider an FSK-based system

– Symbols correspond to frequencies (tones)

– Emitted light variations are sinusoidal

• Problem: camera may be “blind” for certain frequencies

Page 4: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen 4

Camera Image divided into lines and pixels

original image sequence

lines covering source

lines per frame

hidden lines

active lines

• Each line consists of a row of pixels

Page 5: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen

• A camera can set its exposure time Texp • typically, Texp ranges from 1/30 to 1/2500 [s]

• Each pixel “sees” the average light during Texp seconds before read-out– smearing of intensity variations of received light

• If an integer number of periods of a sinusoid fit into Texp, the camera

cannot detect such a sinusoid

Exposure Time

time

Texp

ISI filter (moving average)

0 1 2 3 4 5 6 7 8 9 100

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

f

|sin

c(f)

|

Transfer Function of Exposure Time

|sinc(f)|

|sinc(0.7f)|

f1 f2

Page 6: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen

• Due to the exposure time Texp of a camera, certain frequencies cannot

be detected by it (multiples of fexp = 1/Texp)

• Can we have sets of 2 frequencies each, such that not both can be blocked for any fexp ≥ 30 Hz

• Each set then forms an fexp-independent

detection set for a light source that emitsboth frequencies

0 1 2 3 4 5 6 7 8 9 100

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

f

|sin

c(f)

|

Transfer Function of Exposure Time

|sinc(f)|

|sinc(0.7f)|

Exposure Time

6

f1 f2

time

Texp

ISI filter

Page 7: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen

Discrete Solution

• If the involved frequencies can only take on integer values, we can find solutions using the GCD (Greatest Common Divisor) from number theory

• We would like to have 2 frequencies f1 and f2, such that not both can be

integer multiples of any fexp ≥ 30

• Suppose that both f1 and f2 are integer multiples of fexp

• If GCD(f1,f2) < 30 no solution possible for fexp ≥ 30

pair (f1,f2) is a good choice7

),GCD(||

|21exp

2exp

1expfff

ff

ff

Page 8: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen

Discrete Solution: Example

• f1 = 290; f2 = 319

• Largest integer that divides both f1 and f2 equals GCD(f1,f2) = 29

• No integer fexp ≥ 30 exists for which multiples are simultaneously equal

to f1 and f2

8

Page 9: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen

Problem with Discrete Solution

• GCD(300,301) = 1; GCD(300,300) = 300

• Physically: due to the nature of the Texp-filter and detection algorithms,

if a pair of frequencies (f1,f2) is bad for detection, then a real interval

(f1±ε,f2 ±ε) is also bad

• We need a method that allows us to eliminate bad intervals over R+

9

0 1 2 3 4 5 6 7 8 9 100

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

f

|sin

c(f)

|

Transfer Function of Exposure Time

|sinc(f)|

|sinc(0.7f)|

f1 f2

Page 10: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen

GCD for intervals in R+

• Consider 2 half-open intervals I1 and I2 in R+

• Definition:

• Note that the concept I1,I2: GCD(I1,I2) < 30 solves our original problem:

• There can be no real fexp≥30 such that integer multiples are

simultaneously close to F1 and F2 10

21,21 |max:),GCD( ImaInaRaII Nmn

0( ] ( ]

I1 I2

0( ] ( ]

1F 2F

30

Page 11: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen

GCD for intervals in R+

• How to find GCD(I1,I2)?

• Define divisor sets D1,D2 in R:

• Theorem 1:

• Proof: □

11

21,21 |max:),GCD( ImaInaRaII Nmn

0( ] ( ]

I1 I2

2121 max),GCD( DDII

22

11

|

|

ImdRdD

IndRdD

Nm

Nn

21

2121

|

||

ImdIndRd

ImdRdIndRdDD

NmNn

NmNn

Page 12: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen

Example

12

0 50 100 150 200 250 300-1

0

1

2

3

4

5

frequency

divisor sets, their intersection and the GCD, f1 = 240, f2 = 256, interval = 16

f1 = 240

f2 = 256GCD = 28.4444

]240,16240(1 I

]256,16256(2 I

21 DD

),GCD( 21 II

11 | IndRdD Nn

22 | ImdRdD Nm

Page 13: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen 13

10 15 20 25 30

0

0.5

1

1.5

2

2.5

frequency

divisor sets, their intersection and the GCD, f1 = 240, f2 = 256, interval = 16

f1 = 240

f2 = 256GCD = 28.4444

Enlargement of Example

1D

21 DD ),GCD( 21 II

2D

Page 14: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen

Overlap of Intervals in Divisor Sets

• Consider divisor set

• Let where

• Theorem 2: for w>0, D consists of a finite number n0 of disjunct

intervals, where

• Proof: overlap of consecutive intervals happens if

• Corollary:

14

0( ]

I

],(,| fwfIIndRdD Nn

2n3nfwf

NnnIIndRdDn ,/|

1D2/12 DD

n

nDD

w

fn0

w

fn

w

fn

n

wf

n

f0.

1

00

,0,0,,0n

fwD

n

f

3/13 DD

Page 15: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen

Another Theorem

• Suppose that we have 2 intervals I1=(f1-w1,f1] and I2=(f2-w2,f2]

• Theorem 3: For w1,w2> 0, GCD(f1,f2 ; w1,w2) equals an integer sub-multiple of

either f1, f2 or both

• Proof:

equals a right limit point of for some i and j.

Each is the intersection of 2 half-open intervals (...], where the right limit point of each half-open interval is an integer sub-multiple of either f1 or f2 or both.

□• Note: f1 and f2 are real numbers 15

ji

ji

j

j

i

i DDDDDD,

212121

21max DD ji DD 21

ji DD 21

Page 16: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen

Some Interesting Examples

• Numbers in N+

– For w sufficiently small, we find the classical solutions for f1, f2 in N+

– GCD(15,21; w≤1) = 3

– GCD(15,21; w=1.1) = 7 • w too large for finding the classical solution

• Numbers in Q+

– GCD(0.9,1.2; w=0.1) = 0.3

• Numbers in R+ (computed with finite precision)– GCD(7π,8π; w=0.1) = 3.1416– GCD(6π,8π; w=0.1) = 6.2832

16

Page 17: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen

Application to the Original Problem

• Suppose that we find that for a certain (f1, f2; w1,w2) :

GCD (f1, f2; w1,w2) < 30

• Then there exists no real number fexp≥30 such that integer multiples of

fexp fall simultaneously in (f1-w1, f1] and (f2-w2, f2]

• By picking F1= f1-w1/2 and F2= f2-w2/2, we can insure that if one multiple

of fexp≥30 falls within a range of wi/2 of Fi for some i, then the other

interval is free from any multiple of fexp

17

2f22 wf

0( ] ( ]

30f

11 wf 1f1F 2F

Page 18: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen 18

Numerical Examples (1)

100 200 300 400 500 600 7000

200

400

600

800

1000

1200

frequency

acce

ptab

le f

requ

ency

pai

rs

Acceptable integer frequency pairs for w = 15, GCD < 30, 100 < f < 700

acceptable_frequencies_2012_10_20_1

Page 19: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen 19

100 120 140 160 180 200 220

100

150

200

250

300

frequency

acce

ptab

le f

requ

ency

pai

rs

Acceptable integer frequency pairs for w = 15, GCD < 30, 100 < f < 700

acceptable_frequencies_2012_10_20_1

typical solutions: (f1,f2) = (f1, f1+15)

Numerical Examples (1) detail

Page 20: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen 20

100 200 300 400 500 600 7000

500

1000

1500

2000

2500

frequency

acce

ptab

le f

requ

ency

pai

rs

Acceptable integer frequency pairs for w = 14, GCD < 30, 100 < f < 700

Numerical Examples (2)

acceptable_frequencies_2012_10_18_2

Page 21: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen 21

90 100 110 120 130 140 150 160 170 180 190

0

50

100

150

200

250

300

350

frequency

acce

ptab

le f

requ

ency

pai

rs

Acceptable integer frequency pairs for w = 14, GCD < 30, 100 < f < 700

Numerical Examples (2) detail

acceptable_frequencies_2012_10_18_2

Page 22: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen 22

100 200 300 400 500 600 7000

500

1000

1500

2000

2500

3000

3500

4000

4500

5000

frequency

acce

ptab

le f

requ

ency

pai

rs

Acceptable integer frequency pairs for w = 12, GCD < 30, 100 < f < 700

Numerical Examples (3)

acceptable_frequencies_2012_10_18_3

Page 23: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen 23

100 200 300 400 500 600 7000

1000

2000

3000

4000

5000

6000

7000

8000

9000

frequency

acce

ptab

le f

requ

ency

pai

rs

Acceptable integer frequency pairs for w = 10, GCD < 30, 100 < f < 700

Numerical Examples (4)

acceptable_frequencies_2012_10_18_4

Page 24: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen 24

100 120 140 160 180 200 220 240 260 280 300

0

100

200

300

400

500

600

700

800

900

frequency

acce

ptab

le f

requ

ency

pai

rs

Acceptable integer frequency pairs for w = 10, GCD < 30, 100 < f < 700

Numerical Examples (4) detail

acceptable_frequencies_2012_10_18_4

typical solutions: (f1,f2) = (f1, f1+15), (f1, 2f1-20), ), (f1, 2f1+15)

Page 25: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen

Discussion (1)

• It is convenient to use half open intervals (…] and have the right limit point as a characterizing number, since then

– We can reproduce the familiar results from number theory– The maximum in the definition of GCD exists– We do not obtain subsets in having measure 0

• The concept of GCD can be generalized to an arbitrary number of K intervals over R+

• Theorem 2 shows that the complexity of the computation of a GCD is reasonable

• Can we have an efficient algorithm like Euclid’s algorithm for computing the GCD of real intervals?

25

21 DD

K

kkK DII

11 max),...,GCD(

Page 26: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen

Discussion (2)

• It can be shown that GCD(f1, f2;w) is non-decreasing as w increases

• For rational numbers a/b and p/q, where a,b,p,q are in N+, we find for sufficiently small w:

where LCM(.) is the Least Common Multiple.

How small must w be as a function of a,b,p and q to find this solution?

• Conjecture: for incommensurable numbers a and b

• Effects of finite precision computations

26

,),LCM(

),LCM(,),LCM(

;,qb

qp

qbba

qbGCD

wq

p

b

aGCD

0;,lim0

wbaGCDw

Page 27: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen

Yet Another Generalization

• GCD(f1,f2;w) on intervals still makes hard decisions on frequencies

being in or out of intervals

• Can we make some sensible reasoning that leads to “smooth” decisions concerning acceptable frequency pairs

• We have to use a more friendly measure on the intervals

• We start by re-phrasing the previous approach in a different manner

27

Page 28: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen

• GCD(f1,f2;w) on intervals as discussed previously, effectively uses

indicator functions as a measure of membership:

• Divisor Measure DM1,DM2 in R+

28

0( ] ( ]

I1 I2

1

1)()(max:),( 2121

fDMfDMIIGCDRf

2,1,),(max:)(

iRfnfMfDM

iINni

1IM

2IM

RffMfM IIII ,1)(;1)(2211

f

Page 29: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen 29

0 2 4 6 8 10 12 140

1

2

3

4

5

6

7

f

cost

s

Cost Functions

D1

D2D1 D2Example

f1 = 9; f2 = 12

w = 0.5

GCD(f1,f1;w) = 3

0 0.5 1 1.5 2 2.5 3 3.5

0

1

2

3

4

5

6

f

cost

s

Cost Functions

D1

D2D1 D2

9

12

3

Page 30: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen

Using a Different Measure

• Suppose that we change the definition of the measure of membership for the fundamental interval

• Divisor Measure:

• Common Divisor Measure:

30

),;(),;(:),,,;( 22112121 ffDMffDMfffCDM

2,1,),,;(max:),;(

iRffnfMffDM ii

Nnii

2,1,,

2exp:),;(

2

2

iRf

ffffM

i

iii

0 2 4 6 8 10 12 14

0

0.5

1

1.5

2

2.5

3

f

cost

s

Cost Functions of Fundamental Intervals I1 and I

2

)25.0,12;( fM

)25.0,9;( fM

example

Page 31: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen 31

0 2 4 6 8 10 12 140

1

2

3

4

5

6

7

f

cost

s

Cost Functions

D1

D2D1 D2

0 0.5 1 1.5 2 2.5 3 3.5

0

0.2

0.4

0.6

0.8

1

1.2

1.4

f

cost

s

Cost Functions

D1

D2D1 D2

)25.0,25.0,12,9;( fCDM

)25.0,9;( fDM

)25.0,12;( fDM

Example

Multiples of frequencies in the neighborhood of 3(and 3/n) also end up both near 9 and 12

For frequencies f>3.2, no multiples end up both near 9 and 12 according to the measure

Multiples of 1.1, 1.3 and 1.7 come somewhat close to both 9 and 12 (c.f. other measure)

)25.0,25.0,12,9;( fCDM

Page 32: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen 32

0 2 4 6 8 10 12 140

1

2

3

4

5

6

7

f

cost

s

Cost Functions

D1

D2D1 D2

0 0.5 1 1.5 2 2.5 3 3.5 4 4.5

0

0.2

0.4

0.6

0.8

1

1.2

f

cost

s

Cost Functions

D1

D2D1 D2

)5.0,5.0,12,9;( fCDM

)5.0,9;( fDM

)5.0,12;( fDM

Example

If we increase σ, it becomes more difficult to“avoid” the intervals around 9 and 12 for integer multiples of f

For σ=0.5, some multiples of 4.16 also come close to both 9 and 12 according to the measure

Page 33: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen 33

0 2 4 6 8 10 12 14

0

0.5

1

1.5

2

2.5

3

fco

sts

Cost Functions of Fundamental Intervals I1 and I

2

f1 = 9; f2 = 12σ = 0.5fexp = 4.16

Example

samples taken at integer multiples of 4.16

CDM(4.16;.) equals product of largest “red” sample (n=3) and largest “blue” sample (n=2)

)5.0,12;( fM

)5.0,9;( fM

Page 34: On a Generalization of the GCD for Intervals in R + Stan BaggenJune 4, 2014 or how can a camera see at least 1 tone for unkown T exp

Philips Research Stan Baggen 34