linux下c++學習筆記——c++編譯執行
阿新 • • 發佈:2019-01-04
c++編譯執行
預處理
合併多個單張圖片的txt檔案為一個訓練txt
cat *.txt > train.txt
替換檔案中的特定字串(將’80 '替換為’1 ')
// find "file"|xargs perl -pi -e 's|old|new|g'
find "train.txt"|xargs perl -pi -e 's|80 |1 |g'
zip -r filename.zip filename
unzip -o -d /home/crj/WassersteinGAN-pytorch WassersteinGAN-pytorch. zip
tar –xvf file.tar //解壓 tar包
tar -xzvf file.tar.gz //解壓tar.gz
unrar e file.rar //解壓rar
以目前所用的標定code為例,記錄過程。
(1)批處理影象生成檔名的txt檔案。
find -name "*.jpg" > imagesname.txt
find filepath -name "*.jpg" > imagesname.txt
儲存在當前文件中,實現生成
find /home/crj/calibration/images/ -name "*.jpg" > imagename.txt
(2)安裝opencv
參考: https://blog.csdn.net/gxuphf123/article/details/81121791
(3)編譯執行.cpp檔案
// opencv下的編譯
g++ `pkg-config --cflags opencv` -o calibration calibration.cpp `pkg-config --libs opencv`
./calibration
// 普通環境下的編譯
g++ -o hello hello.cpp
./hello