Getting the dimensions of objects is other Maya scenes [closed] - python

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I'm trying to check the width of an object in another scene. The object in the other scene will be imported as an reference, but I need to know the width/height/depth (x/y/z bounding box) of the object in order to match a number of them into my scene according to parameters set by a script of mine.
The only way I've figured so far is to reference the object into the scene, check the bounding box with the xform command and then remove the reference and then proceed as normal. That solution seems both a bit slow (for large objects) and a bit awkward.

There's no way to interact with a Maya scene without it already in Maya. I think your method is correct.
What do you mean by "match a number of them into my scene"? Do you mean you want to make multiple references, based on the size? I.E. you want to fill up a given volume using the bounding box to determine how many will be needed? It seems that could be done after making one reference as easily as not.

There's no other way to check than opening the file.
You could do an an offline batch process to collect all of the information once and save it to a database or simple file such as a CSV for faster access if speed is really an issue.

Related

PyOpenGL camera system [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm confused on how the PyOpenGL camera works or how to implement it. Am I meant to rotate and move the whole world around the camera or is there a different way?
I couldn't find anything that can help me and I don't know how to translate C to python.
I just need a way to transform the camera that can help me understand how it works.
To say it bluntly: There is no such thing as a "camera" in OpenGL (neither there is in DirectX, or Vulkan, or in any of the legacy 3D graphics APIs). The effects of a camera is understood as some parameter that contributes to the ultimate placement of geometry inside the viewport volume.
The sooner you understand that all that current GPUs do is offering massively accelerated computational resources to set the values of pixels in a 2D grid, where the region of the pixels changed are mere points, lines or triangles on a 2D plane onto which they are projected from an arbitrarily dimensioned, abstract space, the better.
You're not even moving around the world around the camera. Setting up transformations is actually errecting the stage in which "the world" will appear in the first place. Any notion of a "camera" is an abstraction created by a higher level framework, like a third party 3D engine or your own creation.
So instead of thinking in terms of a camera, which constrains your thinking, you should think about it this way:
What kind of transformations do I have to chain up, to give a tuple of numbers that are called "position" an actual meaning, by letting this position turn up at a certain place on the visible screen?
You really ought to think that way, because that is what's actually happening.

How to make a variable-column grid using PyQt [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm trying to display an array of image thumbnails using Python and Qt4. My problem is that I don't want to calculate the amount of columns for the grid, so that when the application is resized or my thumbnails get bigger, the number of columns automatically change.
Actually I want to use Qlabel, because images are going to have file names and possibly buttons. Is there an easy way to do it?
Something like that:
Brendan Abel's answer is the right and elegant way to use the power of Qt. However, if you find model-view architecture too heavy, I'd suggest you to use FlowLayout demonstrated in here.
Its rather quite easy to implement and may suit your needs.
You should look into using a QGraphicsView. It's a good building block for truly custom widgets that don't really resemble any of the built-in widgets. It uses a model/view architecture and allows you pretty much unlimited flexibility how and where each item is drawn, as opposed to relying on the more limited QLayout system of placement.

Detecting credit card edges using opencv and python [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I'm hoping this is very simple; I suspect that's the case.
I have an app that takes an image from the user in which they're holding a credit card up, stripe side out. Something like this: http://imgur.com/OOanf9i
This is already being fed through a python script to assist in pupil detection, and I'd like to add the ability to detect the edges of the credit card, width-wise. I've done some research into openCV but it seems like a VERY in-depth topic, and I believe this is a simple case.
Can anyone give me any direction on how to accomplish this? Or just how difficult it might be to do?
Thanks!
One option would be to use the canny edge detector, followed by HoughLines or HoughLinesP for detecting straight edges.
Canny: http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/canny_detector/canny_detector.html
HoughLines: http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/hough_lines/hough_lines.html
But I suspect you'll have to play with the code a little bit and apply some heuristics, since I am not familiar with a module that will magically solve the problem.
In any case I would start with very basic operations (like Canny and Hough) and wouldn't try to train a detector for that.

How do I create a PDF file, including images and text, from Python? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I am looking for a way to create a sheet of labels, as a PDF file, from a Python program. Each label has one or two images, and a few lines of text (same font, e.g. Helvetica or Arial, but possibly different sizes, and using bold and italic). These being labels, it is important that the elements are positioned correctly on the page. Some of the labels are addresses, so the text can vary and have different line lengths and number of lines.
I would like to be able to tell when text did not fit in the space available for it, so that the program could try a few strategies automatically (e.g. change font to Arial Narrow, reduce font size) before bailing out. I definitely don't want the text to overrun or wrap without notice.
I have looked at pypdf, but it doesn't seem to be able to do what I need (or maybe I'm missing something). I don't mind creating a document in a different format using a library that supports the features I need, as long as it can be converted to PDF programmatically. As a last resort, I can also use a library that can create a raster image, because that can be converted trivially to PDF, but I prefer a PDF that contains native text, not just a bitmap of it.
Take a look at reportlab.
Here is the userguide:
https://www.reportlab.com/docs/reportlab-userguide.pdf
Here is a nice Tutorail:
http://www.blog.pythonlibrary.org/2010/03/08/a-simple-step-by-step-reportlab-tutorial/

2D image projections to 3D Volume [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I am looking for a library, example or similar that allows me to loads a set of 2D projections of an object and then converts it into a 3D volume.
For example, I could have 6 pictures of a small toy and the program should allow me to view it as a 3D volume and eventually save it.
The object I need to convert is very similar to a cylinder (so the program doesn't have to 'understand' what type of object it is).
There are several things you can mean, I think none of which currently exists in free software (but I may be wrong about that), and they differ in how hard they are to implement:
First of all, "a 3D volume" is not a clear definition of what you want. There is not one way to store this information. A usual way (for computer games and animations) is to store it as a mesh with textures. Getting the textures is easy: you have the photographs. Creating the mesh can be really hard, depending on what exactly you want.
You say your object looks like a cylinder. If you want to just stitch your images together and paste them as a texture over a cylindrical mesh, that should be possible. If you know the angles at which the images are taken, the stitching will be even easier.
However, the really cool thing that most people would want is to create any mesh, not just a cylinder, based on the stitching "errors" (which originate from the parallax effect, and therefore contain information about the depth of the pictures). I know Autodesk (the makers of AutoCAD) have a web-based tool for this (named 123-something), but they don't let you put it into your own program; you have to use their interface. So it's fine for getting a result, but not as a basis for a program of your own.
Once you have the mesh, you'll need a viewer (not view first, save later; it's the other way around). You should be able to use any 3D drawing program, for example Blender can view (and edit) many file types.

Categories