Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7648389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:42:12+00:00 2026-05-31T10:42:12+00:00

I have successfully wrapped my C++ code with SWIG and it loads fine into

  • 0

I have successfully wrapped my C++ code with SWIG and it loads fine into Python. I am using the Olena library for image processing.

However, I don’t know how to call my functions that require a pointer to an image!

For instance, my function for eroding an image is prototyped as follows:

mln::image2d<mln::value::int_u8> imErossion(
    const mln::image2d<mln::value::int_u8> *img, int size, int nbh
);

Result of running my code within Python:

    from swilena import *
    from algol import *

    image = image2d_int_u8
    ima = image.load("micro24_20060309_grad_mod.pgm")

    eroded_ima = imErossion(ima,1,8) 
    >>>> Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: in method 'imErossion', argument 1 of type 
       'mln::image2d<mln::value::int_u8 > const *'

I have been looking all around the web to try and solve this myself, but it turns to be harder than I expected.

I’m not sure how to pass a pointer from Python — the equivalent of this C++ code:

eroded_ima = imErossion(&ima,1,8)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T10:42:13+00:00Added an answer on May 31, 2026 at 10:42 am

    I checked with my professor at university, and we decided it would be better to implemente a function that would return the pointer to the image when this one was loaded and declared it global:

    mln::image2d<mln::value::int_u8> working_img;
    
    mln::image2d<mln::value::int_u8> *imLoad(const std::string path){
        mln::io::pgm::load(working_img, path);
        return &working_img;
    }
    
    void imSave(const std::string path){
    
        mln::io::pgm::save(working_img, path);
    
    }
    

    What do you think about this?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a library that I have been using successfully with PHP 5.1.6 with
I have successfully set up FILESTREAM on my SQL 2008 server; however I've noticed
I have following code on my site: backgroundImages[bg_img_path_b]=new Image(); backgroundImages[bg_img_path_b].src = bg_img_path_b; backgroundImages[bg_img_path_b].loaded=loading; //jQuery(backgroundImages[lastImage]).unbind('load.backgroundImages');
I have created WCF service in project. Now using Jquery I am successfully able
I have a stylesheet, which successfully applies itself to any text wrapped with a
I have been using subprocess.Popen successfully in the past, when wrapping binaries with a
I'm just getting started with require.js. I have successfully wrapped jquery, some plugins, and
I have successfully connected to an Oracle database (10g) from C# (Visual Studio 2008)
I have successfully managed to get System.Speech.Synthesis to read English text in arbitrary voices
I have successfully implemented interop beftween Win32 application and managed .Net dll as described

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.