Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
Posts: 21
Registered: ‎10-03-2013
My Device: Z10
My Carrier: Telus

Camera Picture Orientation

Hi, my app uses the Camera object. My app only supports Portrait orientation on the Bar Descriptor.

 

The problem is, whenever I snap it and place it in ImageView, the orientation picture are saved in a different orientation.

 

I tested this on 2 Z10s one produce a normal result (portrait) and another one is rotated sideways.

 

Any thoughts??

Developer
Posts: 826
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: Camera Picture Orientation

[ Edited ]

are u using os 10.2?  I've noticed images being saved with the opposite rotation in my apps....

 

however if you use camera_set_device_orientation you can set the orientation so there shouldn't be any discrepancies.  it does require making a c++ call everytime the rotation changes but is worth stability

Contributor
Posts: 21
Registered: ‎10-03-2013
My Device: Z10
My Carrier: Telus

Re: Camera Picture Orientation

Both devices running 10.2, I does not have the problem..

Camera_set_device_orientation means that I can't use the Cascades camera class? Instead I have to use ForeignWindow?
Contributor
Posts: 21
Registered: ‎10-03-2013
My Device: Z10
My Carrier: Telus

Re: Camera Picture Orientation

I meant One does not have the problem
Developer
Posts: 826
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: Camera Picture Orientation

[ Edited ]

no you can use cascades camera, you just do a c++ call with your context property to a function when the orientation changes like this

 

*untested demo example*

 

assuming you have a context property named cpp

root container main.qml

attahcedObjects: [
   OrientationHandler: {
     onDisplayDirectionChanged: {
         cpp.setCamOrientation(displayDirection)
      }

  }
]

 then in c++

 

void ApplicationUI::setCamOrientation(const int &displayDirection)(
   //connect to your camera (it's already initiated from c++ origionally)
   //set orientation based on displayOrientation
)

 *you'll need a bit in the header & there is also better ways to incorporate this just a brief overview of how it works

 https://developer.blackberry.com/native/documentation/cascades/dev/signals_slots/

 

Contributor
Posts: 21
Registered: ‎10-03-2013
My Device: Z10
My Carrier: Telus

Re: Camera Picture Orientation

Thanks for the explanation slashkyle.

But I'm a bit confused. Camera_set_device_orientation () would need a camera handle.

How do I pass in the camera handle if I am using the Cascades camera?

Thankss
Developer
Posts: 826
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: Camera Picture Orientation

[ Edited ]

i belive even though you're using the cascades camera, a handle can be created from it since it's initiated from c++.  don't have anything off hand but will look into it and let you know what i figure out

 

*Update

 

It appears that that solution is only going to work using the C api, as i don't think they can be integrated and if so not simply.

 

I went over the cascades camera documentation again and didn't notice any way to adjust the picture orientation but I did file a ticket on this a while back and it's still under investigation.

 

https://www.blackberry.com/jira/browse/BBTEN-1685

Contributor
Posts: 21
Registered: ‎10-03-2013
My Device: Z10
My Carrier: Telus

Re: Camera Picture Orientation

Hi
The docs says that it would have no effect on saved image rotatio
camera_set_device_orientation()
"This function has no effect on the output image rotations. It is simply used to inform the camera hardware that the orientation of the scene has changed in order to optimize internal algorithms, such as metering and face detection."
Contributor
Posts: 30
Registered: ‎12-14-2010
My Device: Not Specified

Re: Camera Picture Orientation

The only workaround is to use libexif and read the exif orientation tag of the image.
Developer
Posts: 826
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: Camera Picture Orientation

that works for the preview image, however the actual images themselves are being saved with the wrong orientation