creating a dynamic editing tool in wxpython? - python

I am new to python.
I am trying to create a GUI that can be used edit an image namely, cropping and changing colour of background of the image, using wxpython.
Can someone guide me where i can find information to tackle this? I have taken a look at the wx wiki but there isnt much on dynamic widgets that can be used to do this.
Many thanks,
HP
– Dilettant Jun 9 at 10:02 - Could you give more detail on what dynamic here means, as you were able, to detect that the wxpython wiki does not provide anything similar. Only you may be able to explicate that. And than maybe someone here can jump in, and give hints.
– user6444620 1 hour ago I looked into using PIL, but it doesn't seem to support STL files so i can not get it to show/display. What i am using is VTK to render a 3d image and display it using wxpython. i've got it to display using wxpython i now need a method to to create a editing tool to perform - mentioned earlier. Still doing more research to find best method to tackle, unfortunately to no avil at the moment.

I suggest you to download wxPython Docs and Demo. https://sourceforge.net/projects/wxpython/files/wxPython/3.0.2.0/wxPython3.0-win32-docs-demos-3.0.2.0.exe/download?use_mirror=netassist
These Items maybe help you (Use the search TextCtrl on Left Bottom area):
GraphicsContext
PrintFramework
Mask (Maybe help if use PNG or alpha channel)
ImageAlpha
To Crop Image you need some Image package, Like a PIL( http://www.pythonware.com/products/pil/) or numpy (http://www.numpy.org/). If you will use PIL, has a nice tutorial in this link: http://matthiaseisen.com/pp/patterns/p0202/
To use PIL images in wx, this tutorial have some functions to help you: http://wiki.wxpython.org/WorkingWithImages

Related

How to conform text to a surface using a displacement map in Python?

I am working on a project where I need to programmatically add a text to an image such that the text conforms to the surface so that it looks much more real-life.
Here is an example of what I am talking about:
https://www.youtube.com/watch?v=huvysaySBrw
I am fairly new when it comes to programmatic image editing. I have gone through quite a bit of documentation of ImageMagick and similar libraries. But didn't find anything that might help me so far.

SimpleITK python programming

I'm fairly new to python programming and definitely new to simpleITK. I'm trying to put together a segmentation filter that can segment out the liver from 3D images. Because i'm so new to programming in general, i'm not sure where to start. I've looked at the simpleITK notebooks which go over some filters for segmentation but overall i'm pretty confused, mainly, if i want to use multiple filters does everything go in one .py file ... ? I was hoping someone could guide me towards a starting point or tell me about a tutorial i could read through to figure out what to do.
Thanks!
This PyScience post has a very nice tutorial on image segmentation using SimpleITK in python.
With a bit more information on the your problem, I might be able to provide some more specific help (i.e. what type of images are you using, do you know how to read an image into SimpleITK, are you looking for a completely automatic solution or is manual intervention allowed, etc.)

.asc viewer using Kivy

I want to develop a 3D file viewer in kivy and python that reads and displays .asc mesh files of the format:
x1,y1,z1
x2,y2,z2
........
xi,yi,zi
What I have thought so far is to use a method similar to beginShape() of Processing so as to begin drawing a 3D shape then use a for-loop to append each point respectively.
I have also found that kivy example which parses .obj files and then displays them. Do you have any ideas on how can I make a similar ascparser and try to display my files?
Any help is greatly appreciated
I have also found that kivy example which parses .obj files and then displays them. Do you have any ideas on how can I make a similar ascparser and try to display my files?
Your best strategy at the moment is probably to read the objparser and try to understand what it is doing. The important thing is building a list of points and normals, which are passed to opengl via a Mesh with a custom vertex_format and custom shaders. In principle it wouldn't be very hard to do the same thing for your own filetype just by comparison with the .obj code, though you will need some understanding of what's going on (you can read about opengl and read the kivy source, if you haven't already) to make significant changes.
This is really an advanced topic right now, Kivy has very few pre-built wrappers to 3d opengl rendering. The backend is fully capable (so the 3d rendering example isn't that complex, for instance), but you probably do need some understanding of what's going on to accomplish things like your own task.
There are also a few other examples of 3d rendering in Kivy, which you might find helpful. nskrypnik has several repositories doing just this (see kivy-trackball, kivy-3dpicking, kivy-rotation3d), and seems to have begun implementing a proper 3d api in the kivy3 repo, though this is not complete and I suggest it as something you can learn about by reading, not something that can necessarily do what you want right now. The other nice example I've seen is a 3d inspector POC by tito, though it's just a proof of concept and not a polished product.

Adding multiple images to one canvas in Python

I want to load a number of images from harddrive and place them on a larger white background. And I want to do it in Python. I am wondering what is the best way of doing that. I am using a windows machine and I can use any library I want. Any pointer to a webpage or a sample code that can point me to a good direction would be appreciated.
Something like this:
A very popular image processing library for Python is PIL. The official PIL tutorial might be useful, especially the section about "Cutting, Pasting and Merging Images".
PIL isn't enough. Try also with PIL the aggdraw library.
But aggdraw also isn't enough. It works poorly with transparency. I mean 0.5-1 gray pixel around opaque object over the transpparent area.

Histogram Equalization

I am a beginner in Python. I want to make a small project on histogram equalisation. Basically I want to include changing contrast, color and crop option etc in my project. I am blank right now. Please suggest something. I am very keen to make this project but how to start?
Python's PIL module has methods for controlling contrast, color, and cropping.
You can use PythonMagick. It suports histogram equalization:
import PythonMagick
img = PythonMagick.Image("original.png")
img.equalize()
img.write("equalized.png")
PythonMagick is not very well documented itself, but its API directly corresponds to Magick++ API. Use Magick++ documentation for reference.
If PIL is enough for you, stick with PIL, it is better supported. I installed PythonMagick from the Ubuntu package, the project page does not open for me.

Categories