stitching presentation

27
Real-time Image Stitching with OpenCV Advisor: Ching-Hwa Cheng Feng Chia University 1 Priscilla Cheng Nicholas Eu

Upload: nicholas-eu

Post on 16-Apr-2017

155 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: stitching presentation

1

Real-time Image Stitching with OpenCV

Advisor: Ching-Hwa ChengFeng Chia University

Priscilla ChengNicholas Eu

Page 2: stitching presentation

2

What is Image Stitching?

Panorama, Google Maps Streetview Minimally Invasive Surgery (MIS)

Image stitching provides one cohesive, enlarged view of surgical area

Page 3: stitching presentation

3

Our Task

Difficulties Existing research minimal Real time video, not still images

Use OpenCV library with C++ Develop and improve video stitching

application Stitch up to 4 cameras Improve stitching stability/speed

Page 4: stitching presentation

4

Stitching ProcessFeature Detection and Extraction

Feature Matching

Find Homography Matrix

Perspective Transformation

Output

Page 5: stitching presentation

5

Stitching Algorithm

Page 6: stitching presentation

6

Frame-by-frame Video Stitching Real-time video made of many

frames Stitching process repeated on each

frame Loop: extract frame stitch images

output

Left Frame Right Frame

Page 7: stitching presentation

7

Stitching Process1. Feature detection and extraction

• Use a feature detector to find feature points in overlapping regions

https://courses.cs.washington.edu/courses/cse455/09wi/Lects/lect6.pdf

Page 8: stitching presentation

8

Stitching Process

SURF Detector Algorithm

1. Feature detection and extraction

Box Filters2nd derivative of the Gaussian

Page 9: stitching presentation

9

Stitching Process2. Feature Matching

• BruteForceMatcher• Green – Good match• Red – Bad match

if distance between matches < threshold,push match pair into vector(save match pair)

Page 10: stitching presentation

10

findHomography function in OpenCV

Two images related by homography if on same plane, but different perspectives.

Describes mapping between two images with matching points using 3x3 matrix

Stitching Process3. Find Homography MatrixStitching Process

http://ieeexplore.ieee.org/ieee_pilot/articles/08tro05/tro-scaramuzza-2004490

Page 11: stitching presentation

11

Warpperspective function in OpenCV

Use the Homography matrix to combine multiple perspectives into one perspective

Stitching Process4. Perspective TransformationStitching Process

http://cebe.cf.ac.uk/learning/habitat/HABITAT1/QTVR.html

Page 12: stitching presentation

12

Stitching Process5. OutputStitching Process

+

Page 13: stitching presentation

13

Demo: 2 Videocameras

Page 14: stitching presentation

14

How can we improve?

1. Stitch up to 4 videos simultaneously Adding a camera = more processing

time = program slows down!2. Speed up program

Improve feature detection speed Reduce lag due to additional cameras

Page 15: stitching presentation

15

Stitching 3 Videos Take the output of first two stitched

frames Apply the stitching process to this

image and the 3rd frame1 2

3

Page 16: stitching presentation

16

Stitching 4 VideosProcess1. Stitch 1st and 2nd frames2. Stitch 3rd and 4th frames3. Stitch results from above steps together

12

34

Page 17: stitching presentation

17

4 Videocameras: Output

1 2

3 4

Page 18: stitching presentation

18

4 Videocameras: Output

1 2

3 4

Page 19: stitching presentation

19

Pipeline Parallelism with OpenMP

Parallel as opposed to sequential execution Utilize two threads on the CPU Thread 1 and Thread 2 execute

simultaneously Analogy: assembly line Resolve issues with speed

Before pipelining: ~1.2 seconds per frame

Page 20: stitching presentation

Pipeline ParallelismThread 1 Thread 2

Page 21: stitching presentation

21

Speed-up using OpenCL Feature detection and extraction

take up 70-80% of the total time Utilizes GPU, multiple coresSURF_OCL: OpenCL implementation

of SURF detector and extractor Improves speed and stability

nvidia.com

ctimes.com.tw

Page 22: stitching presentation

22

Other Improvements For fixed camera angles Limit feature detection to just half

the frame Essentially, don’t try to find matches

outside specified region

Page 23: stitching presentation

23

Locking Homography Calculations

Lock = fixed Homography matrix values

Unlock = recalculate values every frame

Page 24: stitching presentation

24

Accomplishments

Reduce each frame’s average processing time to ~0.6 seconds

About 2x speedup after parallelizing Avoid exponential time increase

Processing Time

Number of

Cameras

Before ParallelismAfter Parallelism

Page 25: stitching presentation

25

Demo: 4 Videocameras

Page 26: stitching presentation

26

Future Work

Improve accuracy Seam removal Optimize algorithm of feature

detection functions Test on endoscopic cameras at very

close range

Page 27: stitching presentation

27

Thank you for listening!