联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Java编程Java编程

日期:2024-04-17 09:42

Homework 7

Computer Vision, Spring 2024

Due Date: April 26, 2024

Total Points: 20

Thishomeworkcontainstwoprogrammingchallenges.Allsubmissionsaredueat

midnightonApril26,2024,andshouldbesubmittedaccordingtotheinstructions

inthedocument“GuidelinesforProgrammingAssignments.pdf”.

runHw7.py willbeyourmaininterfaceforexecutingandtestingyourcode.

Parametersforthedifferentprogramsorunittestscanalsobesetinthatfile.

Beforesubmission,makesureyoucanrunallyourprogramswiththecommand

python runHw7.py withnoerrors.

Thenumpy package isoptimizedforoperationsinvolvingmatricesand

vectors.Avoidusingloops(e.g.,for,while)wheneverpossible—loopingcan

resultinlongrunningcode.Instead,youshould“vectorize”loopstooptimize

yourcodeforperformance.Inmanycases,vectorizationalsoresultsinmore

compactcode(fewerlinestowrite!).

Challenge1: Inthischallengeyouareaskedtodevelopanopticalflowsystem.You

aregivenasequenceof6images(flow1.png– flow6.png)ofadynamicscene.Your

taskistodevelopanalgorithmthatcomputersopticalflowestimatesateachimage

pointusingthe5pairs(1&2,2&3,3&4,4&5,5&6)ofconsecutiveimages.

Opticalflowestimatescanbecomputedusingtheopticalflowconstraintequation

andLucas-Kanadesolutionpresentedinclass.Forsmoothmotions,thisalgorithm

shouldproducerobustflowestimates.However,giventhatthesiximageswere

takenwithfairlylargetimeintervalsinbetweenconsecutiveimages,thebrightness

andtemporalderivativesusedbythealgorithmareexpectedtobeunreliable.

Therefore,youareadvisedtoimplementadifferent(andsimpler)opticalflow

algorithm.Giventwoconsecutiveimages(say1and2),establishcorrespondences

betweenpointsinthetwoimagesusingtemplatematching.Foreachimagepointin

thefirstimage,takeasmallwindow(say7x7)aroundthepointanduseitasthe

templatetofindthesamepointinthesecondimage.Whilesearchingforthe

correspondingpointinthesecondimage,youcanconfinethesearchtoasmall

windowaroundthepixelinthesecondimagethathasthesamecoordinatesasthe

2

oneinthefirstimage.Thecenterofthe7x7imagewindowinthesecondimagethat

ismaximallycorrelatedwiththe7x7windowinthefirstimageisassumedtobethe

correspondingpoint.Thevectorbetweentwocorrespondingpointsistheoptical

flow(u,v).

WriteaprogramcomputeFlow thatcomputesopticalflowbetweentwogray-level

images,andproducestheopticalflowvectorfieldasa“needlemap”ofagiven

resolution,overlaidonthefirstofthetwoimages.

result = computeFlow(img1, img2, win_radius, template_radius,

grid_MN)

Youneedtochooseavalueforthegridspacingthatgivesgoodresultswithout

takingexcessivelylongtocompute.(6 points)

Fordebuggingpurposesusethetestcaseindebug1a.Inthissyntheticcase,theflow

fieldconsistsofhorizontalvectorsofthesamemagnitude(translationalmotion

paralleltotheimageplane).Notethatintherealcase,foreshorteningeffects,

occlusions,andreflectancevariations(aswellasnoise)complicatetheresult.

(2point)

Challenge2: Yourtaskistodevelopavisionsystemthattracksthelocationofan

objectacrossvideoframes.Objecttrackingisachallengingproblemsincean

object’sappearance,poseandscaletendtochangeastimeprogresses.Inclasswe

havediscussedthreepopulartrackingmethods:template-based tracking,

histogram-based trackinganddetection-based tracking.Inthischallenge,wewill

assumethecolordistributionofanobjectstaysrelativelyconstantovertime.

Therefore,wewilltrackanobjectusingitscolorhistogram.

Acolorhistogramdescribesthecolordistributionofacolorimage.Thecolor

histogramthatyouwillneedtocomputeisdefinedasfollows.Eachbinofthecolor

histogramrepresentsarangeofcolors,andthenumberofvotesineachbin

indicatesthenumberofpixelsthathavethecolorswithinthecorrespondingcolor

range.

Becareful,intheinitializationofyourprogram,youshouldgenerateacolormap

fromtheregion ofinterest (ROI),andcomputeallsubsequentcolorhistograms

basedonthesame colormap.Itisonlymeaningfultocomparetwohistograms

computedbasedonthesamecolormap. UsetheprovidedfunctionchooseTarget

todragarectangle aroundatrackingtarget.

3

WriteaprogramnamedtrackingTester thatestimatesthelocationofanobjectin

videoframes.

trackingTester(data_params, tracking_params)

trackingTester shoulddrawaboxaroundthetargetineachvideoframe,and

savealltheannotatedvideoframesasPNGsintoasubfoldergivenin

data_params.out_dir.

Aftergeneratingtheannotatedvideoframes,usetheprovidedfunction

generateVideo tocreateavideofilecontainingalltheframes.

(12points)

Includeallthecodeyouhavewritten,aswellastheresultingvideofiles,but

DONOTincludethethreetrackingdatasetsandtheindividualoutputframes

inyoursubmission.


相关文章

版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp