I'm wandering what the best way is to send a fully scaled (1:1) dxf drawing to a cad plotter using python. Has anyone here ever done this?
For those who want to know why:
I've written a program for my employer that automates the drawing of detailed
schematics, apparently so our engineering dept can spend more time doing nothing. The issue now is that they would like to completely eliminate acad since it's only used to plot the finished drawing.
Mind you these drawings are used for non-trivial things like checking the dimensions of critical components used in commercial jetliners.
In case anyone else runs into this problem (pretty unlikely) I though I'd post briefly what I did in the end:
1.) Wrote a short script to capture the dxf as a BMP (basicaly just a screen grab that appends the scale to the drawing)
2.) Wrote a print dialog with PyQt4 that's a clone of Autocads plot window except that it has to pull the scaling info from the BMP.
My python skills are awfull so there's likely better solutions but this worked.
Related
I've built a simple program using matplotlib widgets to label a series of images for a classification task (see image below). My script adds the label and filename to a pandas dataframe depending on the button chosen in the window and moves on to the next image. When finished saves the whole dataframe to a csv.
Example Labelling Interface
I chose to build it rather than use something already out there as most programs seemed too complicated for the type of problem I have and I was hoping for a quick labelling solution - here it's just a simple click of a button and it's on to the next image.
My initial plan was to have a labelling program which I can host somewhere (something like AWS or Azure) in an app where others could simply go to a link and help with classifying some images, however I've found it hard to find anything on this.
I'm looking for general advice on if
a) hosting mpl interactive plots online is possible (if so any information would be greatly appreciated)
b) there's a simpler way to package this together to distribute to others without hosting online
c) there's a much better solution which I've somehow missed
Thanks in advance for any help!
I'm a senior in high school and this year I have to do a project for my electronic class, I was hoping to get some advice from people with some experience.
My idea is kind of complicated and has a lot of different sensors but not too crazy, the problem begins with possible image processing. I have a camera who need to check for flashing light and send the video to a screen without the frames of the flashing (like just skipping the frame, so the video is always a frame in delay but the person won't notice it).
The fashing light is supposed to be like in a party or in a video game you get a warning on. The idea is to notice the extreme changing of lighting and to not show it on the screen.
My teacher is afraid that doing image processing might be too complicated and video processing as well... I don't have any knowledge in it, and I have a little background in Python and other languages, do you think it is possible? Can anyone give me an advice or a good video/tutorial to learn from?
Thank you in advance:)
your probleme if quite diificult, cause it envolved unknown environnement in a dynamic time range.
if you admit as an axiom that your camera has for exemple a frame rate of 20 FPS, the chances that your difference between Frame f' and next frame f+1 are quite low.
UNLESS you have a huge color change du to ligth flash,
So you can process with an image similarity such as ssim or psim
https://www.pyimagesearch.com/2017/06/19/image-difference-with-opencv-and-python/
if your image is over a certain treshold that you have to define ( can use also a kalmann filter to dynamically reajust the difference treshold)
so it will probably mean that your flash light is on.
Although it's a visual coding program (per se), Bonsai is a great open source software for doing what's in your description; as well, Bonsai supports applications that require combinations of different hardware (e.g. microcontrollers, cameras) and software components (e.g. Python).
To provide a similar application as an example, I have setup a workflow where Bonsai captures images sent from a Basler camera, it processes the input video frame-by-frame, and when it detects, within the cropped frame (that I cropped around an red LED), a threshold change in pixel intensity (i.e. the red LED turns ON or OFF), it sends an output signal (i.e. 5 volts) to an Arduino microcontroller while saving the image frame as a png file as well as a avi video file along with a vector of True/False (corresponding to the ON or OFF red LED frames) and corresponding timestamps that are saved as csv files, etc. Although this isn't identical to what you've described, I'm sure you can setup a similar Bonsai workflow to accomplish your goal.
Citation: https://www.frontiersin.org/articles/10.3389/fninf.2015.00007/full
Edit: I'm very familiar with Bonsai so if you need help with setting up a Bonsai workflow I'd be happy to help; I don't think there is direct message on StackOverFlow, but given that StackOverFlow doesn't list Bonsai as a programming language (because it's a visual programming language; or because it's not well known enough to include on StackOverFlow) feel free to reach out if you have any questions regarding Bonsai specifically (again, it's also an open source software).
I'm writing a gravity simulator in Python 2.7 and at the moment I finished the mathematical part. I'm trying to find a way to display the results while the simulation is running, it should consist of some colored circles representing the various bodies and optionally some curved lines to represent orbits, that can be shown or hidden while the simulation is running.
I pictured a way to obtain this result, but I can't seem to find a way to even start.
My idea is to use wxPython. The window should be divided into four sectors (2x2), the first three contain the simulation viewed in the XY, XZ and YZ planes, while the last contains the controls (start/stop simulation, show/hide orbits, ...).
The controls should not be a problem, I just need a way to display the animation. So how can I display moving circles and curved lines using wxPython objects? Which objects should I use? I don't need much more than a couple names, the rest should follow easily.
I know that an animation purely with wxPython will probably require some multithreading, I'm already prepared for that. I also want to stress that I need the animation to be shown while the simulation is running, not after, because the simulation has no definite end at the moment: I don't know when to stop it if I don't see the results first.
If it's somehow useful, I'm using Ubuntu Linux 17.10.
Edit: Since I was asked to choose one approach, I discarded Matplotlib because it requires two different windows. Hope this helps.
It's all in the title: I would like to make red-cyan anaglyphs (you know, these pictures you use coloured glasses to see in 3D) of simple shapes (like points3d plots) with Mayavi. Is there such a feature? Otherwise, would you have any advice for implementing it?
EDIT : Okay, that was simple: just hit '3' in the interactive window and this sets the stereoscopic mode on. However I'd be interested in ways to configure this option, which does not seem to be documented.
Yes the interactive renderer is very poorly documented. A lot of mayavi is very badly documented, but at the least the code is often well written to figure stuff out.
Programatically you can adjust it by editing scene.render_window.stereo_render.
The source code of tvtk InteractiveRenderStyle has the following comment, also:
Some systems support crystal Eyes LCD stereo glasses; you have to invoke
set_stereo_type_to_crystal_eyes() on the rendering window.
For more configuration, you'd probably have to read the tvtk source.
Working on my Major project for software design and development and have run into the hurdle that when using pygame.gfxdraw.aacircle to draw big circles, the output goes screwy as seen here
the window in the picture is showing a section of a circle with a radius of size 1561
if no-one can suggest a fix or alternate way of drawing aa circles i will probably just use the regular circle function as it doesn't look to bad at sch a large radius.
I would suggest not to use pygame.gfxdraw, since it is clearly marked as experimental.
From the documentation:
EXPERIMENTAL!: meaning this api may change, or dissapear in later
pygame releases. If you use this, your
code will break with the next pygame
release.
Just stick with the regular circle function.
EDIT:
Maybe you should open a bugreport on the pygame bugtracker or the pygame mailinglist.