×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    4

    Converting Python Images to Symbian Images for Wrappers

    Hello,
    I am working on an app that does some image procesing. I would like to do this processing in C since it runs very slowly when implemented in Python. So I want to create a wrapper such that I pass it 1 image, and it returns a string (or an integer representing the string).

    The question I have is, how do I make a wrapper that takes as input a Python image object (since the function is being called from python) and converts it into a Symbian object suitable for being processed in C.

    If there is another way to pass an image to the C code through a wrapper please let me know. Any help would be greatly appreciated.

  2. #2
    Registered User
    Join Date
    Jun 2005
    Posts
    386

    Re: Converting Python Images to Symbian Images for Wrappers

    You have to create a Python extension in C++.

    Get full Symbian/S60 SDK from Nokia along with Carbide.c++. Then create a DLL project (read PyS60 docs chapter on extension modules). On PyS60 you have the standard Python/C API. You have to learn to use this. You can also download PyS60 sources to take a look at some s60 specific standard modules sources. The last thing to do is to learn how to perform your task using Symbian C++ APIs.

  3. #3
    Registered User
    Join Date
    Nov 2007
    Posts
    4

    Re: Converting Python Images to Symbian Images for Wrappers

    Hi yak,
    Thanks for your reply. I already am able to create extensions (from following these instructions: http://wiki.research.nokia.com/index.php/PythonWrappers).

    The only difficult part I am having is the conversion from python image wrapper to symbian image wrapper. It seems your suggestion is to view the PyS60 sources... an unpleasant task at best.

    Does anyone have a more direct answer? Surely I am not the first who wished to perform image processing in C as opposed to Python!

  4. #4
    Registered User
    Join Date
    Jun 2005
    Posts
    386

    Re: Converting Python Images to Symbian Images for Wrappers

    Looking at the sources isn't so bad

    Here's a part of ext/graphics/graphicsmodule.cpp file:
    Code:
    static CFbsBitmap *
    Bitmap_AsFbsBitmap(PyObject *obj)
    {
      PyObject *capi_object=PyCAPI_GetCAPI(obj,"_bitmapapi");
      if (!capi_object)
        return NULL;
      CFbsBitmap *bitmap=(CFbsBitmap *)PyCObject_AsVoidPtr(capi_object);
      Py_DECREF(capi_object);
      return bitmap;
    }
    This function is used for example in blit() method to convert a PyS60 image object to CFbsBitmap object (which as I believe is a Symbian bitmap).

    This code is not complete, for example the PyCAPI_GetCAPI function is found in the same file but I won't copy it here. Like I said, take a look at the sources.

    Of course if someone can explain it without looking at the sources, it would be great.

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

    Re: Converting Python Images to Symbian Images for Wrappers

    yqmtooblue,

    I'm looking to do similar things as you are. Did you have any success? If so, I'd really appreciate if you'd like to share some of your experiences so far.
    I was thinking I'd start from the source code of the graphics module and continue from there, but so far I haven't been able to compile it into an extension.
    You don't feel like sharing any of your source code, do you? If so, feel free to contact me!

  6. #6
    Registered User
    Join Date
    Apr 2008
    Posts
    17

    Re: Converting Python Images to Symbian Images for Wrappers

    I'm trying to pass CFbsBitmap from the FrameReady callback in a camera dll written in Symbian C++ to a Python script... do you guys know how should I do it?

Similar Threads

  1. 7650 Symbian Connect
    By alexbas in forum Symbian Tools & SDKs
    Replies: 4
    Last Post: 2008-11-16, 10:40
  2. setting of Series 60 MIDP SDK for Symbian OS version 1.2 for networking
    By servigo in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2003-07-31, 07:47
  3. Replies: 0
    Last Post: 2003-06-13, 01:11
  4. Replies: 0
    Last Post: 2003-06-13, 01:10
  5. Replies: 0
    Last Post: 2003-06-13, 01:09

Posting Permissions

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