What is the simplest way to create my own python function ?

General discussion about topics related to OpenMV.
User avatar
chrisPyres66
Posts: 153
Joined: Mon Jul 16, 2018 9:22 am
Location: France

What is the simplest way to create my own python function ?

Postby chrisPyres66 » Tue Jul 16, 2019 11:44 am

Dear all,

I have some problem of memory size with F7 cam if my python code is too big, not yet with H7, lol

To improve this, and my knowledge, i would like to do and integrate my own python function with openmv github source.

I have so two questions :

- What is the simplest way to create my own python function ?

- How get the latest github openmv update all along keeping my own function ?

Thanks for help,
User avatar
iabdalkader
Posts: 1229
Joined: Sun May 24, 2015 3:53 pm

Re: What is the simplest way to create my own python function ?

Postby iabdalkader » Tue Jul 16, 2019 4:17 pm

There's no documentation for this you have to read the code. To keep your changes, you have to know your way around github. If your function is general and useful enough, send a pull request and we'll merge it in the upstream firmware.
User avatar
chrisPyres66
Posts: 153
Joined: Mon Jul 16, 2018 9:22 am
Location: France

Re: What is the simplest way to create my own python function ?

Postby chrisPyres66 » Wed Jul 17, 2019 5:06 am

Well thanks, but i dont know if i am sure to do a good and generic code well integrated enough to github it...
I tried to do a manual exposition and gain control (MEC and MGC) in function of a ROI luminance in a gray image.
User avatar
kwagyeman
Posts: 4539
Joined: Sun May 24, 2015 2:10 pm

Re: What is the simplest way to create my own python function ?

Postby kwagyeman » Wed Jul 17, 2019 1:52 pm

Um, so there are a lot of Pull Requests that you can look at done by me that show how to add methods. It's not really hard. See the closed Pull Requests in the OpenMV GitHub. You can see exactly what changes are needed there.
Nyamekye,
User avatar
chrisPyres66
Posts: 153
Joined: Mon Jul 16, 2018 9:22 am
Location: France

Re: What is the simplest way to create my own python function ?

Postby chrisPyres66 » Thu Jul 25, 2019 2:43 am

Is it possible to have a template lib for newbie like there are in imlib_config.h ?
User avatar
kwagyeman
Posts: 4539
Joined: Sun May 24, 2015 2:10 pm

Re: What is the simplest way to create my own python function ?

Postby kwagyeman » Thu Jul 25, 2019 10:37 am

What do you mean?
Nyamekye,
User avatar
chrisPyres66
Posts: 153
Joined: Mon Jul 16, 2018 9:22 am
Location: France

Re: What is the simplest way to create my own python function ?

Postby chrisPyres66 » Thu Aug 01, 2019 5:46 am

Sorry i was not very explicit, because i proposed a solution and dit not with the idea.
The idea is to have a template python function included in the github for newbie to understand how it works and test it.

I think to do it by myseld, i should
- create and add in py directory the files : py_file.c and py_file.h
- create function in py_file like py_file_functioname()
- modifiy MakeFile of OMV directory by adding py_file.o in FIRM_OBJ and py_file.c in SRCS
- adding import file in the python code, and use the function by calling with functioname()

It is something close ?
Thanks for help,
User avatar
kwagyeman
Posts: 4539
Joined: Sun May 24, 2015 2:10 pm

Re: What is the simplest way to create my own python function ?

Postby kwagyeman » Thu Aug 01, 2019 1:54 pm

Yes, that's about right. You know, folks keep failing to find the wiki and asking this. I think I'll move the wiki to the readme file along with adding a note about how to do this.
Nyamekye,

Return to “General Topics”

Who is online

Users browsing this forum: No registered users and 0 guests