原创 調試段錯誤Segmentation fault (core dumped)打印詳細報錯信息

在進行C/C++相關開發時候,經常會遇到段錯誤,這個時候比較無語的一點就是終端幾乎不會輸出太多有用的信息,大多數情況下打印信息如下: Segmentation fault (core dumped) 有大佬專門開發了一款工具,叫

原创 Rust高精度毫秒/微妙/納秒計時器

直接上代碼 use std::time::Instant; // timer fn main() { let start = Instant::now(); //even number range in[0,

原创 C語言按照逗號截取char數組的內容

#include <stdio.h> #include <string.h> int main () { char str[] ="1,2,99009,33455,t565,3"; printf ("Splitting

原创 soft-nms的C++實現

出處:nms.cc #include <bits/stdc++.h> namespace nms { struct proposal { float score, x1, y1, x2, y2; }; inline sta

原创 基於OpenCV的四元數、旋轉矩陣和歐拉角互相轉換(一)

這部分代碼我摘自於google中搜索出來的博客,當然,在格式或者風格上不太統一。如果你想看到更純粹的OpenCV版本,請戳基於OpenCV的四元數、旋轉矩陣和歐拉角互相轉換(二)。 四元數轉旋轉矩陣 void getRotatio

原创 基於OpenCV的四元數、旋轉矩陣和歐拉角互相轉換(二)

此處的代碼都會有雙版本:第一個版本假設輸入是float數組,第二個版本假設輸入是cv::Mat矩陣。 #include <cstdlib> #include <cstdio> #include <cmath> #include <

原创 linux下統計文件夾下文件、文件夾的個數

本文系轉載,原始出處:http://blog.sina.com.cn/s/blog_464f6dba01012vwv.html 統計當前文件夾下文件的個數(不包括目錄) ls -l |grep "^-"|wc -l 統計當前文件夾

原创 undefined reference to strrev 解決方案

其實strrev這個函數不是系統庫裏面的,編譯器不自帶,要是出現undefined reference to strrev這個報錯怎麼辦呢,那就自己寫一個嘍,😀 #include <stdio.h> #include <strin

原创 Python查看兩張圖差異

#coding=utf-8 from PIL import Image import math import operator from functools import reduce def compare(pic1,pic

原创 單張圖根據座標提取多個mask

三個矩形區域,已經設置有座標,提取後背景黑色,mask區域白色,且三個mask都在最後的final.png內。 #include "opencv2/highgui/highgui.hpp" #include "opencv2/im

原创 斐波那契數列的Rust解法(遞歸和非遞歸)

遞歸解法 fn fib(n:i32) -> i32{ if(n < 0){ panic!("input can not be less than zero!"); } else if(n

原创 Windows下安裝PyTorch1.0

更新提醒:本文已過期,PyTorch1.5正式版已在2020年4月21發佈,Windows下安裝最新的PyTorch1.5請移步本人另一篇博客:Windows下安裝PyTorch1.5。 PyTorch簡介 在2017年1月18日

原创 C語言讀取txt統計逗號或特定字符的個數

#include <stdio.h> #include <dirent.h> #include <unistd.h> #include <stdlib.h> #include <sys/types.h> #include <dir

原创 C++ #pragma pack指令簡析

微軟官方文檔說#pragma pack 指令的作用是爲結構、聯合和類成員指定 pack 對齊。的主要作用就是改變編譯器的內存對齊方式,這個指令在網絡報文的處理中有着重要的作用,#pragma pack(n)是他最基本的用法,其作用

原创 Rust從入門到高級(一):Rust開發環境從安裝到卸載

Rust Playground 如果只是寫Demo測試,嘗試下 Rust,可以無需安裝Rust開發環境,直接在Rust Playground運行自己代碼。 開發環境安裝 強烈不建議各位童鞋使用Windows學習和開發Rust,如果