6/29/2018

Pycharm does not show plot

just use "plt.show()"


for example
...
plt.figure(figsize=IMAGE_SIZE)
plt.imshow(image_np)
plt.show()
...

Thank you.

6/26/2018

Install Hangul(Korean) on Utubu

type this on terminal

..
dpkg -l | grep ibus-hangul
or
sudo apt-get install ibus-hangul
..


Ubuntu CUDA install on Console

Uninstall previous version
..
sudo apt-get purge cuda
sudo apt-get purge libcudnn6
sudo apt-get purge libcudnn6-dev
..


Install cuda 9.0, cuDnn 7.0
..
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libcudnn7_7.0.5.15-1+cuda9.0_amd64.deb
wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libcudnn7-dev_7.0.5.15-1+cuda9.0_amd64.deb
wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libnccl2_2.1.4-1+cuda9.0_amd64.deb
wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1604/x86_64/libnccl-dev_2.1.4-1+cuda9.0_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
sudo dpkg -i libcudnn7_7.0.5.15-1+cuda9.0_amd64.deb
sudo dpkg -i libcudnn7-dev_7.0.5.15-1+cuda9.0_amd64.deb
sudo dpkg -i libnccl2_2.1.4-1+cuda9.0_amd64.deb
sudo dpkg -i libnccl-dev_2.1.4-1+cuda9.0_amd64.deb
sudo apt-get update
sudo apt-get install cuda=9.0.176-1
sudo apt-get install libcudnn7-dev
sudo apt-get install libnccl-dev
..


Add below code the end of ./bashrc file
..
export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
..

And reboot.


refer to here : https://yangcha.github.io/CUDA90/


Linux wifi driver on Mac device

just input this command


sudo apt-get update
sudo apt-get install firmware-b43-installer

Tip, uninstall virtualbox on ubuntu


find virtualbox s/w

$> dpkg -l | grep virtualbox

the name is depends on your installation name

uninstall virtualbox
$> sudo apt-get remove --purge virtualbox-5.2


Install sublime text 3 on ubuntu using console command

Open terminal (control + alt + T) and follow below command


...
1. run command to install the key
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -


2. add the apt repository via command
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list


3. install
sudo apt-get update
sudo apt-get install sublime-text


4. uninstall
sudo apt-get remove sublime-text && sudo apt-get autoremove

..

refer to this page : http://tipsonubuntu.com/2017/05/30/install-sublime-text-3-ubuntu-16-04-official-way/


Thank you.

6/23/2018

string = string + int + string, simple source code

^^ memo

...
std::stringstream ss;
ss << "test" << index << ".png";
//stringstream to string
string s = ss.str(); 
...

6/22/2018

eclipse install

before to install
input below command in terminal

$> sudo apt-get install openjdk-8-jdk

and 

click or run "eclipse-inst"

then you can see installer

 

opencv 2.4.9 install on ubuntu


refer to this GitHub page : https://gist.github.com/smithjessk/bde98ec9297b38bad40c

save sh file, for example opencv249.sh
...
# Install OpenCV 2.4.9 for Ubuntu
# Derived from https://github.com/jayrambhia/Install-OpenCV/blob/master/Ubuntu/2.4/opencv2_4_8.sh

# @author Jess Smith <smith.jessk@gmail.com>
# @license MIT

arch=$(uname -m)
if [ "$arch" == "i686" -o "$arch" == "i386" -o "$arch" == "i486" -o "$arch" == "i586" ]; then
flag=1
else
flag=0
fi

echo "Installing OpenCV 2.4.9"
mkdir OpenCV
cd OpenCV

echo "Removing any pre-installed ffmpeg and x264"
sudo apt-get -y remove ffmpeg x264 libx264-dev

echo "Installing Dependenices"
sudo apt-get -y install libopencv-dev
sudo apt-get -y install build-essential checkinstall cmake pkg-config yasm
sudo apt-get -y install libtiff4-dev libjpeg-dev libjasper-dev
sudo apt-get -y install libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev
sudo apt-get -y install python-dev python-numpy
sudo apt-get -y install libtbb-dev
sudo apt-get -y install libqt4-dev libgtk2.0-dev
sudo apt-get -y install libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev
sudo apt-get -y install x264 v4l-utils ffmpeg
sudo apt-get -y install libgtk2.0-dev

echo "Downloading OpenCV 2.4.9"
wget -O OpenCV-2.4.9.zip http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.9/opencv-2.4.9.zip/download

echo "Installing OpenCV 2.4.9"
unzip OpenCV-2.4.9.zip
cd opencv-2.4.9
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
make -j4
sudo make install
sudo sh -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
sudo ldconfig

echo "OpenCV 2.4.9 ready to be used"
...

and input command

$> chmod +x opencv249.sh
$> ./opencv249.sh

That's all ^^

Ubuntu C++ OpenCV version Check

version check
 $ pkg-config --modversion opencv

Package check
 $ pkg-config --libs opencv

path check
 $ pkg-config --cflags opencv

for example:
...
19:42 ~ $ pkg-config --modversion opencv                                                                                                 
2.4.9
19:42 ~ $ pkg-config --libs opencv                                                                                                       
/usr/local/lib/libopencv_calib3d.so /usr/local/lib/libopencv_contrib.so /usr/local/lib/libopencv_core.so /usr/local/lib/libopencv_features2d.so /usr/local/lib/libopencv_flann.so /usr/local/lib/libopencv_gpu.so /usr/local/lib/libopencv_highgui.so /usr/local/lib/libopencv_imgproc.so /usr/local/lib/libopencv_legacy.so /usr/local/lib/libopencv_ml.so /usr/local/lib/libopencv_nonfree.so /usr/local/lib/libopencv_objdetect.so /usr/local/lib/libopencv_ocl.so /usr/local/lib/libopencv_photo.so /usr/local/lib/libopencv_stitching.so /usr/local/lib/libopencv_superres.so /usr/local/lib/libopencv_ts.a /usr/local/lib/libopencv_video.so /usr/local/lib/libopencv_videostab.so -ltbb -lrt -lpthread -lm -ldl  
19:42 ~ $ pkg-config --cflags opencv                                                                                                     
-I/usr/local/include/opencv -I/usr/local/include 
...

6/21/2018

String split by delimiter (c++/c)

refer to souce code

...
void CForeAndBack::getStrings(string csvFname, vector<string> eachStr, string delimiter)
{
    //parsing
    size_t pos = 0;
    while ((pos = csvFname.find(delimiter)) != std::string::npos) {
        string token = csvFname.substr(0, pos);
        std::cout << token << std::endl;
        eachStr.push_back(token);
        csvFname.erase(0, pos + delimiter.length());
    }
    std::cout << csvFname << std::endl;
    eachStr.push_back(csvFname);
}
...


6/20/2018

make folder in the c code

simple example code

..
#include <direct.h>

..
string outputFolder = "output";
_mkdir(outputFolder.c_str());
..
..

6/18/2018

TCHAR to string

simple sample code

...
TCHAR buff[1024];
///
///..something to do
///
wstring test(&buff[0]); //convert to wstring
string strFolder(test.begin(), test.end()); //and convert to string.
...