Skip to content

Instantly share code, notes, and snippets.

View SubhiH's full-sized avatar

Soubhi Hadri SubhiH

View GitHub Profile
@SubhiH
SubhiH / main.cpp
Created December 21, 2018 00:28
ImageOperator class
class ImageOperator{
public:
ImageOperator() = default;
~ImageOperator() = default;
static void to_gray_m1(const cv::Mat& input, cv::Mat& output);
static void to_gray_m2(const cv::Mat& input, cv::Mat& output);
static void to_gray_m3(const cv::Mat& input, cv::Mat& output);
static void to_gray(const unsigned char* input,
const int width,
@SubhiH
SubhiH / main.cpp
Created December 20, 2018 21:49
Read streaming from camera and show RGB and Gray images
#include <iostream>
#include "opencv2/opencv.hpp"
int main() {
cv::VideoCapture cam(0);
if (!cam.isOpened()) {
throw std::runtime_error("Error");
}
cv::namedWindow("Window");
@SubhiH
SubhiH / ViewController.swift
Created March 4, 2018 15:54
Face detection
import UIKit
class ViewController: UIViewController, FrameExtractorDelegate {
@IBOutlet var imageview: UIImageView!
var frameExtractor: FrameExtractor!
func captured(image: UIImage) {
imageview.image = OpencvWrapper.detect(image);
}
#import "OpencvWrapper.h"
@SubhiH
SubhiH / PrefixHeader.pch
Created March 4, 2018 15:51
Face detection
#ifndef PrefixHeader_pch
#define PrefixHeader_pch
// Include any system framework and library headers here that should be included in all compilation units.
// You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.
#ifdef __cplusplus
#include <opencv2/opencv.hpp>
#endif
#endif /* PrefixHeader_pch */
@SubhiH
SubhiH / OpencvWrapper.mm
Created March 4, 2018 15:45
Face detection
#import "OpencvWrapper.h"
#import <opencv2/opencv.hpp>
#import <opencv2/objdetect/objdetect.hpp>
#import <opencv2/objdetect.hpp>
@implementation OpencvWrapper
cv::CascadeClassifier face_cascade;
cv::CascadeClassifier eyes_cascade;
bool cascade_loaded = false;
@SubhiH
SubhiH / OpencvWrapper.h
Created March 4, 2018 15:43
Face detection
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface OpencvWrapper : NSObject
+ (UIImage *)detect:(UIImage *)source;
@end