Update python samples
This commit is contained in:
+2
-2
@@ -38,10 +38,10 @@ def Hist_and_Backproj(val):
|
||||
|
||||
## [Read the image]
|
||||
parser = argparse.ArgumentParser(description='Code for Back Projection tutorial.')
|
||||
parser.add_argument('--input', help='Path to input image.')
|
||||
parser.add_argument('--input', help='Path to input image.', default='home.jpg')
|
||||
args = parser.parse_args()
|
||||
|
||||
src = cv.imread(args.input)
|
||||
src = cv.imread(cv.samples.findFile(args.input))
|
||||
if src is None:
|
||||
print('Could not open or find the image:', args.input)
|
||||
exit(0)
|
||||
|
||||
+2
-2
@@ -54,10 +54,10 @@ def Hist_and_Backproj(mask):
|
||||
|
||||
# Read the image
|
||||
parser = argparse.ArgumentParser(description='Code for Back Projection tutorial.')
|
||||
parser.add_argument('--input', help='Path to input image.')
|
||||
parser.add_argument('--input', help='Path to input image.', default='home.jpg')
|
||||
args = parser.parse_args()
|
||||
|
||||
src = cv.imread(args.input)
|
||||
src = cv.imread(cv.samples.findFile(args.input))
|
||||
if src is None:
|
||||
print('Could not open or find the image:', args.input)
|
||||
exit(0)
|
||||
|
||||
+6
-6
@@ -53,14 +53,14 @@ cv.normalize(r_hist, r_hist, alpha=0, beta=hist_h, norm_type=cv.NORM_MINMAX)
|
||||
|
||||
## [Draw for each channel]
|
||||
for i in range(1, histSize):
|
||||
cv.line(histImage, ( bin_w*(i-1), hist_h - int(round(b_hist[i-1])) ),
|
||||
( bin_w*(i), hist_h - int(round(b_hist[i])) ),
|
||||
cv.line(histImage, ( bin_w*(i-1), hist_h - int(b_hist[i-1]) ),
|
||||
( bin_w*(i), hist_h - int(b_hist[i]) ),
|
||||
( 255, 0, 0), thickness=2)
|
||||
cv.line(histImage, ( bin_w*(i-1), hist_h - int(round(g_hist[i-1])) ),
|
||||
( bin_w*(i), hist_h - int(round(g_hist[i])) ),
|
||||
cv.line(histImage, ( bin_w*(i-1), hist_h - int(g_hist[i-1]) ),
|
||||
( bin_w*(i), hist_h - int(g_hist[i]) ),
|
||||
( 0, 255, 0), thickness=2)
|
||||
cv.line(histImage, ( bin_w*(i-1), hist_h - int(round(r_hist[i-1])) ),
|
||||
( bin_w*(i), hist_h - int(round(r_hist[i])) ),
|
||||
cv.line(histImage, ( bin_w*(i-1), hist_h - int(r_hist[i-1]) ),
|
||||
( bin_w*(i), hist_h - int(r_hist[i]) ),
|
||||
( 0, 0, 255), thickness=2)
|
||||
## [Draw for each channel]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user