Skip to content

Instantly share code, notes, and snippets.

View MareArts's full-sized avatar

MareArts MareArts

View GitHub Profile
@MareArts
MareArts / STL_vector_erase_pop_test.cpp
Last active October 1, 2017 11:01
vector test for pop back and pop front
http://study.marearts.com/2017/06/stl-vector-test-for-pop-back-and-pop.html
#include "stdafx.h"
#include <vector>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
vector < int > a;
@MareArts
MareArts / OpenMP_test_sample_code.cpp
Last active June 19, 2018 17:52
OpenMP test code
http://study.marearts.com/2017/05/openmp-test-on-visual-studio.html
#include <stdio.h>
#include <time.h>
#include <omp.h> //for omp_get_thread_num()
void main()
{
/////////////////////////////////////////////////////////
printf("zero case : OpenMP Test (max thread:%d)\n ", omp_get_max_threads() );
int i;
http://study.marearts.com/2017/05/for-each-foreach-for-auto-concept-clean.html
#include <stdio.h>
#include <iostream>
#include <vector>
#include <time.h> //rand
#include <algorithm> //for_each
using namespace std;
#define N 10
@MareArts
MareArts / CalCheckSum.cpp
Last active May 16, 2017 05:43
two types of check sum calculation
http://study.marearts.com/2017/05/two-types-of-check-sum.html
//intel method
unsigned char CalcChecksum(unsigned char *data, int leng)
{
unsigned char csum;
csum = 0xFF;
for (; leng > 0; leng--)
csum += *data++;
@MareArts
MareArts / MatDataAccess.cpp
Created May 12, 2017 06:15
Mat data access
#include "opencv2/opencv.hpp"
using namespace cv;
using namespace std;
int main(int, char)
{
namedWindow("img", 1);
Mat img = imread("anapji.jpg");
@MareArts
MareArts / integral function.cpp
Last active May 1, 2017 11:44
integral function example
http://study.marearts.com/2017/05/opencv-integral-function-example-code.html
http://cvlecture.marearts.com/2017/05/opencv-lecture-5-6-integral.html
int main(int, char)
{
;
Mat img = Mat(10, 10, CV_8UC1);
randu(img, 0, 10);
cout << "origin" << endl << img << endl;
VideoCapture stream1(1); //0:note book, 1:usb webcam
Mat frame; //current frame
Mat gray, binary_otsu, binary_th, binary_ad_m, binary_ad_g;
namedWindow("img", 0);
namedWindow("otsu", 0);
namedWindow("binary_th", 0);
namedWindow("binary_adaptive_mean", 0);
@MareArts
MareArts / backgroundSubtraction.cpp
Last active October 13, 2017 22:41
background subtraction example based on opencv 3.2, GMG, MOG, MOG2, KNN
http://study.marearts.com/2017/04/opencv-background-subtraction-32.html
#include "opencv2\opencv.hpp"
#include "opencv2\bgsegm.hpp" //for MOG, GMG
#include <iostream>
#include <time.h>
#ifdef _DEBUG
#pragma comment(lib, "opencv_core320d.lib")
#pragma comment(lib, "opencv_highgui320d.lib")
@MareArts
MareArts / video_write.cpp
Last active April 18, 2017 06:25
video_write.cpp
http://study.marearts.com/2017/04/video-show-and-write-keeping-original.html
void main()
{
VideoCapture capture("rhinos.avi");
Mat frame;
//Set properties
int askFileTypeBox = 0; //-1 is show box of codec
@MareArts
MareArts / floodFill_test.cpp
Last active April 15, 2017 04:10
floodfill test
int click_x=0, click_y=0;
void CallBackFunc(int event, int x, int y, int flags, void* userdata)
{
if (event == EVENT_LBUTTONDOWN)
{
printf("lLBUTTONDOWN down %d, %d \n", x, y);
click_x = x;
click_y = y;