Why are the output dimensions of the 'From Video File' block different to the output dimensions of the 'V4L2 Video Capture' block?

조회 수: 1 (최근 30일)
If a video file is loaded with the 'From Video File' block it outputs an [height x width] or [rows x columns] array. The 'V4L2 Video Capture' block from the Simulink Support Package for Raspberry Pi outputs an [width x height] or [columns x rows] array. So if the aspect ratio is 320x240, the first-mentioned block outputs [240x320] and the second-mentioned outputs [320x240].
Is there a possibility to alter the dimensions for indexing without rotating the aspect ratio (like using the 'Permute Dimensions' block)? I want to reuse the model which I developed for the 'From Video File' block.
Thank you in advance for your answers!
  댓글 수: 1
Elias
Elias 2018년 4월 11일
I found out that a snapshot taken with the cameraboard over the command window results in a picture with the expected size (e. g. [240x320]). Strange is what happens when the Simulink data from the V4L2 block is written to the workspace with the 'To Workspace' block and pictured with imshow(). There you can see that the data indeed is an [320x240] array and therefore upright. But the video is displayed correctly by the 'SDL Video Display' block from the Simulink Support Package for Raspberry Pi.

댓글을 달려면 로그인하십시오.

채택된 답변

Elias
Elias 2018년 4월 13일
It seems that the only way to convert the camera input signal for intuitively [row x column] indexing and processing is to flip every color layer (RGB) by rows, concatenate and rotate them by an angle of pi/2. If you want to display the result with the 'V4L2 Video Capture' block you have to rotate it back by -pi/2 and flip again by rows (after splitting the color layers).
I hope this helps someone with the same problem.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Computer Vision with Simulink에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by