©SIProp Project, 2006-2008 1 How to Make Hand Detector Noritsuna Imamura

Slides:



Advertisements
Similar presentations
Advanced Image Processing Student Seminar: Lipreading Method using color extraction method and eigenspace technique ( Yasuyuki Nakata and Moritoshi Ando.
Advertisements

Automatic Color Gamut Calibration Cristobal Alvarez-Russell Michael Novitzky Phillip Marks.
Pose Estimation and Segmentation of People in 3D Movies Karteek Alahari, Guillaume Seguin, Josef Sivic, Ivan Laptev Inria, Ecole Normale Superieure ICCV.
Histograms of Oriented Gradients for Human Detection
CS Spring 2009 CS 414 – Multimedia Systems Design Lecture 4 – Digital Image Representation Klara Nahrstedt Spring 2009.
Image Transforms 主講人:虞台文. Content Overview Convolution Edge Detection – Gradients – Sobel operator – Canny edge detector – Laplacian Hough Transforms.
Science Afternoon at NIST Scanning Electron Microscopy (SEM) Brad Damazo, Prem Kavuri, Bin Ming, Kate Klein and Andras Vladar Nanometer Scale Metrology.
Histograms and Matching 主講人:虞台文. Content Overview Basic Histogram Structure Accessing Histograms Basic Manipulations with Histograms Color Spaces Histogram.
Computer Vision Chapter 6 Color.
Gavin S Page OpenCV Tutorial Part II Loading Images and Using Histograms 29 November 2005.
Lecture 07 Segmentation Lecture 07 Segmentation Mata kuliah: T Computer Vision Tahun: 2010.
Creating a Histogram using the Histogram Function.
COLORCOLOR A SET OF CODES GENERATED BY THE BRAİN How do you quantify? How do you use?
Each pixel is 0 or 1, background or foreground Image processing to
מערכות לבדיקת איכות חקלאיות: מערכת למיון פרחים מערכת לזיהוי ירקות הטכניון - מכון טכנולוגי לישראל : הפקולטה להנדסת חשמל - המעבדה לבקרה ורובוטיקה מגישים:
Face Detection: a Survey Speaker: Mine-Quan Jing National Chiao Tung University.
Canny Edge Detector1 1)Smooth image with a Gaussian optimizes the trade-off between noise filtering and edge localization 2)Compute the Gradient magnitude.
Robot Homing Workshop.
Objective of Computer Vision
A Real-Time for Classification of Moving Objects
01/31/02 (C) 2002, UNiversity of Wisconsin, CS 559 Last Time Color and Color Spaces.
L.
Bitmapped Images. Bitmap Images Today’s Objectives Identify characteristics of bitmap images Resolution, bit depth, color mode, pixels Determine the most.
Harris detector Convert image to greyscale Apply Gaussian convolution to blur the image and remove noise Calculate gradient of image in x and y direction.
05 - Feature Detection Overview Feature Detection –Intensity Extrema –Blob Detection –Corner Detection Feature Descriptors Feature Matching Conclusion.
Detect Candle.  Open VC++ Directories configuration: Tools > Options > Projects and Solutions > VC++ Directories  Choose "Show directories for: Include.
CAP 5415 Computer Vision Fall 2004
Edge Detection (with implementation on a GPU) And Text Recognition (if time permits) Jared Barnes Chris Jackson.
CS 6825: Binary Image Processing – binary blob metrics
JRN 440 Adv. Online Journalism Resizing and resampling Monday, 2/6/12.
L. Akshay Masare Piyush Awasthi IMAGE PROCESSING AND OPENCV.
Joon Hyung Shim, Jinkyu Yang, and Inseong Kim
An Efficient Search Strategy for Block Motion Estimation Using Image Features Digital Video Processing 1 Term Project Feng Li Michael Su Xiaofeng Fan.
Vision Geza Kovacs Maslab Colorspaces RGB: red, green, and blue components HSV: hue, saturation, and value Your color-detection code will be more.
1 Eye Detection in Images Introduction To Computational and biological Vision Lecturer : Ohad Ben Shahar Written by : Itai Bechor.
Kylie Gorman WEEK 1-2 REVIEW. CONVERTING AN IMAGE FROM RGB TO HSV AND DISPLAY CHANNELS.
Machine Vision Introduction to Using Cognex DVT Intellect.
` Tracking the Eyes using a Webcam Presented by: Kwesi Ackon Kwesi Ackon Supervisor: Mr. J. Connan.
PROJECT#3(b) Astrocyte Analysis
+ Speed Up Texture Classification in Clothing Retrieval System 電機三 吳瑋凌.
By Pushpita Biswas Under the guidance of Prof. S.Mukhopadhyay and Prof. P.K.Biswas.
1 Overview representing region in 2 ways in terms of its external characteristics (its boundary)  focus on shape characteristics in terms of its internal.
CS Spring 2010 CS 414 – Multimedia Systems Design Lecture 4 – Audio and Digital Image Representation Klara Nahrstedt Spring 2010.
Machine Vision Edge Detection Techniques ENT 273 Lecture 6 Hema C.R.
Filtering the Images.  Filtering images using low-pass filters  Filtering images using a median filter  Applying directional filters to detect edges.
EE368: Digital Image Processing Bernd Girod Leahy, p.1/15 Face Detection on Similar Color Images Scott Leahy EE368, Stanford University May 30, 2003.
Course 3 Binary Image Binary Images have only two gray levels: “1” and “0”, i.e., black / white. —— save memory —— fast processing —— many features of.
Chapter 6 Skeleton & Morphological Operation. Image Processing for Pattern Recognition Feature Extraction Acquisition Preprocessing Classification Post.
Introduction To Computational and Biological Vision Max Binshtok Ohad Greenshpan March 2006 Shot Detection in video.
Digital Basics Quiz Preparation. Basic Digital Image Concepts Aliasing & Anti‐aliasing Resolution Compression Raster & Vector Color mode & Image mode.
LOGO FACE DETECTION APPLICATION Member: Vu Hoang Dung Vu Ha Linh Le Minh Tung Nguyen Duy Tan Chu Duy Linh Uong Thanh Ngoc CAPSTONE PROJECT Supervisor:
Over the recent years, computer vision has started to play a significant role in the Human Computer Interaction (HCI). With efficient object tracking.
Cell-counting with ImageJ
Georgia Institute of Technology
1-Introduction (Computing the image histogram).
A Quick Introduction to the C Interface By David Johnston
Histogram—Representation of Color Feature in Image Processing Yang, Li
Barb Ericson Georgia Institute of Technology August 2005
A Tutorial on HOG Human Detection
Graphics (Characteristics 1)
Presentation Zach Robertson.
Georgia Institute of Technology
Higher School of Economics , Moscow, 2016
License Plate Recognition OpenCV3.1 Application Jacky Le 7Sep2016.
Presentation 4 Zach Robertson.
Harris detector Convert image to greyscale
Canny Edge Detector Smooth image with a Gaussian
7th Annual STEMtech conference
Higher School of Economics , Moscow, 2016
Presentation transcript:

©SIProp Project, How to Make Hand Detector Noritsuna Imamura

©SIProp Project, Agenda Preparing Benchmark How to Load Files on NativeActivity How to Make Hand Detector Calculate Histgram of Skin Color Detect Skin Area from CapImage Calculate the Largest Skin Area Matching Histgrams

©SIProp Project, Hand Detector

©SIProp Project, Chart of Hand Detector Calc Histgram of Skin Color Detect Skin Area from CapImage Calc the Leargest Skin Area Match HistgramsHistgramLabelingConvex Hull Feature Point Distance

©SIProp Project, Mat vs IplImage Benchmark

©SIProp Project, About Mat & IplImage cv::Mat Version 2.x and Upper Written by C++ Advantage Easy to Use Faster IplImage Version 1.x and Upper Written by C Advantage Many Documents 1.IplImage* img; 2.for(int h = 0; h height; h++) { 3.for(int w = 0; w width; w++){ 4.img->imageData[img- >widthStep * h + w * 3 + 0]=0;//B 5.img->imageData[img- >widthStep * h + w * 3 + 1]=0;//G 6.img->imageData[img- >widthStep * h + w * 3 + 2]=0;//R 7.} 8.} 1.cv::Mat_ img; 2.for (int r = 0; r < img.rows; r++ ) { 3.for(int c = 0; c < img.cols; c++ ) { 4.cv::Vec3b &v = img.at (r,c); 5.v[0] = 0;//B 6.v[1] = 0;//G 7.v[2] = 0;//R 8.} 9.}

©SIProp Project, Benchmark on Android Gray Scale

©SIProp Project, How to Load File on NativeActivity

©SIProp Project, AssetManager “assets” dir is your resource file dir on Android “res”(resource) dir is also same. But the file that is there is made “Resource ID” by R file. Ex. I18n How to Use NDK with Java AAssetManager Class (C++) NativeActivity No Way……

©SIProp Project, libassetmanager assetmanager.h int setupAsset(const char *package_name); Copy "assets" directory from APK file to under "/data/data/[Package Name]" directory. int loadAseetFile(const char *package_name, const char *load_file_name); Copy File of "load_file_name" from APK file to under "/data/data/[Package Name]/assets" directory. 1.createAssetFile("assets/images/skincolorsample.jpg "); 2.sprintf(file_path, "%s/%s/%s", DATA_PATH, PACKAGE_NAME, "assets/images/skincolorsample.jpg"); 3.skin_color_sample = cvLoadImage(file_path);

©SIProp Project, How to Make Hand Detector

©SIProp Project, Hand Detector

©SIProp Project, Chart of Hand Detector Calc Histgram of Skin Color Detect Skin Area from CapImage Calc the Largest Skin Area Matching Histgrams HistgramConvex HullLabeling Feature Point Distance

©SIProp Project, Calculate Histgram of Skin Color

©SIProp Project, What’s Histgram? Frequency Distribution Chart. Why Use it? For Checking Skin Color. Each people’s Skin Color is NOT same. One of Leveling algorithm.

©SIProp Project, Step 1/2 Convert RGB to HSV RGB color is changed by Light Color. Hue Saturation/Chroma Value/Lightness/Brightness 1.cvCvtColor( src, hsv, CV_BGR2HSV ); 2.IplImage* h_plane = cvCreateImage( size, IPL_DEPTH_8U, 1 ); 3.IplImage* s_plane = cvCreateImage( size, IPL_DEPTH_8U, 1 ); 4.IplImage* v_plane = cvCreateImage( size, IPL_DEPTH_8U, 1 );

©SIProp Project, Step 2/2 cvCreateHist(); Prameter Dimension of Histgram Size Type Range of limit Over limit Use or Not 1.IplImage* planes[] = { h_plane, s_plane }; 2.*hist = cvCreateHist(2, 3.hist_size, 4.CV_HIST_ARRAY, 5.ranges, 6.1); 7.cvCalcHist( planes, *hist, 0, 0 ); 8.cvMinMaxLoc(v_plane, vmin, vmax);

©SIProp Project, Detect Skin Area from CapImage

©SIProp Project, How to Get Skin Area? Use “Convex Hull” algorithm 1.Check Image From Left-Top. 2.Found Black Color Pixel is Start Point. 3.Search Black Pixel by Right Image. 4.Go to Black Pixel that First Found, this is next point. 5.Do 2-4 again, if back to Start Point, get Convex Hull. ※ Convert to Black-White Image

©SIProp Project, Step 1/3 Delete V(Lightness/Brightness) Color 1.Calculate Back Project Image by Skin Color Histgram. 2.Threshold by V(Lightness/Brightness) Color. 3.And Operation between Mask and Back Project. 4.Threshold to Back Project. (Adjustment) 1.cvCalcBackProject(planes, backProjectImage, hist); 2.cvThreshold(v_plane, maskImage, *v_min, *v_max, CV_THRESH_BINARY); 3.cvAnd(backProjectImage, maskImage, backProjectImage); 4.cvThreshold(backProjectImage, dstImage, 10, 255, CV_THRESH_BINARY);

©SIProp Project, Step 2/3 Noise Reduction 1.Erode (scale-down) 2.Dilate (scale-up) 1.cvErode(dstImage, dstImage, NULL, 1); 2.cvDilate(dstImage, dstImage, NULL, 1); 1/4

©SIProp Project, Step 3/3 Convex Hull cvFindContours(); Source Image Convex that is detected First Convex Pointer that detected 1.cvFindContours(dstImage, storage, &contours);

©SIProp Project, Calculate the Largest Skin Area

©SIProp Project, What’s Labeling? Labeling Area Marking Algorithm. 4-Connection 8-Connection

©SIProp Project, Labeling Algorithm 1/4 1, Scan Image by Raster 2, If you got a White Pixel, 1, Check Right Image Pixels 2, All “0”, Put the Latest Number + 1 in Pixel

©SIProp Project, Labeling Algorithm 2/4 1, If you got a White Pixel, 1, Check Right Image Orange Pixels 2, Not “0”, The Lowest Orange Pixels Number in Pixel

©SIProp Project, Labeling Algorithm 3/4 1, If got 2 more Number in Orange Pixeles, 1, Put The Lowest Number in Pixel, Change Other Numbers’ “Look up table” to The Lowest Number.

©SIProp Project, Labeling Algorithm 4/4 1, After finish, Check “Look up Table”. 1, If Dst is NOT Serial Number, Change to Serial Number 2, Src is changed Dst Number.

©SIProp Project, Get Area Size cvContourArea(); 1.for (CvSeq* c= contours; c != NULL; c = c- >h_next){ 2.double area = abs(cvContourArea(c, CV_WHOLE_SEQ)); 3.if (maxArea < area) { 4.maxArea = area; 5.hand_ptr = c; 6.} 7.}

©SIProp Project, Matching Histgrams

©SIProp Project, Matching Histgrams Histgram of Oriented Gradients (HoG) Split Some Area, And Calc Histgram of each Area.

©SIProp Project, Why Use HoG? Matching Hand Shape. Use Feature Point Distance with Each HoG.

©SIProp Project, Step 1/3 Calculate each Cell (Block(3x3) with Edge Pixel(5x5)) luminance gradient moment luminance gradient degree=deg 1.for(int y=0; y<height; y++){ 2.for(int x=0; x<width; x++){ 3.if(x==0 || y==0 || x==width-1 || y==height-1){ 4.continue; 5.} 6.double dx = img->imageData[y*img- >widthStep+(x+1)] - img->imageData[y*img->widthStep+(x-1)]; 7.double dy = img->imageData[(y+1)*img- >widthStep+x] - img->imageData[(y-1)*img->widthStep+x]; 8.double m = sqrt(dx*dx+dy*dy); 9.double deg = (atan2(dy, dx)+CV_PI) * / CV_PI; 10.int bin = CELL_BIN * deg/360.0; 11.if(bin < 0) bin=0; 12.if(bin >= CELL_BIN) bin = CELL_BIN-1; 13.hist[(int)(x/CELL_X)][(int)(y/CELL_Y)][bin] += m; 14.} 15.}

©SIProp Project, Step 2/3 Calculate Feature Vector of Each Block (Go to Next Page) 1.for(int y=0; y<BLOCK_HEIGHT; y++){ 2.for(int x=0; x<BLOCK_WIDTH; x++){ 3.//Calculate Feature Vector in Block 4.double vec[BLOCK_DIM]; 5.memset(vec, 0, BLOCK_DIM*sizeof(double)); 6.for(int j=0; j<BLOCK_Y; j++){ 7.for(int i=0; i<BLOCK_X; i++){ 8.for(int d=0; d<CELL_BIN; d++){ 9.int index = j*(BLOCK_X*CELL_BIN) + i*CELL_BIN + d; 10.vec[index] = hist[x+i][y+j][d]; 11.} 12.} 13.}

©SIProp Project, Step 3/3 (Continued) Normalize Vector Set Feature Vector 1.//Normalization of Vector 2.double norm = 0.0; 3.for(int i=0; i<BLOCK_DIM; i++){ 4.norm += vec[i]*vec[i]; 5.} 6.for(int i=0; i<BLOCK_DIM; i++){ 7.vec[i] /= sqrt(norm + 1.0); 8.} 9.//Put feat 10.for(int i=0; i<BLOCK_DIM; i++){ 11.int index = y*BLOCK_WIDTH*BLOCK_DIM + x*BLOCK_DIM + i; 12.feat[index] = vec[i]; 13.} 14.} 15.}

©SIProp Project, How to Calc Approximation Calc HoG Distance of each block Get Average.

©SIProp Project, Step 1/1 Calulate Feature Point Distance 1.double dist = 0.0; 2.for(int i = 0; i < TOTAL_DIM; i++){ 3.dist += fabs(feat1[i] - feat2[i])*fabs(feat1[i] - feat2[i]); 4.} 5.return sqrt(dist);