I have a system written in C++ that do some processing on some input video. As a result of this processing I get some statistics .
Right now the system produces number data that is saved on a text file.
Later I have written some python script that takes these numbers and shows some plots.
I was thinking, it would be nice if I can put this info in the video.
If it is just numerical values I can do that easily with the text writing functions in OpenCV.
However, perhaps it would be nice to include a small plot in the video.
How can I do that? Does OpenCV has something of this sort?
I also found this question about plotting with C++. I wonder if some answers there could be of any help. (As you can see the nature of the question although related is a bit different)
I am thinking I can go in one of two ways:
Implementing this plotting and then embedding the plot directly in my C++ code immediately after finding the values
or
Processing the video, getting the values in a text file as now, and then processing this text file, the video in Python to embed a plot in it
The key concept here is embedding a small plot in a video. How can I do that in either C++ or python?
Related
I am expanding my limited Python knowledge by converting some MATLAB image analysis code to Python. I am following Image manipulation and processing using Numpy and Scipy. The code in Section 2.6.1 saves an image using both imageio.imsave and face.tofile, where type(face)=<class 'imageio.core.util.Array>'.
I am trying to understand why there are two ways to export an image. I tried web-searching tofile, but got numpy.ndarray.tofile. It's very sparse, and doesn't seem to be specific to images. I also looked for imageio.core.util.Array.tofile, but wasn't able to find anything.
Why are there two ways to export files? And why does imageio.core.util.Array.tofile seem to be un-findable online?
The difference is in what the two functions write in the file.
imageio.imsave() saves a conventional image, like a picture or photo, in JPEG/PNG format that can be viewed with an image viewer like GIMP, feh, eog, Photoshop or MSxPaint.
tofile() saves in a Numpy-compatible format that only Numpy (and a small number of other Python tools) use.
I am trying to detect and extract the "labels" and "dimensions" of a 2D technical drawing which is being saved as PDF using python. I came across a python library call "pytesseract" which has optical character recognition capability. I tried the demo on my image but it fails to detect most of the label/dimensions. Please suggest if there is other way to do it. Thank you**.
** Attached is a sample of the 2D technical drawing I try to detect
** what I am trying to achieve is to able to obtain the coordinate of every dimensions (the 160,120,10 4x45 etc) on the image, and extract the, as well.
About 16 months ago we asked ourselves the same question.
If you want to implement it yourself, I'd suggest the following process:
Extract the Canvas from the sheet
Separate the Cuts
Detect the Measure Regions on each Cut
Detect the individual attributes of the Measure Regions to understand where the Measure Start & End. In your particular example that's relatively easy.
Run the detected Measure Labels through OCR
Associate the Labels to the Measures
Verify your results
Alternatively you can also run it through our API and get the results as JSON.
Here's a quick visualization of the result:
Drawing Read (GT stands for General Tolerances)
Is there a straightforward way (one line code or even context menu) to save an image that is shown in a return bubble from the Hydrogen package in the Atom.io editor?
I actually managed to extract the base64 code for the png from the developer-pane inspecting the bubble, and this can be used to generate the image. However, that is very cumbersome and it's easier to use pyhton to save the image (see below).
Remark:
Of course, since python is used to generate the image, it is in principle possible to save the image by injecting python code, however, sometime I just want to save the picture generated without going back to the file that contains the code that generates it.
This is not currently possible due to an Atom limitation. See: https://github.com/nteract/hydrogen/issues/245
I'm looking for a way to produce the output of my program in a way that the output appears on the live screen (output is typically a color filled shape) instead of appearing on a new window like it does for most Python programs.
I've attached an example of what I'm trying to achieve where only a part of the screen had its colors inverted (and will remain so as long as the script runs) and the rest remained as it is. NOTE:I've made the example using Photoshop.
I've tried PIL,OpenCV, Mss,curses.....but all these modules produce an output on a separate window.
Is what I'm trying to achieve even possible? If not with Python is it possible with C++? or is this something beyond the abilities of a programming language and needs to be done at the Operating System level itself?
An example illustration of what I'm trying to achieve
I have recently downloaded itrade, and so far I have been unable to get it to run (dependency on wxaddons amongst other things). Also, the project seems to have been disbanded since 2008.
Last but not the least, the project contains a lot of functionality which I just don't need.
All I require is the functionality to produce a graph similar to that shown on the Journalier tab in the image below; and to be honest, I don't even need all of the additional indicators shown in the image. I will be happy enough with the (1st) top chart and the (2nd) midle sub chart, without all the indicators.
I have had a look at the code, and since I am not familiar with wxPython etc, I am finding it difficult to locate the code that is responsible for producing the image below.
I'd be grateful if anyone with either wxPython or itrade experience could outline the steps needed (or explicitly state how) to extract only the section of the code that produces the image below. The objective being that I can read in data from a CSV file, and pass it to the new script, to display a GUI plot similar to the one shown below.
If you really have to do this, this would be my approach:
Find the code that produces these tabs
Find the code that produces the visual graph for the Journalier tab
Find the code where the data is produced that is displayed in the graph
Find the code that passes the data to the graph and how it is processed before being displayed
Extract the necessary pieces of logic to produce and process the data
Use a plotting library to create the graph; it's easier to hook a plotting library into your application than to try and integrate this particular piece of visual code. Especially if you don't need most of the visual indicators.