×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Registered User
    Join Date
    Jul 2013
    Posts
    73

    creating and using ccamera

    Hello, i have found on google books a pdf that 'explains how to use camera'
    however the info included there is not complete
    I know i want to use

    CCamera class and i need to have MCameraObserver (do i need to initialize it, because i didint find any constructors for this class and compiler wants this(variable) to be a pointer to this class.

    now i will quote a text from the ebook:

    You would usually use CCoeEnv::WsSession(), CCoeEnv::
    ScreenDevice() and CCoeControl:rawableWindow() to assign
    the first three parameters.
    The last parameter is the area where the viewfinder will be displayed.
    The position is relative to the origin of the screen.
    CCamera::StartViewFinderBitmapsL() is used to start the
    bitmap viewfinder:
    virtual void StartViewFinderBitmapsL(TSize& aSize);
    This is the hard part how should i set up:
    CCoeEnv::ScreenDevice()
    CCoeEnv::WsSession()
    CCoeEnv::ScreenDevice()
    CCoeControl:rawableWindow()


    Does symbian support StretchBlt function? http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
    Since i don't know what resolution of a bitmap i will get, i think i will be forced to make it smaller w/o much impact on the performance.
    I want to do realtime image processing and processing images larger than 180 pixels in any dimension will take too much time.



    Cheers.

  2. #2
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,033

    Re: creating and using ccamera

    Probably some articles on our Wiki may help,like this :http://developer.nokia.com/Community...ian_Camera_API

  3. #3
    Registered User
    Join Date
    May 2008
    Location
    Surat Thani
    Posts
    260

    Re: creating and using ccamera

    Quote Originally Posted by melepeta View Post
    CCamera class and i need to have MCameraObserver (do i need to initialize it, because i didint find any constructors for this class and compiler wants this(variable) to be a pointer to this class.
    MCameraObserver is an interface with camera callbacks, that you'll have to implement in your camera-handling class. Camera initialization is quite complicated, it might be a good idea to start with some working example code, check out vineet.jain's link or one of the several camera example projects on this site.

    Quote Originally Posted by melepeta View Post
    This is the hard part how should i set up:
    CCoeEnv::ScreenDevice()
    CCoeEnv::WsSession()
    CCoeEnv::ScreenDevice()
    CCoeControl:rawableWindow()
    You should use bitmap viewfinder instead of direct, because you'll need the bitmaps for image processing anyway. That way you also don't have to worry about any of the above, and can draw the viewfinder bitmaps to the screen yourself.

    Quote Originally Posted by melepeta View Post
    Does symbian support StretchBlt function? http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
    DrawBitmap function (of CGraphicsContext) can be used to draw a bitmap scaled to a different size.

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,694

    Re: creating and using ccamera

    Also, the "official" examples are still available, Resources above, Code examples, select technology: Symbian C++, and it is in the Multimedia category. I do not like this example (it uses some weird plug-ins), but it was a good occasion to tell you about the location of the examples. Also, older versions should be available too, perhaps there are some working with CCamera directly, without the plug-in API-s.

  5. #5
    Registered User
    Join Date
    Jul 2013
    Posts
    73

    Re: creating and using ccamera

    Sorry, but i was unable to find any simple exapmles such this shown on wiki. i tried to search with word ccamera etc. and nothing showed up.
    Cheers.

  6. #6
    Registered User
    Join Date
    Jan 2005
    Location
    Italy
    Posts
    639

    Re: creating and using ccamera

    Hello,
    please try the following links
    https://developer.nokia.com/info/sw....s_Support.html
    https://developer.nokia.com/info/sw....a_Example.html

    i tried to download the examples and everything was ok, hope will be the same for you.

    br,
    pg

  7. #7
    Registered User
    Join Date
    Jan 2005
    Location
    Italy
    Posts
    639

    Re: creating and using ccamera

    Quote Originally Posted by vineet.jain View Post
    Probably some articles on our Wiki may help,like this :http://developer.nokia.com/Community...ian_Camera_API
    Besides, if I well remember, there's an error in the snippets of this article, it's inside CCameraEngine.cpp, void CCameraEngine::ImageReady(CFbsBitmap* aBitmap, HBufC8* aData, TInt aError) implementation: when finished with it, you have to release aBitmap or aData, otherwise memory reserved for it won't be released

    br,
    pg

  8. #8
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,033

    Re: creating and using ccamera

    Quote Originally Posted by pavarang View Post
    Besides, if I well remember, there's an error in the snippets of this article, it's inside CCameraEngine.cpp, void CCameraEngine::ImageReady(CFbsBitmap* aBitmap, HBufC8* aData, TInt aError) implementation: when finished with it, you have to release aBitmap or aData, otherwise memory reserved for it won't be released

    br,
    pg
    Well, you are free to edit articles on wiki, its only us who creates them

  9. #9
    Registered User
    Join Date
    May 2008
    Location
    Surat Thani
    Posts
    260

    Re: creating and using ccamera

    Having read all the threads, some comments:

    The viewfinder bitmaps you get may not be the size you requested from StartViewFinderBitmapsL. I have written a couple of apps that use viewfinder bitmaps, and always request viewfinder frames with the current screen size. The resulting vf frames have been of the biggest size that can fit inside the requested size keeping the the frames' original aspect ratio - for example, in QVGA portrait mode, if you request vf frames of 240x320, you will actually get 240x180 (for resulutions with 4:3 aspect ratio). Not sure what happens if you request sizes smaller or larger than the screen (like your 640x480), but in any case you shouldn't assume you get the exact size requested, at least on all devices.

    I'd recommend doing the following, so that you don't need to know or guess the actual size of the frames in advance.

    Have a CFbsBitmap* iBitmap for storing the previous frame, and when you get a new viewfinder frame:

    1) Compare the size of the new bitmap to the size of iBitmap. If they're not the same, resize iBitmap, and do not do any processing for this frame
    2) If the bitmap sizes were the same, do whatever processing you plan to do, comparing the new frame bitmap to the previous one
    3) Draw the new bitmap to iBitmap (see CFbsBitmapDevice and CBitmapContext)

    As for comparing the new frame the the previous frame, if you have both frames as CFbsBitmaps, you can use GetPixel to get the r/g/b values, no need to do bit-shifting yourself (and as a bonus, it works for bitmaps of any TDisplayMode). If this turns out to be too slow, you can always change to using the bitmap bytes directly at a later stage - it's easier to check if your direct data access, bit-shifting etc work, when all the other stuff is already implemented, and you know also what the results should be like (from running the slower GetPixel version of the algorithm).

    One more thing, if you haven't yet done so, consider writing a viewfinder simulator that runs on the emulator (feeding you bitmaps via ViewFinderFrameReady), so you can implement, test and debug your algorithms without having to deploy to a real device for every small change. It might take a while to write, but will save a lot of time if or when you run into issues.

  10. #10
    Registered User
    Join Date
    Jul 2013
    Posts
    73

    Re: creating and using ccamera

    Thank you all, but this thread is solved and should be closed ;]

Similar Threads

  1. Security issue when creating CCamera
    By TechnoX in forum Symbian Signed Support, Application Packaging and Distribution and Security
    Replies: 3
    Last Post: 2010-01-26, 21:25
  2. CCamera in FP1 vs FP2
    By schrecklichkeit in forum Symbian
    Replies: 9
    Last Post: 2009-11-03, 08:30
  3. CCAMERA
    By goodslaurels in forum Symbian Media (Closed)
    Replies: 1
    Last Post: 2006-12-03, 18:39
  4. CCamera API in 3.0
    By imcm in forum Symbian
    Replies: 4
    Last Post: 2006-07-04, 19:16
  5. CCamera
    By bartg777 in forum Symbian
    Replies: 1
    Last Post: 2005-12-21, 06:42

Posting Permissions

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