You Are Here:

Community: Developer Discussion Boards

#1 Old Converting Python Images to Symbian Images for Wrappers - 2007-11-19, 00:57

Join Date: Nov 2007
Posts: 4
yqmtooblue
Offline
Registered User
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.
Reply With Quote

#2 Old Re: Converting Python Images to Symbian Images for Wrappers - 2007-11-19, 14:54

Join Date: Jun 2005
Posts: 382
y.a.k
Offline
Regular Contributor
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.
Reply With Quote

#3 Old Re: Converting Python Images to Symbian Images for Wrappers - 2007-11-19, 18:50

Join Date: Nov 2007
Posts: 4
yqmtooblue
Offline
Registered User
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!
Reply With Quote

#4 Old Re: Converting Python Images to Symbian Images for Wrappers - 2007-11-19, 19:04

Join Date: Jun 2005
Posts: 382
y.a.k
Offline
Regular Contributor
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.
Reply With Quote

#5 Old Re: Converting Python Images to Symbian Images for Wrappers - 2008-02-22, 14:38

Join Date: Jan 2007
Posts: 24
phishboh
Offline
Registered User
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!
Reply With Quote

#6 Old Re: Converting Python Images to Symbian Images for Wrappers - 2009-03-09, 09:24

Join Date: Apr 2008
Posts: 18
anechini
Offline
Registered User
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?
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
7650 Symbian Connect alexbas Symbian Tools & SDKs 4 2008-11-16 11:40
setting of Series 60 MIDP SDK for Symbian OS version 1.2 for networking servigo Mobile Java Networking & Messaging & Security 2 2003-07-31 08:47
CcDoc configuration for Doxygen for use with Symbian Series 60 code nawkboy General Symbian C++ 0 2003-06-13 02:11
CcDoc configuration for Doxygen for use with Symbian Series 60 code nawkboy Symbian Tools & SDKs 0 2003-06-13 02:10
CcDoc configuration for Doxygen for use with Symbian Series 60 code nawkboy General Symbian C++ 0 2003-06-13 02:09

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia