aihot  2017-05-10 21:40:00  OpenCV |   查看评论   
/* 计算bin图像。 使用xsobel和ysobel图像来计算每个像素处的梯度和幅度。{Magnitude = sqrt(sq(xsobel) + sq(ysobel) ), gradient = itan (ysobel/xsobel) }。 然后根据梯度的方向,设置相应图像中相应像素的值 */  
  •   
  •     int x, y;  
  •     float temp_gradient, temp_magnitude;  
  •     for (y = 0; y < in->height; y++) {  
  •   
  • /* ptr1和ptr2分别指向xsobel和ysobel图像中当前行的开头。 ptrs指向bin图像中当前行的开头 */  
  •   
  •         float* ptr1 = (float*) (xsobel->imageData + y * (xsobel->widthStep));  
  •         float* ptr2 = (float*) (ysobel->imageData + y * (ysobel->widthStep));  
  •         float** ptrs = (float**) malloc(9 * sizeof(float*));  
  •         for (int i = 0; i < 9 ;i++){  
  •             ptrs[i] = (float*) (bins[i]->imageData + y * (bins->widthStep));  
  •         }  
  •   
  • /*对于行中的每个像素,计算梯度取向和幅度,并为bin图像设置相应的值. */  
  •  

    除特别注明外,本站所有文章均为 赢咖4注册 原创,转载请注明出处来自使用opencv作物件识别 —— 积分直方图加速HOG特征计算

    留言与评论(共有 0 条评论)
       
    验证码:
    [lianlun]1[/lianlun]