I am attempting to use imrotate to rotate an array by a given amount of degrees, but the output is all zeros.
I = rgb2ycbcr(RGB);
I = imrotate(I, angle, 'crop');
Where RGB is nx3 uint8 RGB variable from an .avi file from Vevo Software.

댓글 수: 4

Walter Roberson
Walter Roberson 2019년 2월 20일
Could you confirm that RBG is 2 dimensional, not 3 dimensional ? If it is 2 dimensional, is it intended to be grayscale, or are you reading in a pseudocolor image and failing to apply the colormap to it?
Note: be careful, as color arrays are usually RGB rather than RBG.
Jamie Bossenbroek
Jamie Bossenbroek 2019년 2월 20일
RGB is a three dimensional color image:
Screen Shot 2019-02-20 at 4.14.00 PM.png
Walter Roberson
Walter Roberson 2019년 2월 20일
Is it possible that your original RGB is 1 x 468 x 3 ??
Jamie Bossenbroek
Jamie Bossenbroek 2019년 2월 20일
Yes it is

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

답변 (1개)

Walter Roberson
Walter Roberson 2019년 2월 20일

0 개 추천

This seems to be an issue with imrotate when passed an array in which either the first or second dimension is 1, and the angle is not an exact multiple of 90. Even an angle of eps gives a 0 result.
WIth your array being only a single row high, and with you asking to 'crop', it is not obvious what output you are hoping for?
The workaround is to invoke
iptprefs
and to turn off "Enable hardware optimization (recommended)" near the bottom, and then Apply and OK. Then
clear images.internal.useIPPLibrary
After that, rotation will not unnecessarily produce an all-zero output.

댓글 수: 1

Walter Roberson
Walter Roberson 2019년 2월 20일
I just filed a bug report on this.
It would not surprise me if the resolution would just be better documentation of the boundary condition failures and a pointer to turning off hardware processing. But perhaps they will be willing to check the output size and fall back to the software rotation for this case.

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

카테고리

도움말 센터File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

태그

질문:

2019년 2월 20일

댓글:

2019년 2월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by