nishanthmerwin / ImageAnalysis-IGP

0 stars 0 forks source link

Thresholding Adaptive Blocksize ERROR! - SOLVED #5

Closed batharseneca closed 8 years ago

batharseneca commented 8 years ago

I put 1 in Adaptive for a P-p53 images and pressed preview!::

OpenCV Error: Assertion failed (blockSize % 2 == 1 && blockSize > 1) in cv::adaptiveThreshold, file C:\builds\master_PackSlaveAddon- win64-vc12-static\opencv\modules\imgproc\src\thresh.cpp, line 1281 Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\Bilal Athar\Anaconda\lib\lib-tk\Tkinter.py", line 1536, in call return self.func(*args) File "C:\Users\Bilal Athar\Desktop\Bilal_Test\ImageAnalysis-IGP\final\threshold_V3.py", line 191, in adaptPreview threshPic = cv2.adaptiveThreshold(self.img,255,cv2.ADAPTIVE_THRESH_MEAN_C,cv2.THRESH_BINARY,self.blockSize,5) error: C:\builds\master_PackSlaveAddon-win64-vc12-static\opencv\modules\imgproc\src\thresh.cpp:1281: error: (-215) blockSize % 2 == 1 && blockSize > 1 in function cv::adaptiveThreshold

batharseneca commented 8 years ago

RESOLVED

n_hoodLabel = tk.Label(self.adapt.controlsFrame, text= "Set block size (must be odd integer > 1): ")

def validateBlock(self,P):

     ` elif((int(P) % 2 == 1)  and (int(P) > 1)):
        self.adapt.description.submit.config(state='normal')
        self.blockSize = int(P)
        print "weighting is: ------",self.adapt.weighting.get(),"------"
        if (self.invalid == 0):
            self.adaptPreview.config(state='normal')                                
        return True`
nishanthmerwin commented 8 years ago

Yep.. good catch!