Skip to content

Instantly share code, notes, and snippets.

View ollewelin's full-sized avatar

Olle Welin ollewelin

View GitHub Profile
//File: test_prog.cpp
//Generate a bg.txt file how work with raspberry pi for opencv_traincascade
#include <stdio.h>
//Olle Welin [email protected]
main() {
FILE *fp;
printf("Generate a bg.txt file how work with raspberry pi for opencv_traincascade \n");
fp = fopen("bg.txt", "w+");
for(int i=0;i < 1000; i++)
#####################################
cmake_minimum_required (VERSION 2.8)
project (raspicam_test)
set(CMAKE_MODULE_PATH "/usr/local/lib/cmake/${CMAKE_MODULE_PATH}")
find_package(raspicam REQUIRED)
find_package(OpenCV)
IF ( OpenCV_FOUND AND raspicam_CV_FOUND)
MESSAGE(STATUS "COMPILING OPENCV TESTS")
SET_SOURCE_FILES_PROPERTIES( gpio_test.c PROPERTIES LANGUAGE CXX )
//Generate info.txt
//File: test_prog.cpp
#include <stdio.h>
//Olle Welin [email protected]
main() {
FILE *fp;
printf("Generate a info.txt file to positive image how work with raspberry pi for opencv_traincascade \n");
fp = fopen("info.txt", "w+");
for(int i=0;i < 2000; i++)
#####################################
cmake_minimum_required (VERSION 2.8)
project (raspicam_test)
set(CMAKE_MODULE_PATH "/usr/local/lib/cmake/${CMAKE_MODULE_PATH}")
find_package(raspicam REQUIRED)
find_package(OpenCV)
IF ( OpenCV_FOUND AND raspicam_CV_FOUND)
MESSAGE(STATUS "COMPILING OPENCV TESTS")
SET_SOURCE_FILES_PROPERTIES( gpio_test.c PROPERTIES LANGUAGE CXX )
pos0.JPG 1 0 0 128 96
pos1.JPG 1 0 0 128 96
pos2.JPG 1 0 0 128 96
pos3.JPG 1 0 0 128 96
pos4.JPG 1 0 0 128 96
pos5.JPG 1 0 0 128 96
pos6.JPG 1 0 0 128 96
pos7.JPG 1 0 0 128 96
pos8.JPG 1 0 0 128 96
pos9.JPG 1 0 0 128 96
./0.JPG
./1.JPG
./2.JPG
./3.JPG
./4.JPG
./5.JPG
./6.JPG
./7.JPG
./8.JPG
./9.JPG
opencv_createsamples -info info.txt -num 2000 -w 32 -h 24 -vec logo.vec -maxxangle 2.0 -maxyangle 2.0 -maxzangle 2.0 -maxidev 800 -bgthresh 160
opencv_createsamples -vec logo.vec -w 32 -h 24
opencv_traincascade -data data -vec logo.vec -bg bg.txt -precalcValBufSize 768 -precalcIdxBufSize 768 -numPos 1900 -numNeg 1000 -numStages 8 -w 32 -h 24 -featureType LBP -mode ALL -maxFalseAlarmRate 0.1
//File: simpletest_raspicam_cv.cpp now swapped BGR to RGB source
//Will test Trained Cascade Object detection
#include <opencv2/highgui/highgui.hpp> // OpenCV window I/O
#include <opencv2/imgproc/imgproc.hpp> // Gaussian Blur
#include <stdio.h>
#include <raspicam/raspicam_cv.h>
#include <opencv2/opencv.hpp>
#include "gpio_test.h"
#include <bcm2835.h>
//Generate Positive samples BGR RGB swapped don't know why this was default OpenCV must have changed on my raspbeery pi suddenly after //some updates
//File: test_prog.cpp
//You must make a director /positive_data/ where this program could put the pictures in
#include <stdio.h>
#include <unistd.h>
#include <ctime>
#include <iostream>
#include <raspicam/raspicam_cv.h>
#include <opencv2/opencv.hpp>
//Generate Negative samples BGR RGB swapped don't know why this was default OpenCV must have changed on my raspbeery pi suddenly after some updates
//File: test_prog.cpp
//You must make a director /positive_data/ where this program could put the pictures in
#include <stdio.h>
#include <ctime>
#include <iostream>
#include <raspicam/raspicam_cv.h>
#include <opencv2/opencv.hpp>