Forums - fastcv rotate image doesn't work

4 posts / 0 new
Last post
fastcv rotate image doesn't work
371152061
Join Date: 13 May 22
Posts: 11
Posted: Tue, 2022-09-27 01:54
//src -> yuv420P, 1920*1088*1.5 
//ySrc-> 1920*1088
//size=128 only for test
//rotate_degree=FASTCV_ROTATE_90;
uint8_t* dst = new uint8_t[1920*1088*3/2];
memset(dst, 0, 1920*1088*3/2);
uint8_t *yDst=dst, *uDst=dst+widthAndHeight,    ......
fcvStatus  status = fcvRotateImageu8 (ySrc, 128, 128, 0, yDst,  128, rotate_degree);
 
 
I set breakpoint after fcvRotateImageu8.  
status=FASTCV_SUCCESS
for 90 degrees, the result should like this:      src[y * width + x]  ==   dst[x* height + height - y - 1]
 
but the output debug is:
(lldb) p ySrc[0]
(const uint8_t) $0 = '\xb4' 180 '\xb4'
(lldb) p ySrc[1]
(const uint8_t) $1 = '\xb6' 182 '\xb6'
(lldb) p ySrc[2]
(const uint8_t) $2 = '\xb7' 183 '\xb7'
(lldb) p yDst[127]
(uint8_t) $3 = '\0' 0 '\0'
(lldb) p yDst[255]
(uint8_t) $4 = '\0' 0 '\0'
(lldb) p yDst[383]
(uint8_t) $5 = '\0' 0 '\0'
 
 
// can I rotate yuv420p like this?
status=fcvRotateImageu8 (ySrc, w, h, 0, yDst,  0, rotate_degree);
status=fcvRotateImageu8(uSrc, w/2, h/2, src_stride, uDst, dst_stride, rotate_degree);
status=fcvRotateImageu8(vSrc, w/2, h/2, src_stride, vDst, dst_stride, rotate_degree);
 
can anyone tell me how to rotate yuv420p for 90 degrees use fastcv? thanks in advance~~~ 
  • Up0
  • Down0
jeff4s Moderator
Join Date: 4 Nov 12
Posts: 106
Posted: Tue, 2022-09-27 09:05

Hi,

The rotation API works on grayscale image. It cannot rotate YUV420p. However, it can rotate Y plane if you set up the parameters correctly.

Cheers,

-Jeff

  • Up0
  • Down0
371152061
Join Date: 13 May 22
Posts: 11
Posted: Mon, 2022-10-10 19:37

dear

  The Y and the function parameters are correct ,why yDst is not what i want?

(lldb) p ySrc[0]
(const uint8_t) $0 = '\xb4' 180 '\xb4'
(lldb) p ySrc[1]
(const uint8_t) $1 = '\xb6' 182 '\xb6'
(lldb) p ySrc[2]
(const uint8_t) $2 = '\xb7' 183 '\xb7'
 
the exptected should:
    (lldb) p yDst[127]
    (uint8_t) $3 =  '\xb4' 180 '\xb4'
    (lldb) p yDst[255]
    (uint8_t) $4 = '\xb6' 182 '\xb6'
    (lldb) p yDst[383]
    (uint8_t) $5 = '\xb7' 183 '\xb7'
  • Up0
  • Down0
xtang
Join Date: 6 Dec 21
Posts: 12
Posted: Tue, 2022-10-18 00:32

1. src_stride must be the same as dst_stride

-- fcvStatus  status = fcvRotateImageu8 (ySrc, 128, 128, 0, yDst, 128, rotate_degree);

   ++ fcvStatus status = fcvRotateImageu8 (ySrc, 128, 128, 128, dstY, 128, rotate_degree);  

 

   2. you can use below api to rotate UV image

   ++ fcvRotateImageInterleavedu8(uvSrc, w, h, src_stride, uvDst, dst_stride, rotate_degree);

 

Thanks!

 

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.