designing and targeting video processing subsystems for … · designing and targeting video...

20
1

Upload: others

Post on 12-Jun-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Designing and Targeting Video Processing Subsystems for … · Designing and Targeting Video Processing ... • Corner detection is frequently used in motion detection, image registration,

1

Page 2: Designing and Targeting Video Processing Subsystems for … · Designing and Targeting Video Processing ... • Corner detection is frequently used in motion detection, image registration,

2© 2017 The MathWorks, Inc.

Designing and Targeting Video Processing

Subsystems for Hardware

정승혁과장

Senior Application Engineer

MathWorks Korea

Page 3: Designing and Targeting Video Processing Subsystems for … · Designing and Targeting Video Processing ... • Corner detection is frequently used in motion detection, image registration,

3

Process : From Algorithm to Hardware

Collaboration

Concept

Algorithm

Micro-architecture

Implementation

1. Concept & Algorithm

• Develop system-level algorithms

• Simulate, analyze, modify

• Partition hardware vs software implementation

Fra

me-b

ased

Pix

el-str

eam

2. Algorithm to Micro-architecture

• Convert to pixel-streaming algorithms

• Add hardware micro-architecture

• Convert data types to fixed-point

3. Micro-architecture to implementation

• Speed and area optimization

• HDL code generation

• Verification

• FPGA/ASIC implementation

Image/V

ideo

Engin

eer

Hard

ware

Engin

eer

Page 4: Designing and Targeting Video Processing Subsystems for … · Designing and Targeting Video Processing ... • Corner detection is frequently used in motion detection, image registration,

4

Developing the System-Level Algorithm

<Concept & Algorithm>

• Develop system-level algorithms

• Simulate, analyze, modify

• Partition hardware vs software implementation

Computer Vision System

ToolboxTM

• Feature detection, extraction

• Feature-based registration

• Object detection and tracking

• Stereo vision

• Video processing

Image Processing ToolboxTM

• Image display and exploration

• Image enhancement

• Morphological operations

• Image registration

• Geometric transformation

• ROI-based processing

Concept

Algorithm

Micro-architecture

Implementation

Fra

me-b

ased

Pix

el-str

eam

Image/V

ideo

Engin

eer

Hard

ware

Engin

eer

Page 5: Designing and Targeting Video Processing Subsystems for … · Designing and Targeting Video Processing ... • Corner detection is frequently used in motion detection, image registration,

5

From Frames to Pixels to Hardware

Collaboration

<Algorithm to Micro-architecture>

• Convert to pixel-streaming algorithms

• Add hardware micro-architecture

• Convert data types to fixed-point

Concept

Algorithm

Micro-architecture

Implementation

Fra

me-b

ased

Pix

el-str

eam

Image/V

ideo

Engin

eer

Hard

ware

Engin

eer

Vision HDL ToolboxTM

• Simulate hardware micro-architecture of algorithms

• Streaming pixel-based functions and blocks

• Convert between frames and pixels

• Standard and custom frame sizes

• Built-in line buffer management

Page 6: Designing and Targeting Video Processing Subsystems for … · Designing and Targeting Video Processing ... • Corner detection is frequently used in motion detection, image registration,

6

Image Processing Algorithms: Frame-Based vs Streaming-Pixel

Streaming-Pixel

• Across rows, row-by-row

• Region of interest (ROI) stored

in a multi-line buffer

Frame-Based

• Whole frame at a time

• Random access to any pixel

via MATLAB/Simulink [X,Y]

coordinate

(0,0)Frame Width

Fra

me

He

igh

t

ColumnsR

ow

s

(0,0)

Vision HDL ToolboxTM

• Simulate hardware micro-architecture of algorithms

• Streaming pixel-based functions and blocks

• Convert between frames and pixels

• Standard and custom frame sizes

• Built-in line buffer management

011100101

Page 7: Designing and Targeting Video Processing Subsystems for … · Designing and Targeting Video Processing ... • Corner detection is frequently used in motion detection, image registration,

7

From Model to HDL CodeAutomatically generate synthesizable HDL from system-level design

HDL

Coder

DESIGN

MATLAB Simulink Stateflow

Synthesizable

VHDL / Verilog ASIC/FPGA

Concept

Algorithm

Micro-architecture

Implementation

Fra

me-b

ased

Pix

el-str

eam

Micro-architecture to implementation

• Speed and area optimization

• HDL code generation

• Verification

• FPGA/ASIC implementation

Image/V

ideo

Engin

eer

Hard

ware

Engin

eer

Page 8: Designing and Targeting Video Processing Subsystems for … · Designing and Targeting Video Processing ... • Corner detection is frequently used in motion detection, image registration,

8

Corner Detection Algorithm

Method Merit

Harris corner detection

(by Harris & Stephens)Accurate results

Minimum eigenvalue

(by Shi & Tomasi)Fastest computation

Local intensity comparison

(Features from Accelerated Segment Test,

FAST by Rosten & Drummond)

Trade-off between accuracy and computation

• A corner can be defined as the intersection of two edges

• An approach used within computer vision systems to extract

certain kinds of features and infer the contents of an image

• Corner detection is frequently used in motion detection, image

registration, video tracking, image mosaicing, panorama stitching,

3D modelling and object recognition

Page 9: Designing and Targeting Video Processing Subsystems for … · Designing and Targeting Video Processing ... • Corner detection is frequently used in motion detection, image registration,

9

Demo : CornerDetectionHDLExample

Page 10: Designing and Targeting Video Processing Subsystems for … · Designing and Targeting Video Processing ... • Corner detection is frequently used in motion detection, image registration,

10

From frame-based to streaming-pixel

FRAME PIXEL

FRAME FRAME

Generates pixel

control bus

Converts

dimensions and

sample rate

Page 11: Designing and Targeting Video Processing Subsystems for … · Designing and Targeting Video Processing ... • Corner detection is frequently used in motion detection, image registration,

11

Useful blocks for streaming-pixel conversion

Frame to Pixel, Pixel to Frame

Page 12: Designing and Targeting Video Processing Subsystems for … · Designing and Targeting Video Processing ... • Corner detection is frequently used in motion detection, image registration,

12

Managing the Pixel Stream from Active Video Sources

Vertical and Horizontal Blanking Intervals

Algorithm needs to handle sync signals

0 30 60 90 0 0 0… 120 …0

hStarthEndvStart

vEndvalid

1 clk = 1 sample

clk

dataOuthStarthEndvStart

vEndvalid

6

4

Page 13: Designing and Targeting Video Processing Subsystems for … · Designing and Targeting Video Processing ... • Corner detection is frequently used in motion detection, image registration,

13

Probing Signal Values using Logic Analyzer

Simply inspect and compare signal data in model (DSP System Toolbox™ is Required)

Page 14: Designing and Targeting Video Processing Subsystems for … · Designing and Targeting Video Processing ... • Corner detection is frequently used in motion detection, image registration,

14

HDL Code Generation for Hardware

Page 15: Designing and Targeting Video Processing Subsystems for … · Designing and Targeting Video Processing ... • Corner detection is frequently used in motion detection, image registration,

15

Deployment on Hardware

Merge generated HDL code to User code

Use Hardware Support Package for rapid prototyping

Video

Stream

In

Video

Stream

Out

Generate model

for HDL

Generate

Code

Prototyping

IP Core

Generation

FPGA

Turn-key

FPGA

In-the-loop

Algorithm Model

(Frame-based)

HDL-Targeted

Model(Pixel-based)

HDL Code

(VHDL, Verilog)

Prototyping with HSP

(Hardware Support Pkg)

Custom hardware

VHDL,

Verilog

COTS hardware

Page 16: Designing and Targeting Video Processing Subsystems for … · Designing and Targeting Video Processing ... • Corner detection is frequently used in motion detection, image registration,

16

Install Hardware Support Package (HSP)

Page 17: Designing and Targeting Video Processing Subsystems for … · Designing and Targeting Video Processing ... • Corner detection is frequently used in motion detection, image registration,

17

Summary : Workflow from Algorithm to Hardware

HDL

Generate model

for HDL

Generate

Code

Prototyping

Algorithm Model

(Frame-based)

HDL-Targeted

Model(Pixel-based)

HDL Code

(VHDL, Verilog)

Prototyping with HSP

(Hardware Support Pkg)

Target Hardware

Fast Prototyping

Page 18: Designing and Targeting Video Processing Subsystems for … · Designing and Targeting Video Processing ... • Corner detection is frequently used in motion detection, image registration,

18

Lane Detection System Demo

Video Source(HDMI-In)

EtherNET

Processed Video(HDMI-Out)

Display

Hardware TargetVideo Source

Simulink

Page 19: Designing and Targeting Video Processing Subsystems for … · Designing and Targeting Video Processing ... • Corner detection is frequently used in motion detection, image registration,

19

Lane Detection System in ActionComputer Vision System Toolbox™ Support Package for Xilinx® Zynq® -Based Hardware

Page 20: Designing and Targeting Video Processing Subsystems for … · Designing and Targeting Video Processing ... • Corner detection is frequently used in motion detection, image registration,

20

Collaboration

Workflow From Frames to Pixels to Hardware

New application innovation happens at the

system-level

– Implemented across software and hardware

Successful implementation requires

collaboration

Connected workflow to FPGA/ASIC

hardware delivers:

– Broader micro-architecture exploration

– Agility to make changes, simulate, generate code

– Continuous verification

Concept

Algorithm

Micro-architecture

Implementation

Fra

me-b

ased

Pix

el-str

eam

Image/V

ideo

Engin

eer

Hard

ware

Engin

eer

Vision HDL Toolbox

HDL Coder

Vision Zynq HSP

MATLAB & Simulink

Image Processing

Toolbox

Computer Vision

System Toolbox