运行Adrian的线性二进制模式代码。该程序运行,但给出以下警告:
C:\Python27\lib\site-packages\sklearn\svm\base.py:922: ConvergenceWarning: Liblinear failed to converge, increase the number of iterations.
"the number of iterations.", ConvergenceWarning
Run Code Online (Sandbox Code Playgroud)
我在opencv3.7上运行python2.7,该怎么办?
我已经看到OpenCV提供了一个基于LBP 直方图的分类器:
但我希望能够访问LBP直方图本身.例如:
histogram = calculate_LBP_Histogram( image )
Run Code Online (Sandbox Code Playgroud)
是否有任何功能在OpenCV中执行此操作?
为了让我的iOS应用识别1€,2€和0.50€硬币我一直在尝试使用opencv_createsamples并opencv_traincascade创建我自己的classifier.xml.所以,我从一个短视频裁剪了60张2欧元硬币的图像,如下所示:
然后,我将它们与随机背景相结合使用opencv_createsamples.我获得了类似于此的12000张图片:
我运行了以下命令:
opencv_createsamples -img positives/i.jpg -bg negatives.txt -info i.txt -num 210 -maxidev 100 -maxxangle 0.0 -maxyangle 0.0 -maxzangle 0.9 -bgcolor 0 -bgthresh 0 -w 48 -h 48 (对于我从0到60)
cat *.txt > positives.txt
opencv_createsamples -info positives.txt -bg negatives.txt -vec 2.vec -num 12600 -w 48 -h 48
opencv_traincascade -data final -vec 2.vec -bg negatives.txt -numPos 12000 -numNeg 3000 -numStages 20 -featureType LBP -precalcValBufSize 2048 -precalcIdxBufSize 2048 -minHitRate 0.999 -maxFalseAlarmRate 0.5 -w 48 -h 48
训练在第13阶段停止.一旦我得到了一个, …
我需要一些基于LBP的人脸检测的帮助,这就是我写这个的原因.
我在OpenCV上实现了与面部检测相关的以下问题:
LBP_frontal_face_classifier.xml中的功能值是什么?我知道它们是4个整数的向量.但是我该如何使用这个功能呢?我认为第0阶段访问第一个功能但访问不在此模式中.这个功能的访问模式是什么?
文献中的所有论文仅提供高级概述.它们的描述主要包括邻域像素的LBP计算.但是这个LBP值如何用于分类器中的那些元素?
我读了一些文章,文章.但没有一个清楚地描述基于LBP的人脸检测是如何工作的或详细的算法.如果有人想要自己开发一个人脸检测程序,他应该遵循的步骤是什么 - 没有文件描述.
如果可以,请帮助我.我会很感激.
我local_binary_pattern在scikit-image包中使用该函数.我想计算半径为1的8个邻居的旋转不变均匀LBP.这是我的Python代码:
import numpy as np
from skimage.feature import local_binary_pattern
image = np.array([[150, 137, 137, 146, 146, 148],
[145, 144, 144, 144, 142, 144],
[149, 144, 144, 143, 153, 147],
[145, 144, 147, 150, 145, 150],
[146, 146, 139, 148, 144, 148],
[129, 139, 142, 150, 146, 140]]).astype(np.uint8)
lbp = local_binary_pattern(image, 8, 1, "uniform")
print("image =")
print(image)
print("lbp =")
print(lbp)
Run Code Online (Sandbox Code Playgroud)
这是输出
image =
[[150 137 137 146 146 148]
[145 144 144 144 142 144]
[149 144 144 143 …Run Code Online (Sandbox Code Playgroud) 我试图使用Python,OpenCv2和LBPH(从HERE下载)实现人脸识别
我的python版本是2.7.14
PIP版本是9.0.3
,OpenCV版本是3.4.0
我的代码是
import cv2
import numpy as np
import NameFind
# --- import the Haar cascades for face and eye ditection
face_cascade = cv2.CascadeClassifier('Haar/haarcascade_frontalcatface.xml')
eye_cascade = cv2.CascadeClassifier('Haar/haarcascade_eye.xml')
spec_cascade = cv2.CascadeClassifier('Haar/haarcascade_eye_tree_eyeglasses.xml')
help(cv2.face)
# FACE RECOGNISER OBJECT
LBPH = cv2.face.LBPHFaceRecognizer_create(2, 2, 7, 7, 20)
EIGEN = cv2.face.createEigenFaceRecognizer(10, 5000)
FISHER = cv2.face.createFisherFaceRecognizer(5, 500)
# Load the training data from the trainer to recognise the faces
LBPH.load("Recogniser/trainingDataLBPH.xml")
EIGEN.load("Recogniser/trainingDataEigan.xml")
FISHER.load("Recogniser/trainingDataFisher.xml")
# ------------------------------------ PHOTO INPUT -----------------------------------------------------
img = cv2.imread('Me4.jpg') # ------->>> …Run Code Online (Sandbox Code Playgroud) 我生成了这样的纹理图像

我必须比较两个纹理。我使用了直方图比较方法。
image_file = 'output_ori.png'
img_bgr = cv2.imread(image_file)
height, width, channel = img_bgr.shape
hist_lbp = cv2.calcHist([img_bgr], [0], None, [256], [0, 256])
print("second started")
image_fileNew = 'output_scan.png'
img_bgr_new = cv2.imread(image_fileNew)
height_new, width_new, channel_new = img_bgr_new.shape
print("second lbp")
hist_lbp_new = cv2.calcHist([img_bgr_new], [0], None, [256], [0, 256])
print("compar started")
compare = cv2.compareHist(hist_lbp, hist_lbp_new, cv2.HISTCMP_CORREL)
print(compare)
Run Code Online (Sandbox Code Playgroud)
但是这种方法无效。对于两种不同的图像纹理,它显示出相似的结果。同样,它并没有显示太多变化来识别打印和扫描效果。如何比较纹理?我想到分析GLCM特性。
import cv2
import numpy as np
from skimage.feature import greycomatrix
img = cv2.imread('images/noised_img1.jpg', 0)
image = np.array(img, dtype=np.uint8)
g = greycomatrix(image, [1, 2], [0, np.pi/2], levels=4, normed=True, …Run Code Online (Sandbox Code Playgroud) 我正在努力理解这里发现的LBP算法的Matlab实现.我试图找到它如何计算每个像素的二进制文件?它只计算相邻像素大于实际中心像素大小的位置.我想计算每个像素的二进制数,以便使用局部直方图来计算图像的特征.
[ysize, xsize] = size(image);
miny=min(spoints(:,1));
maxy=max(spoints(:,1));
minx=min(spoints(:,2));
maxx=max(spoints(:,2));
% Block size, each LBP code is computed within a block of size bsizey*bsizex
bsizey=ceil(max(maxy,0))-floor(min(miny,0))+1;
bsizex=ceil(max(maxx,0))-floor(min(minx,0))+1;
% Coordinates of origin (0,0) in the block
origy=1-floor(min(miny,0));
origx=1-floor(min(minx,0));
% Minimum allowed size for the input image depends
% on the radius of the used LBP operator.
if(xsize < bsizex || ysize < bsizey)
error('Too small input image. Should be at least (2*radius+1) x (2*radius+1)');
end
% Calculate dx and dy;
dx …Run Code Online (Sandbox Code Playgroud) matlab image-processing feature-extraction computer-vision lbph-algorithm