×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Mar 2008
    Posts
    151

    Viewfinder images orientation problem: landscape / portrait inconsistencies

    I'm using camera.start_finder to capture some images from my N73's viewfinder in real time.

    When I hold the phone upright, the images captured are landscape (ie 320 wide, 240 high). This means the finder image feed doesn't fit to the portrait screen.

    No amount of image.transpose or appuifw.app.orientation adjustments can get me the following: portrait images from the viewfinder when the phone is held upright, or landscape images from the viewfinder when the phone is held on its side. Not the other way round!

    Can anyone show me how to reconfigure the camera.start_finder to flip 90degrees at the image feed stage? Subsequent image rotations don't help as they always involve cropping/letterboxing the original viewfinder capture.

    Thanks.

    Code:
    import camera, appuifw, e32, graphics
    
    def viewfinder(img):
        img.save(u'e:\\Python\\file.jpg')
        canvas.blit(img, (0,0))
    
    def quit():
        appuifw.app.orientation='automatic'
        camera.stop_finder()
        lock.signal()
    
    appuifw.app.screen='full'
    appuifw.app.orientation='portrait'
    appuifw.app.exit_key_handler = quit
    appuifw.app.body = canvas = appuifw.Canvas()
    
    
    w, h = canvas.size
    camera.start_finder(viewfinder ,size = (320,320))
    lock = e32.Ao_lock()
    lock.wait()

  2. #2
    Registered User
    Join Date
    Jan 2007
    Posts
    24

    Re: Viewfinder images orientation problem: landscape / portrait inconsistencies

    Try
    Code:
    appuifw.app.orientation='portrait'
    before

    Code:
    import camera

  3. #3
    Regular Contributor
    Join Date
    Mar 2008
    Posts
    151

    Re: Viewfinder images orientation problem: landscape / portrait inconsistencies

    Thank you phishboh! I never would have thought of doing that - for some reason I thought that import commands *had* to be at the top of the code.....although I noticed 'landscape' works, not 'portrait'.

    Here's the (simple) code for a camera viewfinder that uses fullscreen, in the correct orientation (landscape / portrait etc). I haven't seen elsewhere a viewfinder example that uses fullscreen.

    Note, you must include
    Code:
    appuifw.app.orientation='landscape'
    before import camera.

    You must also specify the image dimensions in
    Code:
    camera.start_finder(viewfinder,size = (320,240))
    .

    Finally, make sure when messing around with orientation settings that you exit python between changes - otherwise things can get screwed up when you quit and run script without exiting the interpreter.

    Code:
    import appuifw
    appuifw.app.orientation='landscape'    #THIS LINE MUST BE ABOVE IMPORT CAMERA
    
    import camera, e32, random, graphics
    
    def viewfinder(img):
        #img.save(u'e:\\Python\\file.jpg')
        canvas.blit(img)
    
    def quit():
        appuifw.app.orientation='automatic'
        camera.stop_finder()
        lock.signal()
    
    appuifw.app.exit_key_handler = quit
    appuifw.app.screen='full'
    appuifw.app.body = canvas = appuifw.Canvas()
    
    camera.start_finder(viewfinder,size = (320,240))    #YOU MUST SPECIFY (320,240), NOT (240,320)
    
    lock = e32.Ao_lock()
    lock.wait()

Similar Threads

  1. Problem MMC+USB Connection
    By Fede81 in forum Symbian
    Replies: 1
    Last Post: 2007-06-14, 06:13
  2. Problem MMC+USB Connection
    By Fede81 in forum General Development Questions
    Replies: 3
    Last Post: 2006-07-19, 15:21
  3. Landscape orientation on CEikRichTextEditor
    By dsiorpaes in forum Symbian User Interface
    Replies: 1
    Last Post: 2006-04-07, 10:18
  4. Replies: 0
    Last Post: 2003-09-22, 07:00
  5. Problem while saving JPEG images
    By suckho in forum Symbian
    Replies: 0
    Last Post: 2003-07-10, 10:10

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×