I have managed to run OpenCV function from Python3 via Cython today, so I want to write about it. Before you start something like this, you should know you have to read at least header files of C library to write right definition in Cython,because Cython does not do that for you. I am using virtualenv, python from pythonz, and home-brewed OpenCV. Almost everything of C++ works just fine with Cython, but still, you should do some Voodoo things like for integer template argument. ctypedef void* int_parameter ctypedef int_parameter two "2" ctypedef Point_[float, two] Point2f Now, main sample Cython code is following. #===== testopencv.pyx ======== import numpy as np cimport numpy as np # for np.ndarray from libcpp.string cimport string from libc.string cimport memcpy cdef extern from "opencv2/core/core.hpp": cdef int CV_WINDOW_AUTOSIZE cdef int CV_8UC3 cdef extern from "opencv2/core/core.hpp" namespace "cv": cdef cppclass Mat: Ma...
On OSX, to show CPU usage, script is like this. #!/bin/bash top -l 1 | head -n 4 | tail -n 1|awk '{printf "%3d%%\n", $3}' to get Memory Usage, script is like this. #!/bin/bash vm_stat | awk 'BEGIN{FS="[:]+"}{if(NR<7&&NR>1)sum+=$2; if(NR==2||NR==4||NR==5)free+=$2} END{printf "%3d%%\n",100*((sum - free)/sum)}' Name thsese scripts like getCpuUsage.sh/getMemUsage.sh and put them in folder where the $PATH is set. Change their mode to u+x. To show them on tmux status line, .tmux.conf is like set -g status-right '#[fg=blue,bold]#H#[default] #[fg=blue,bold][CPU=#(getCpuUsage.sh) MEM=#(getMemUsage.sh)]#[default]'
I bought a cheap Intel Compute Stick PC(STCK1A8LFC, 1GB RAM/8GB storage) to make it a remote 3D printer host for my M3D micro+(https://printm3d.com/themicro/). Since M3D micro+ only works on Windows and Linux now (Mac version is incompatible to Mojave), I installed a Lubuntu to it. Although, there is a blog about the a script (isorespin.sh) for customizing bootable iso image to Atom base PC(http://linuxiumcomau.blogspot.com/2017/06/customizing-ubuntu-isos-documentation.html), it seems we don't need it anymore. So, here is what I did. 1. Update bios download latest bios image from https://downloadcenter.intel.com/download/28070/BIOS-Update-FCBYT10H-86A-?product=84815 . Choose Recovery BIOS update [FC0038.bio]. save it to a USB flash drive. restart ComputeStick hitting F7 from BIOS update menu, choose USB and FC00XX.bio. 2. Install Lubuntu Download lubuntu alternate image from https://lubuntu.me/downloads/ . We cannot install from normal lubuntu iso bec...
Comments