Ressurser. OpenCV documentation: Eigen documentation : C++: Image Watch: An image debugger plug-in for Visual Studio

Like dokumenter
Moving Objects. We need to move our objects in 3D space.

Slope-Intercept Formula

UNIK 4690 Maskinsyn Introduksjon

UNIK 4690 Maskinsyn Introduksjon

Neural Network. Sensors Sorter

Lab 1 Kamerageometri med Eigen

FYSMEK1110 Eksamensverksted 23. Mai :15-18:00 Oppgave 1 (maks. 45 minutt)

Gradient. Masahiro Yamamoto. last update on February 29, 2012 (1) (2) (3) (4) (5)

Second Order ODE's (2P) Young Won Lim 7/1/14

Solutions #12 ( M. y 3 + cos(x) ) dx + ( sin(y) + z 2) dy + xdz = 3π 4. The surface M is parametrized by σ : [0, 1] [0, 2π] R 3 with.

Ma Flerdimensjonal Analyse Øving 1

Dynamic Programming Longest Common Subsequence. Class 27

SVM and Complementary Slackness

stjerneponcho for voksne star poncho for grown ups

Level Set methods. Sandra Allaart-Bruin. Level Set methods p.1/24

INSTALLATION GUIDE FTR Cargo Rack Regular Ford Transit 130" Wheelbase ( Aluminum )

INSTALLATION GUIDE FTR Cargo Rack Regular Ford Transit 130" Wheelbase ( Aluminum )

A Benchmark of Selected Algorithmic. Machine Learning and Computer Vision

Unit Relational Algebra 1 1. Relational Algebra 1. Unit 3.3

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

Information search for the research protocol in IIC/IID

TMA4329 Intro til vitensk. beregn. V2017

REMOVE CONTENTS FROM BOX. VERIFY ALL PARTS ARE PRESENT READ INSTRUCTIONS CAREFULLY BEFORE STARTING INSTALLATION

Grunnleggende Matematiske Operasjoner

Medisinsk statistikk, KLH3004 Dmf, NTNU Styrke- og utvalgsberegning

Graphs similar to strongly regular graphs

STØTTEMATERIALE TIL FORELESNINGENE OM SKATT

SERVICE BULLETINE

Perpetuum (im)mobile

Last ned The baby guest book : for barn som tåler å høre sannheten. Last ned

UNIVERSITETET I OSLO

Oppgave 1a Definer følgende begreper: Nøkkel, supernøkkel og funksjonell avhengighet.

5 E Lesson: Solving Monohybrid Punnett Squares with Coding

NORGES TEKNISK-NATURVITENSKAPELIGE UNIVERSITET Side 1 av 5 INSTITUTT FOR ENERGI- OG PROSESSTEKNIKK

Bildebehandling med Python og EzGraphics

UNIVERSITY OF OSLO DEPARTMENT OF ECONOMICS

Eksamen i TMA4190 Mangfoldigheter Onsdag 4 juni, Tid :

Profile handbook. for

PARABOLSPEIL. Still deg bak krysset

Stjerner og galakser Nybegynner Python PDF

Instruksjons manual Instruction manual

klassisk angoragenser classic angora sweater

Eksamensoppgave i TMA4135 Matematikk 4D

Supplemental Information

KAMPANJE APK : APK-5: Skifte pakninger mellom turbo og CCDPF

1 Øvelse Dynamic Mercy 1 Exercise Dynamic Mercy

Lokalt Koordinatsystem. Grunnleggende Grafikk Våren Transformasjoner, Matriser og Scenegraf

Exercise 1: Phase Splitter DC Operation

KAMPANJE APK : APK-4: Kontroll montering EGT-2

UNIVERSITY OF OSLO. Faculty of Mathematics and Natural Sciences

HANDBOOK OF TEST METHODS FOR VIRTUAL OFFSIDE LINE ASSESSMENT. June 2019

INF2120 Tools at your fingertips

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

Data Sheet for Joysticks

2 Havørna. Bratte turer i nord Bjørnulf Håkenrud - Alta Klatreklubb - Øytun folkehøgskole. Skillefjord

Systematiske skråopptak fra fly

UNIVERSITETET I OSLO ØKONOMISK INSTITUTT

C13 Kokstad. Svar på spørsmål til kvalifikasjonsfasen. Answers to question in the pre-qualification phase For English: See page 4 and forward

Kartlegging av ledningstraséer -Hvor går rørene? Gyro kartleggingsenhet

pnvdb Documentation Release Jan Tore Kyrdalen

Samhandling i prosjekter et forskerblikk på Nødnettprosjektet. Therese Dille, PhD

Geometriske begrepers doble natur. Frode RønningR Voss

Speed Racer Theme. Theme Music: Cartoon: Charles Schultz / Jef Mallett Peanuts / Frazz. September 9, 2011 Physics 131 Prof. E. F.

Eksamensoppgave i TMA4320 Introduksjon til vitenskapelige beregninger

Matematikk Øvingsoppgaver i numerikk leksjon 1. Løsningsforslag

Den europeiske byggenæringen blir digital. hva skjer i Europa? Steen Sunesen Oslo,

UNIVERSITETET I OSLO

OPPA European Social Fund Prague & EU: We invest in your future.

Right Triangle Trigonometry

TDT4102 Prosedyre og Objektorientert programmering Vår 2014

OPPA European Social Fund Prague & EU: We invest in your future.

Appendix B, not for publication, with screenshots for Fairness and family background

UNIVERSITETET I OSLO

Filipstad Brygge 1, 8. etg, Oslo. 14. oktober 2005 kl 12:00

VEIEN TIL ROM: HVORDAN JEG BLE KATOLIKK (NORWEGIAN EDITION)

DATAUTFORSKNING I EG, EG 7.1 OG EGENDEFINERTE FUNKSJONER SAS FANS I STAVANGER 4. MARS 2014, MARIT FISKAAEN

Ma Linær Algebra og Geometri Øving 1

Veiatlas Norge: Veikart = Road Maps = Strassenkarten 1: : Bykart = City Maps = Stadtplane 1: (Norwegian Edition) By Statens kartverk

Nettnøytralitet - regulering på jakt etter markedssvikt. Bjørn Hansen, Telenor Research Nettnøytralitetsforum 27. november 2014

Kurskategori 2: Læring og undervisning i et IKT-miljø. vår

Jeroen Stil Institute for Space Imaging Science. University of Calgary

Physical origin of the Gouy phase shift by Simin Feng, Herbert G. Winful Opt. Lett. 26, (2001)

Skilpadder hele veien ned

6 Steg du kan ta når hodet ditt er fullt eller renner over av tanker! - Få ting gjort! - Hvordan tømme hodet og rydde opp

HOW TO GET TO TØI By subway (T-bane) By tram By bus By car Fra flyplassen

Data Sheet for Joysticks

Solution for INF3480 exam spring 2012

Ma Flerdimensjonal Analyse Øving 11

EGENDEFINERTE FUNKSJONER I SAS OG LITT OM OPEN SOURCE INTEGRASJON SAS FANS I STAVANGER , MARIT FISKAAEN (SAS INSTITUTE)

Simulert tilbakekalling av makrell - produkter kjøpt i Japan

Maple Basics. K. Cooper

Bildebehandling i GIMP

Justeringsanvisninger finnes på de to siste sidene.

UNIVERSITY OF OSLO DEPARTMENT OF ECONOMICS

Data Sheet for Joysticks

Implementeringen av ROP retningslinjen; er GAP analyser et

Software applications developed for the maritime service at the Danish Meteorological Institute

PRIORITETSKØ. Aksjehandel. Datastruktur for aksjehandel. Nøkler og Totalorden-relasjonen

Ma Flerdimensjonal Analyse Øving 2

Transkript:

Lab 2 04.02.2016

Ressurser OpenCV documentation: http://opencv.org/documentation.html Eigen documentation : http://eigen.tuxfamily.org/dox/ Quick reference quide: http://eigen.tuxfamily.org/dox/group QuickRefPage.html C++: http://en.cppreference.com/w/ Image Watch: An image debugger plug-in for Visual Studio Download directly from Visual Studio: Tools Extensions and Updates Online Search for Image Watch 2

Litt om cv::mat 3

Huskeliste Lage prosjekt Konstruere en cv::mat Datatyper, lage «vinduer» MatCommaInitializer Hente og endre piksler at< >() foreach Regne på matriser Operasjoner, MatExpr, 4

Perspektivkameramodellen 5

The perspective camera model C is a standard coordinate system for a camera x C - Right y C - Down z C - Forward Perspective Camera C q Q Point observed by the camera C y C V ξ C V x C z C x V W ξ V W z W x W y W V is a standard coordinate system for a vehicle x V - Forward y V - Right z V - Down z V Vehicle y V World W is a local NED coordinate system (North East Down) 6

The perspective camera model The point Q Position W q = 27.3, 20.9, 11.5 T The vehicle 3m wide, 6m long The origin of V is chosen to be at the center of the vehicle, 1m above the ground Pose relative to the world: x = 6.7m y = 2.4m z = 14.0m rrrr = 3.7 ppppp = 9.3 heeeeee = 307.6 The camera The optical center is 2m in front of and 1m to the left of the vehicles center The optical center is 4m above ground The y-axis of C is perpendicular to the xy-plane of V The optical axis, i.e. the z-axis of C, is rotated 4.7 to the right of the x-axis of V The camera calibration matrix is 1028 0 400 K = 0 1028 300 0 0 1 7

The perspective camera model Problem In which pixel of the image will we observe the point Q? Sub-problems 1. W W Represent ξ V as a SE(3) object T V 2. V V Represent ξ C as a SE(3) object T C 3. W W Represent ξ C as a SE(3) object T C 4. Determine the camera matrix P = K R t 5. Determine the pixel u = u, v that the point Q projects to according to the perspective camera model 8

Sub-problem 1 Represent W W ξ V as a SE(3) object T V Sophus::SE3d objects can be initialized with a Eigen::Matrix3d rotation matrix R and a Eigen::Vector3d translation vector t Roll, pitch, heading relates to the zyx-rotation sequence, so R = R z R y R x A basic rotation matrix like R x θ can be created by Eigen::AngleAxisd(theta * M_PI / 180, Eigen::Vector3d::UnitX()) // Visualization of world and vehicle cv::mat cv_t_w_v, cv_r_w_v; cv::eigen2cv(t_w_v, cv_t_w_v); cv::eigen2cv(r_w_v, cv_r_w_v); cv::affine3d cv_t_w_v(cv_r_w_v, cv_t_w_v); cv::viz::viz3d my_window("window 1"); my_window.showwidget("world-axes", cv::viz::wcoordinatesystem(3.0)); my_window.showwidget("vehicle-axes", cv::viz::wcoordinatesystem(3.0), cv_t_w_v); my_window.showwidget("vehicle", cv::viz::wcube(cv::vec3d(-3.0, -1.5, -1), cv::vec3d(3.0, 1.5, 1.0)), cv_t_w_v); my_window.spin(); 9

Sub-problem 2 and 3 V V Represent ξ C as a SE(3) object T C Which basic rotations must V undergo in order to coincide with C? Two basic rotations is enough Represent W W ξ C as a SE(3) object T C Recall that W W T C = T V V T C // Visualization of camera frustum cv::mat cv_t_w_c, cv_r_w_c, cv_k; cv::eigen2cv(k, cv_k); cv::eigen2cv(t_w_c.translation(), cv_t_w_c); cv::eigen2cv(t_w_c.rotationmatrix(), cv_r_w_c); cv::affine3d cv_t_w_c(cv_r_w_c, cv_t_w_c); my_window.showwidget("camera_frustum", cv::viz::wcameraposition(cv_k, 1.0, cv::viz::color::red()), cv_t_w_c); 10

Sub-problem 4 and 5 Determine the camera matrix P = K R t C C Recall that in the perspective camera model R = R W and t = t W, so we can not read R and W t directly from T C Determine the pixel u = model Recall that u = PX u, v that the point Q projects to according to the perspective camera // Visualization of point (as a small sphere) my_window.showwidget("q", cv::viz::wsphere({ Q_W(0), Q_W(1), Q_W(2) }, 0.1)); 11

Laplace blending 12

Steg 1: Lag nytt prosjekt og vis frem bilder Kopier «opencv_project_template» og gi nytt navn Husk å endre «PROJECT_NAME» i CMakeLists.txt Lag nytt prosjekt med Cmake Skriv et program som leser to bilder img_1: free_cat.jpg img_2: free_tiger.jpg Bildene bør konverteres til flyttallsbilder: cv::imread( ).convertto(img_1, CV_32F, 1.0/255.0); Vis bildene frem cv::namedwindow() cv::imshow() 13

Steg 2: Enkel blanding av bilder Samregistrer bildene ved å angi tre punktkorrespondanser cv::point2f pts_1[] = {{321, 200}, {647, 200}, {476, 509}}; cv::point2f pts_2[] = {{441, 726}, {780, 711}, {615, 1142}}; cv::mat trans_mat = cv::getaffinetransform(pts_2, pts_1); cv::warpaffine(img_2, img_2, trans_mat, img_1.size()); Lag maske med rampe cv::mat mask = cv::mat::zeros(img_1.size(), CV_32FC1); cv::rectangle(mask, cv::rect{img_1.cols/2, 0, img_1.cols/2 + 1, img_1.rows}, 1, CV_FILLED); cv::blur(mask, mask, cv::size{3, 3}); 14

Steg 2: Enkel blanding av bilder Lag funksjon som gjør enkel blanding av to bilder vektet med masken cv::mat linear_blend(cv::mat& img_1, cv::mat& img_2, cv::mat& mask) Tips: cv::blendlinear() Bruk funksjonen og vis frem resultatet Prøv med forskjellige masker Andre sømmer, sirkler, større glattefilter 15

Steg 3: Laplaceblanding Lag funksjonen std::vector<cv::mat> construct_gaussian_pyramid(cv::mat& img) cv::pyrdown() 16

Steg 3: Laplaceblanding Lag funksjonen std::vector<cv::mat> construct_laplacian_pyramid(cv::mat& img) Bruk construct_gaussian_pyramid cv::pyrup() 17

Steg 3: Laplaceblanding Lag funksjonen cv::mat collapse_pyramid(std::vector<cv::mat>& pyr) cv::pyrup() 18

Steg 3: Laplaceblanding Lag funksjonen cv::mat laplace_blending(cv::mat& img_1, cv::mat& img_2, cv::mat& mask) For eksempel slik: std::vector<cv::mat> mask_pyr = construct_gaussian_pyramid(mask); std::vector<cv::mat> img_1_pyr = construct_laplacian_pyramid(img_1); std::vector<cv::mat> img_2_pyr = construct_laplacian_pyramid(img_2); std::vector<cv::mat> blend_pyr(img_1_pyr.size()); for (int i = 0; i < img_1_pyr.size(); i++) { // TODO: Perform linear blend on each level. } return collapse_pyramid(blend_pyr); 19

Steg 3: Laplaceblanding Bruk laplace_blending(img_1, img_2, mask) Vis frem resultat Sammenlign med enkel blending 20

Steg 4: Moroplukk Prøv andre bilder Ta bilder med kameraet Finn bilder på nett Angi nye punkter for samregistrering Andre masker Last ned GIMP for å tegne finere masker 21

Steg 5: Dypdykk Implementer pyramiden selv Ikke bruk cv::pyrdown() eller cv::pyrup() Ta en titt på cv::seamlessclone() Prøv å implementere warpingen selv 22