This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <sstream> | |
#include <iomanip> | |
int main() { | |
for (int i = 0; i < 10; ++i) { | |
std::stringstream ss; | |
ss << std::setfill('0') << std::setw(8) << std::fixed << i << ".txt"; | |
std::cout << ss.str() << std::endl; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pypcd | |
filepath='hesai_pandar40p_1593421778.828716.pcd' | |
pc = pypcd.PointCloud.from_path(filepath) | |
points = [] | |
for pt in pc.pc_data: | |
points.append([pt[0], pt[1], pt[2], 0.0]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://www.varsitytutors.com/hotmath/hotmath_help/topics/line-of-best-fit.html | |
double CalcLineSlope(const std::vector<double>& x, | |
const std::vector<double>& y) { | |
const auto n = x.size(); | |
const auto s_x = std::accumulate(x.begin(), x.end(), 0.0); | |
const auto s_y = std::accumulate(y.begin(), y.end(), 0.0); | |
const auto s_xx = std::inner_product(x.begin(), x.end(), x.begin(), 0.0); | |
const auto s_xy = std::inner_product(x.begin(), x.end(), y.begin(), 0.0); | |
const auto slope = (n * s_xy - s_x * s_y) / (n * s_xx - s_x * s_x); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <string> | |
#include <algorithm> | |
void print_vec(std::vector<int> &vec) { | |
for (auto x : vec) { | |
std::cout << x << " "; | |
} | |
std::cout << "\n"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// reference: https://ddorobot.tistory.com/entry/OpenCV-Draw-DotDash-Line | |
#include <iostream> | |
#include <vector> | |
#include <string> | |
#include <algorithm> | |
#include "opencv2/opencv.hpp" | |
void DrawDashedLine(cv::Mat& img, cv::Point pt1, cv::Point pt2, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
""" | |
{Description} | |
""" | |
from __future__ import print_function | |
import os | |
import sys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from __future__ import print_function | |
import os | |
import sys | |
import argparse | |
import cv2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/profile.d/alias.sh | |
# https://www.cyberciti.biz/tips/bash-aliases-mac-centos-linux-unix.html | |
## ls command | |
alias ls='ls --color=auto' | |
alias wl='ls | wc -l' | |
alias l='ls -l --color=auto' | |
alias lh='ls -lh --color=auto' | |
alias ll='ls -la --color=auto' # use a long listing format |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <sstream> | |
#include <iomanip> | |
#include <string> | |
// e.g. 1584773265.928826 | |
std::stringstream oss; | |
oss << std::setfill('0') << std::setw(17) << std::fixed | |
<< std::setprecision(6) << timestamp << ".png"; | |
std::string filename = oss.str(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
#include <string> | |
// e.g. ./main data_tracking_velodyne/testing/velodyne/0000/000000.bin | |
int main(int argc, char **argv) { | |
if (argc != 2) { | |
std::cerr << "Usage: " << argv[0] << " <filepath>\n"; | |
return 1; | |
} |