Region of interest in simulink

2 ビュー (過去 30 日間)
Beenish Mazhar
Beenish Mazhar 2012 年 8 月 30 日
Hi everyone! I am working on extracting road lanes from a video in simulink. Can anyone guide me how can I define my ROI in each and every frame as the location of lanes will vary in every frame.

採用された回答

Mariano Lizarraga
Mariano Lizarraga 2012 年 8 月 30 日
編集済み: Mariano Lizarraga 2012 年 8 月 30 日
Assuming you already know where your ROI is, you could write an embedded MATLAB function to extract the ROI as such:
function roi = variableRoi(top, left, image)
%#codegen
width = 4;
height = 4;
roi = image(top:top+height, left:left+width);
The only limitation would be that the output should always be the same dimension to make the block that uses your ROI a bit easier to implement. Here is a screenshot of how I tested the above embedded MATLAB: http://skit.ch/nwed
%
  2 件のコメント
Beenish Mazhar
Beenish Mazhar 2012 年 9 月 3 日
編集済み: Beenish Mazhar 2012 年 9 月 3 日
Can you kindly explain the purpose of the blocks which you have used in your model in the start (like counter limited,constant,constant1);why they are used.Can you be more explicit.
Mariano Lizarraga
Mariano Lizarraga 2012 年 9 月 3 日
Sure, sorry about that. The counter is just increasing from 0 to 5 (and I add 1 to start at 1 and end at 6) and this is just to synthetically generate some moving coordinates for the ROI. Thus the top left corner of the ROI starts at (1,1) then in the next sample is at (2,2), then at (3,3) and so on. The ROI has the height and width as defined in the embedded MATLAB function. The constant contains a random matrix as a synthetic image.
Hope this helps.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeComputer Vision with Simulink についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by