原创 根據是否有領域點來判斷點是否孤立

void mark_sparse_flag(point_distributed_list &points_distributed) { point_distributed_list::iterator pt=points_distrib

原创 在灰度圖像上劃線

兩種辦法 1。是生成3通道的圖象,每個通道都一樣,這樣看起來也是灰度圖,好處是可以在其上畫彩色圖象 2。直接畫,這是要注意不要使用CV_RGB(25

原创 將矩形向外擴展一圈,但不超過圖片的大小

void expand_rect(CvRect &rect,IplImage *img) { if (rect.x>5) {rect.x-=5;rect.width+=5;} else {rect.x=0;rect.width+=r

原创 cvSeqSort使用

static int near_num_cmp(void* _a,void* _b,void* userdata ) { pt_near* a =(pt_near*)_a; pt_near* b =(pt_near*)_b; ret

原创 安裝Balser4.2.0驅動的時候,不讓安裝

報錯如下: 把windows的更新打開即可,如下:

原创 對所有提取到的輪廓畫其重心

#include "cv.h" #include "highgui.h" void main( ) { IplImage* src; CvMoments moments; CvMat *region; CvPoin

原创 關於cvContourArea

對於序列,僅能針對多邊形,或者構成一個連續的 不連續會出現bug的,shapedescr.cpp有說明 if( CV_IS_SEQ( array )) { contour = (CvSeq*)array;

原创 調用opencv的detectMultiScale函數時報錯

我拿detectMultiScale()函數來進行我指定訓練好的類別檢測時,發現程序會異常,跳轉到free.c文件裏去,如果把這句屏蔽掉就沒有,我知道問題出在這裏了,可是怎麼調用強大的opencv會有這樣的問題呢,怎麼會怎麼會??? 因爲

原创 判斷點在直線的哪個區域

bool pt_in_positive(CvPoint pt,CvPoint input_pt1,CvPoint input_pt2) { double A,B,C; double k_t; k_t=input_pt2.x - in

原创 在未安裝opencv的電腦上,調用庫

1、include文件夾和lib文件夾放的位置 2、dll文件放置位置(Debug版本就需要在Debug文件夾中添加對應的Debug版dll) 3、添加include庫 4、添加lib庫 5、添加lib文件(Debug版本

原创 關於CvMoments的一些剖析

#include "cv.h" #include "highgui.h" #include "cvaux.h" #include "cxcore.h" #include <stdio.h> #include <vector> usin

原创 得seq的重心

keypoint get_gravity_center(CvSeq* seq)//中心位置,與像素的值無關 { double m00, m10, m01; CvMoments moment; cvMoments(seq, &mome

原创 兩點確定直線方程

void get_line(CvPoint2D32f pt_a,CvPoint2D32f pt_b,float &A,float &B,float &C) { if(pt_a.x!=pt_b.x) { A=(pt_b.y-pt_a

原创 解線性超定方程

int numPoints=10; double **a=new double *[2*numPoints];  for(int i = 0; i <2*numPoints;i++)   a[i] = new double[8];  do

原创 解超定方程

float* fInit1DPointer(int num) { register int i; float* p = new float[num]; for(i=0; i<num; i++) { p[i]=0.0f;