none
Face tracking in Portrait mode

    Question

  • Hello, 

    I have been trying to work with microsoft faceSDK , however, the photocamera.getPreviewBufferY() always returns the live viewfinder preview in Landscape mode and hence face tracking doesnt work when the phone is help upright. I was wondering if there is anyway of either changing the orientation of photocamera live viewfinder to ensure that getPreviewBufferY() returns portrait image

    or

    change the orientation of Microsoft.FaceSdk.Image.ImageGray() object which holds the preview buffer before using it for tracking.

    Thanks in advance

    Deepak

    Sunday, May 26, 2013 8:07 AM

Answers

  • Hi Deepak,

    I tested the rotation function like follows --

    var image = ImageReader.LoadImage("d:\\001_bench.jpg");
    
    var rotate90 = CropScale.RotateImage(image, (PointF)(image.Region.Center) / 2.0f, (float)(90.0f * Math.PI / 180.0f));
    var rotate180 = CropScale.RotateImage(image, (PointF)(image.Region.Center) / 2.0f, (float)(180.0f * Math.PI / 180.0f));
    var rotate270 = CropScale.RotateImage(image, (PointF)(image.Region.Center) / 2.0f, (float)(270.0f * Math.PI / 180.0f));
    var rotate360 = CropScale.RotateImage(image, (PointF)(image.Region.Center) / 2.0f, (float)(360.0f * Math.PI / 180.0f));
    
    rotate90.Save("d:\\rotate90.jpg");
    rotate180.Save("d:\\rotate180.jpg");
    rotate270.Save("d:\\rotate270.jpg");
    rotate360.Save("d:\\rotate360.jpg");
    22/7 x pi / 2 is close to 3/2 * pi, but not that accurate. I guess this is the issue.
    Sunday, June 09, 2013 12:13 PM
    Owner

All replies

  • Hi Deepak,

    I haven't investigate the solution to change orientation of photocamera live viewfinder. But you can rotate the grayscale image by calling Microsoft.FaceSdk.Image.CropScale.RotateImage function.

    Thanks.

    Monday, June 03, 2013 1:23 AM
    Owner
  • Thanks ningx, 

    I tried the RotateImage function , but it seems to be taking too long to execute and hence inducing a long delay.

    Further, Before rotating the image, the width and height was 640w X 480 h. 

    I am calling the rotateImage with the rotation center PointF coordinates (320,240) and rotating it by (22/7 x pi/2) radians (90 degrees). The resulting image has completely different dimensions. Could you tell me why this is so?

    Thursday, June 06, 2013 12:18 PM
  • Hi Deepak,

    I tested the rotation function like follows --

    var image = ImageReader.LoadImage("d:\\001_bench.jpg");
    
    var rotate90 = CropScale.RotateImage(image, (PointF)(image.Region.Center) / 2.0f, (float)(90.0f * Math.PI / 180.0f));
    var rotate180 = CropScale.RotateImage(image, (PointF)(image.Region.Center) / 2.0f, (float)(180.0f * Math.PI / 180.0f));
    var rotate270 = CropScale.RotateImage(image, (PointF)(image.Region.Center) / 2.0f, (float)(270.0f * Math.PI / 180.0f));
    var rotate360 = CropScale.RotateImage(image, (PointF)(image.Region.Center) / 2.0f, (float)(360.0f * Math.PI / 180.0f));
    
    rotate90.Save("d:\\rotate90.jpg");
    rotate180.Save("d:\\rotate180.jpg");
    rotate270.Save("d:\\rotate270.jpg");
    rotate360.Save("d:\\rotate360.jpg");
    22/7 x pi / 2 is close to 3/2 * pi, but not that accurate. I guess this is the issue.
    Sunday, June 09, 2013 12:13 PM
    Owner