我也没有训练啥网络,就是用着用着打不开了
C
cxr1 发布的帖子
-
询问代码代码问题,比如这段代码里面的MAX_HIGH这几个值都是怎么判断大小的?
def RecognitionForm(Blobs,img): Top = 0 Botton = 1 Left = 2 Right = 3 cx = 0 cy = 1 cw = 0 ch = 0 #这几个值根据啥定义的 MAX_WITH = 25 MIN_WITH = 1 MIN_HIGH = 0.000001 MAX_HIGH = 50 FormType = 200 Loaction0 = 0 Location1 = 120 Loaction2 = 0 Loaction3 = 0 global length global erweima_flag #上方下方左边右边的有效区域 TopValid = False BottonValid = False LeftValid = False RightValid = False #将FindMaxBlobs函数的四个数组中的数据存储 TopBlob = FindMaxBlobs(Blobs[0]) BottonBlob = FindMaxBlobs(Blobs[1]) LeftBlob = FindMaxBlobs(Blobs[2]) RightBlob = FindMaxBlobs(Blobs[3]) #上方区域 if TopBlob: if TopBlob.w() < MAX_WITH and TopBlob.h() > MIN_HIGH: BlobLocation[Top][cx] = TopBlob.cx()#检测到下方区域最大黑块的x坐标 BlobLocation[Top][cy] = TopBlob.cy()#检测到下方区域最大黑块的y坐标 else: TopBlob = None #下方区域 if BottonBlob: if BottonBlob.w() < MAX_WITH and BottonBlob.h() > MIN_HIGH: BlobLocation[Botton][cx] = BottonBlob.cx()#检测到下方区域最大黑块的x坐标 BlobLocation[Botton][cy] = BottonBlob.cy()#检测到下方区域最大黑块的y坐标 else: BottonBlob = None #左边区域 if LeftBlob: if LeftBlob.w() > MIN_WITH and LeftBlob.h() < MAX_HIGH and LeftBlob.h() > MIN_HIGH: BlobLocation[Left][cx] = LeftBlob.cx() BlobLocation[Left][cy] = LeftBlob.cy() BlobLocation[Left][cw] = LeftBlob.w() BlobLocation[Left][ch] = LeftBlob.h() img.draw_rectangle(LeftBlob.rect()) #img.draw_cross(BlobLocation[Left][cx],BlobLocation[Left][cy]) else: LeftBlob = None #右边区域 if RightBlob: if RightBlob.w() > MIN_WITH and RightBlob.h() < MAX_HIGH and RightBlob.h() > MIN_HIGH: BlobLocation[Right][cx] = RightBlob.cx() BlobLocation[Right][cy] = RightBlob.cy() BlobLocation[Right][cw] = RightBlob.w() BlobLocation[Right][ch] = RightBlob.h() img.draw_rectangle(RightBlob.rect()) #img.draw_cross(BlobLocation[Right][cx],BlobLocation[Right][cy]) else: RightBlob = None if TopBlob: TopValid = False if BottonBlob: BottonValid = False if LeftBlob: LeftValid = True if RightBlob: RightValid = True # 横线 if (not TopValid) and (not BottonValid) and LeftValid and RightValid: if BlobLocation[Left][cy] - BlobLocation[Right][cy] < 80 and BlobLocation[Left][cy] - BlobLocation[Right][cy] > -80 : Loaction0 = (BlobLocation[Top][cx] + BlobLocation[Botton][cx])//2 #x Location1 = (BlobLocation[Left][cy] + BlobLocation[Right][cy])//2 #Y Loaction2 = (BlobLocation[Left][cw] + BlobLocation[Right][cw])//2 #W Loaction3 = (BlobLocation[Left][ch] + BlobLocation[Right][ch])//2 #H FormType = 0 Type = 0 return FormType,Loaction0,Location1,Loaction2,Loaction3
-
想知道识别直线定义的函数
def find_all_Line(img): Line_All = img.find_lines(threshold = Line_Thr, theta_margin = Line_Theta_margin, rho_margin = Line_Margin) return Line_All
这个返回的line_all值到底是什么?
-
关于颜色阈值的问题(LAB和RAB的问题)
这样写和直接从阈值编辑器复制过来有啥区别?
red_threshold_LAB=(29, 76, -21, 78, 7, 66)#in LAB color space for finding blobs在LAB颜色空间中寻找斑点 green_threshold_LAB=(50,80,-50,-30,-10,10) red_threshold_RGB= (200,256,0,150,0,150) #in RGB color space for finding edges green_threshold_RGB=(-1,70,80,256,60,256)
-
RE: 在灰度识别中,threshold应该这样设置值??
跟踪一条黑线。使用[(128,255)]来跟踪白线。
GRAYSCALE_THRESHOLD = [(0, 64)]
#设置阈值,如果是黑线,GRAYSCALE_THRESHOLD = [(0, 64)];
#如果是白线,GRAYSCALE_THRESHOLD = [(128,255)]
这个是巡线小车的, -
在灰度识别中,threshold应该这样设置值??
sensor.reset() sensor.set_pixformat(sensor.GRAYSCALE) sensor.set_framesize(sensor.QQVGA) sensor.skip_frames(time=2000) sensor.set_auto_gain(False) # must be turned off for color tracking sensor.set_auto_whitebal(False) # must be turned off for color tracking clock = time.clock()
这个设置中
threshold = [53, 238]
阈值为啥设置成这样,
为啥阈值是两个值,改变这两个值对灰色有啥影响吗?