Merge commit '43aec5ad' into merge-2.4
Conflicts: cmake/OpenCVConfig.cmake cmake/OpenCVLegacyOptions.cmake modules/contrib/src/retina.cpp modules/gpu/doc/camera_calibration_and_3d_reconstruction.rst modules/gpu/doc/video.rst modules/gpu/src/speckle_filtering.cpp modules/python/src2/cv2.cv.hpp modules/python/test/test2.py samples/python/watershed.py
This commit is contained in:
@@ -158,4 +158,3 @@ if __name__ == '__main__':
|
||||
match_and_draw('affine find_obj')
|
||||
cv2.waitKey()
|
||||
cv2.destroyAllWindows()
|
||||
|
||||
|
@@ -70,4 +70,3 @@ if __name__ == '__main__':
|
||||
print "camera matrix:\n", camera_matrix
|
||||
print "distortion coefficients: ", dist_coefs.ravel()
|
||||
cv2.destroyAllWindows()
|
||||
|
||||
|
@@ -123,4 +123,3 @@ if __name__ == '__main__':
|
||||
video_src = 0
|
||||
print __doc__
|
||||
App(video_src).run()
|
||||
|
||||
|
@@ -217,4 +217,3 @@ def draw_keypoints(vis, keypoints, color = (0, 255, 255)):
|
||||
for kp in keypoints:
|
||||
x, y = kp.pt
|
||||
cv2.circle(vis, (int(x), int(y)), 2, color)
|
||||
|
||||
|
@@ -125,4 +125,3 @@ if __name__ == '__main__':
|
||||
if ch == ord(' '):
|
||||
defocus = not defocus
|
||||
update(None)
|
||||
|
||||
|
@@ -161,4 +161,3 @@ class App:
|
||||
|
||||
if __name__ == '__main__':
|
||||
App().run()
|
||||
|
||||
|
@@ -67,4 +67,3 @@ if __name__ == '__main__':
|
||||
if need_update:
|
||||
update()
|
||||
cv2.destroyAllWindows()
|
||||
|
||||
|
@@ -49,4 +49,3 @@ if __name__ == '__main__':
|
||||
if ch == 27:
|
||||
break
|
||||
cv2.destroyAllWindows()
|
||||
|
||||
|
@@ -62,4 +62,3 @@ if __name__ == '__main__':
|
||||
if 0xFF & cv2.waitKey(5) == 27:
|
||||
break
|
||||
cv2.destroyAllWindows()
|
||||
|
||||
|
@@ -8,12 +8,12 @@ This sample shows interactive image segmentation using grabcut algorithm.
|
||||
USAGE :
|
||||
python grabcut.py <filename>
|
||||
|
||||
README FIRST:
|
||||
README FIRST:
|
||||
Two windows will show up, one for input and one for output.
|
||||
|
||||
At first, in input window, draw a rectangle around the object using
|
||||
|
||||
At first, in input window, draw a rectangle around the object using
|
||||
mouse right button. Then press 'n' to segment the object (once or a few times)
|
||||
For any finer touch-ups, you can press any of the keys below and draw lines on
|
||||
For any finer touch-ups, you can press any of the keys below and draw lines on
|
||||
the areas you want. Then again press 'n' for updating the output.
|
||||
|
||||
Key '0' - To select areas of sure background
|
||||
@@ -53,7 +53,7 @@ thickness = 3 # brush thickness
|
||||
|
||||
def onmouse(event,x,y,flags,param):
|
||||
global img,img2,drawing,value,mask,rectangle,rect,rect_or_mask,ix,iy,rect_over
|
||||
|
||||
|
||||
# Draw Rectangle
|
||||
if event == cv2.EVENT_RBUTTONDOWN:
|
||||
rectangle = True
|
||||
@@ -73,9 +73,9 @@ def onmouse(event,x,y,flags,param):
|
||||
rect = (ix,iy,abs(ix-x),abs(iy-y))
|
||||
rect_or_mask = 0
|
||||
print " Now press the key 'n' a few times until no further change \n"
|
||||
|
||||
|
||||
# draw touchup curves
|
||||
|
||||
|
||||
if event == cv2.EVENT_LBUTTONDOWN:
|
||||
if rect_over == False:
|
||||
print "first draw rectangle \n"
|
||||
@@ -94,7 +94,7 @@ def onmouse(event,x,y,flags,param):
|
||||
drawing = False
|
||||
cv2.circle(img,(x,y),thickness,value['color'],-1)
|
||||
cv2.circle(mask,(x,y),thickness,value['val'],-1)
|
||||
|
||||
|
||||
# print documentation
|
||||
print __doc__
|
||||
|
||||
@@ -125,7 +125,7 @@ while(1):
|
||||
cv2.imshow('output',output)
|
||||
cv2.imshow('input',img)
|
||||
k = 0xFF & cv2.waitKey(1)
|
||||
|
||||
|
||||
# key bindings
|
||||
if k == 27: # esc to exit
|
||||
break
|
||||
@@ -147,11 +147,11 @@ while(1):
|
||||
elif k == ord('r'): # reset everything
|
||||
print "resetting \n"
|
||||
rect = (0,0,1,1)
|
||||
drawing = False
|
||||
rectangle = False
|
||||
rect_or_mask = 100
|
||||
rect_over = False
|
||||
value = DRAW_FG
|
||||
drawing = False
|
||||
rectangle = False
|
||||
rect_or_mask = 100
|
||||
rect_over = False
|
||||
value = DRAW_FG
|
||||
img = img2.copy()
|
||||
mask = np.zeros(img.shape[:2],dtype = np.uint8) # mask initialized to PR_BG
|
||||
output = np.zeros(img.shape,np.uint8) # output image to be shown
|
||||
@@ -160,15 +160,15 @@ while(1):
|
||||
and again press 'n' \n"""
|
||||
if (rect_or_mask == 0): # grabcut with rect
|
||||
bgdmodel = np.zeros((1,65),np.float64)
|
||||
fgdmodel = np.zeros((1,65),np.float64)
|
||||
fgdmodel = np.zeros((1,65),np.float64)
|
||||
cv2.grabCut(img2,mask,rect,bgdmodel,fgdmodel,1,cv2.GC_INIT_WITH_RECT)
|
||||
rect_or_mask = 1
|
||||
elif rect_or_mask == 1: # grabcut with mask
|
||||
bgdmodel = np.zeros((1,65),np.float64)
|
||||
fgdmodel = np.zeros((1,65),np.float64)
|
||||
fgdmodel = np.zeros((1,65),np.float64)
|
||||
cv2.grabCut(img2,mask,rect,bgdmodel,fgdmodel,1,cv2.GC_INIT_WITH_MASK)
|
||||
|
||||
mask2 = np.where((mask==1) + (mask==3),255,0).astype('uint8')
|
||||
output = cv2.bitwise_and(img2,img2,mask=mask2)
|
||||
output = cv2.bitwise_and(img2,img2,mask=mask2)
|
||||
|
||||
cv2.destroyAllWindows()
|
||||
|
@@ -114,4 +114,3 @@ if __name__ == '__main__':
|
||||
cv2.destroyAllWindows()
|
||||
break
|
||||
cv2.destroyAllWindows()
|
||||
|
||||
|
@@ -49,4 +49,3 @@ if __name__ == '__main__':
|
||||
mark[:] = 0
|
||||
sketch.show()
|
||||
cv2.destroyAllWindows()
|
||||
|
||||
|
@@ -64,5 +64,3 @@ if __name__ == '__main__':
|
||||
|
||||
if cv2.waitKey(1) == 27:
|
||||
break
|
||||
|
||||
|
||||
|
@@ -85,4 +85,3 @@ if __name__ == '__main__':
|
||||
cur_glitch = img.copy()
|
||||
print 'glitch is', ['off', 'on'][show_glitch]
|
||||
cv2.destroyAllWindows()
|
||||
|
||||
|
Reference in New Issue
Block a user