I am working on a program for machine vision. I am trying to do the following:
Grab image at a certain zoom level and find borders.
Take that image and subdivide into a fixed sized grid (which is pre-determined).
Project the image+grid in a UI and allow a user to select/deselect individual grid boxes.
Currently I am using PyQt+Python2.7 with C++ for the computations. I am just wondering if there is a good tutorial for the UI grid section.
Use the Graphics View Framework. Add each grid item as a separate pixmap using scene->addPixmap. Make items selectable using item->setFlag(QGraphicsItem::ItemIsSelectable);. Use scene's selectionChanged signal and scene->selectedItems() to know about selected items.
You can use QPixmap::copy to cut off a rectangle.
Related
Currently, I am trying to build a User Interface with python to visualize MRI images (in numpy) in 'tkinter' Graphic User Interface.
The feature of mouse scrolling from Matlab's imshow3d is essential but I was not able to find anything like this on web (ex.https://www.mathworks.com/matlabcentral/mlcdownloads/downloads/submissions/47463/versions/3/screenshot.jpg).
Does anyone have any idea how I can implement the mouse based slice browsing with tkinter?
or are there any other gui that I could use to build what I want.
I'd like to know if there's a way to turn Nuke's text (contained in Text node) into polygonal object and then extrude it along Z axis? It's possible in Blackmagic Fusion, it's even possible in Apple Motion 5. Who knows how to do it in Nuke via Python?
logoPlate = nuke.nodes.Text(name="forExtrusion")
logoPlate['font'].setValue("~/Library/Fonts/Cuprum-Bold.ttf")
logoPlate['xjustify'].setValue("center")
logoPlate['yjustify'].setValue("center")
logoPlate['box'].setValue([0,0,512,256])
logoPlate['translate'].setValue([-20, 50])
logoPlate['size'].setValue(48)
logoPlate['message'].setValue("TV Channel logo")
logoPlate.setInput(0,nuke.selectedNode())
I am not interested in using exported obj, fbx or abc from 3D packages or any third party plugins.
The only method to extrude a text at the moment (in NUKE version 10.5) is to trace a text logo with Polygon shape tool using ModelBuilder node.
modelBuilder = nuke.createNode('ModelBuilder')
camera = nuke.createNode('Camera2')
nuke.toNode('ModelBuilder1').setSelected(True)
nuke.toNode('Camera1').setSelected(True)
nuke.connectNodes(2, camera)
nukescripts.connect_selected_to_viewer(0)
n = nuke.toNode('ModelBuilder1')
k = n.knob('shape').setValue(6) #'Polygon' tool in dropdown 'shape' menu
k.execute()
After tracing the logo I used Extrude from ModelBuilder's context menu and then baked out a geometry. But you can use only straight lines due to nature of polygonal modeling in NUKE.
No NURBS geometry.
script = nuke.thisNode()['bakeMenu'].value()
eval(script)
Typically you would use a 3D modelling program like Modo, Maya, Cinema 4D, etc. Create and output your text as a model and import it into Nuke. To create 3D text directly in Nuke, you need the Geometry Tools plugin. Then simply use the PolyText node.
Documentation on PolyText
Download site for Geometry Tools
I have a custom object(a small circle) placed at some point inside a Gtk.Fixed() widget .Is there a way to drag this object around using the mouse. I am not able to map the Mouse Press/Release/Motion events to make this work.
I would prefer solution in Python using PyGobject but any other language will do also be fine if explanation is provided
More Details:
I am trying to make a font editor where these objects I mentioned above will be the control points of the bezier curves in the Glyph outlines
Here is an image of the concept design:
https://github.com/sugarlabs/edit-fonts-activity/blob/gh-pages/files/img/wireframe_concept_01_first_prototype.svg
I need to able to move the points shown to edit the outline of the letter shown
GtkFixed is not designed to do drawing work. It's made to locate widgets (such as buttons and such) on a fixed grid (รก la Windows).
If you would like to move elements of a drawing, have a look at eg. GooCanvas. Each element on a goocanvas can have events connected, which can then be used to move it around. You can even use CanvasGroup to group primitives (circle, rectangle etc), and move them together (even change other properties such as color, linewidth). The toolbox actually contains curves etc. It's easy to create a 'handle' using a small rectangle.
Here's an example of a simple goocanvas program, and you can find download links, references manuals and other useful stuff here.
I don't know if this is a tool you need, or just a learning exercise. If the former, then do have a look at FontForge, an open source font editor, and incredibly versatile.
How do I make WXPython disregard monitor sizes, when it resizes?
I want to make a really large window, so I can get a bitmap of all elements within the window. This program is not meant to be interactive in any way. I am using wxpython to set up a poster, using sizers, pictures and text, and then getting a bitmap via the DC.
All I found on this issue was a similar question, asking about the same problem, using the WinAPI.
I'm currently designing a GUI to display images on screen using Python 2.6, Glade-3 and GTK. It uses 2 sliders (2 x GtkHScale) in order to "clip" the image of any bright/dark areas. (like below)
upper clip ----------------|====
lower clip ===|-----------------
I think that it would look much neater if the two sliders were combined onto one GtkHScale giving the "blue line" between the 2 sliders in order to show which bits of the image are being clipped. (much like the mock up below)
Clipping -----|============|----
I'm using Glade-3 to create the slider but i think this customisation will have to be included in the Python code and not the Glade file? Any ideas on how to create a custom GtkHScale?