Skip to content

Instantly share code, notes, and snippets.

View MareArts's full-sized avatar

MareArts MareArts

View GitHub Profile
@MareArts
MareArts / calHistforGrayImage.cpp
Last active December 29, 2017 00:16
To make histogram for gray image
http://study.marearts.com/2017/12/calchist-for-rgb-image-opencv-histogram.html
#include "opencv2/opencv.hpp"
#include "opencv2\highgui.hpp"
#include <iostream>
#ifdef _DEBUG
#pragma comment(lib, "opencv_core331d.lib")
#pragma comment(lib, "opencv_highgui331d.lib")
#pragma comment(lib, "opencv_imgcodecs331d.lib")
@MareArts
MareArts / BinaryHistogram.cpp
Last active December 28, 2017 18:04
Feature extraction using histogram
http://study.marearts.com/2013/09/opencv-make-histogram-and-draw-example.html
#include "opencv2/opencv.hpp"
#include "opencv2\highgui.hpp"
#include <iostream>
#ifdef _DEBUG
#pragma comment(lib, "opencv_core331d.lib")
#pragma comment(lib, "opencv_highgui331d.lib")
@MareArts
MareArts / makeHistogram_withoutOpencv.cpp
Last active December 28, 2017 20:41
OpenCV Lecture, histogram example source code.
http://study.marearts.com/2017/12/gray-image-histogram-without-opencv.html
#include "opencv2/opencv.hpp"
#include "opencv2\highgui.hpp"
#include <iostream>
#ifdef _DEBUG
#pragma comment(lib, "opencv_core331d.lib")
#pragma comment(lib, "opencv_highgui331d.lib")
@MareArts
MareArts / Histogram_cam.cpp
Last active October 19, 2017 09:26
Cam Histogram Test
http://study.marearts.com/2017/10/webcam-histogram-test-opencv.html
#include "opencv2/opencv.hpp"
#include "opencv2\cudaarithm.hpp"
#include <iostream>
#include <time.h>
#ifdef _DEBUG
#pragma comment(lib, "opencv_core320d.lib")
@MareArts
MareArts / ice_waldboost.cpp
Last active October 2, 2017 18:43
ICF(Integral Channel Features) + WaldBoost example (opencv, ICFDetector uses example) - step3 (detection part)
void main()
{
cv::xobjdetect::ICFDetector icf_detector;
// model loading
cv::FileStorage cvfs("icf_model.txt", cv::FileStorage::READ);
icf_detector.read(cvfs["icf"]);
// test image
@MareArts
MareArts / ICF_waldboost.cpp
Created October 2, 2017 18:41
ICF(Integral Channel Features) + WaldBoost example (opencv, ICFDetector uses example) - step 0
int main(int, char)
{
int showOrno = 1;
FILE* fp1;
fopen_s(&fp1, "positive.txt", "w");
int n = 1500; //positive data count
char str[100];
//char str1[100] = "M:\\____videoSample____\\Pedestrian\\6464\\"; //base path
char str1[100] = "M:\\____videoSample____\\Pedestrian\\"; //base path
@MareArts
MareArts / ICF_WaldBoost.cpp
Last active October 2, 2017 18:44
ICF(Integral Channel Features) + WaldBoost example (opencv, ICFDetector uses example) - step1 (learning)
http://study.marearts.com/2016/01/icfintegral-channel-features-waldboost.html
void main()
{
cv::String pos_list = "positive.txt"; // positive image list
cv::String neg_list = "negative.txt"; // negative image list
//cv::String pos_list = "poslist.txt"; // positive image list
//cv::String neg_list = "neglist.txt"; // negative image list
@MareArts
MareArts / twoImageStitching.cpp
Created September 30, 2017 18:54
Two Image mosaic (paranoma) based on SIFT / C++ source
http://study.marearts.com/2011/08/two-image-mosaic-paranoma-based-on-sift.html?showComment=1505809273523#c4127439791336787413
#include < iostream>
#include < cv.h>
#include < cxcore.h>
#include < highgui.h>
using namespace std;
@MareArts
MareArts / overlapPercent.cpp
Last active August 29, 2020 07:42
openCV Tip, Calculate overlap percent between two rectangle.
http://study.marearts.com/2017/09/opencv-tip-calculate-overlap-percent.html
Mat canvas(100, 100, CV_8UC3);
canvas.setTo(0);
Rect rectA(10, 5, 50, 60);
Rect rectB(40,40,30, 40);
Rect andRect_overlap = (rectA & rectB);
Rect orRect_whole = (rectA | rectB);
cout << "rect A info. : " << rectA << endl;
@MareArts
MareArts / checkZeroOpenCV.cpp
Last active September 24, 2017 16:09
Tip, How to count number of '0' in element of Matrix(Mat)?
http://study.marearts.com/2017/09/tip-how-to-count-number-of-0-in-element.html
Mat a = Mat(5, 5, CV_8UC1);
randn(a, 0, 1);
Mat b = (a == 0) / 255;
Mat c = (a > 0) / 255;
cout << "Input matrix matrix a = " << endl;
cout << a << endl;