本文整理汇总了Python中skimage.io.show函数的典型用法代码示例。如果您正苦于以下问题:Python show函数的具体用法?Python show怎么用?Python show使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了show函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: align_img
def align_img(image_name, loss_fn=sum_of_squared_diff, max_disp = 15, big=False, name=None, hist_eq = False):
b,g,r = get_bgr(image_name)
if hist_eq == True:
b, g, r = exposure.equalize_hist(b), exposure.equalize_hist(g), exposure.equalize_hist(r)
print("Aligning green and blue: ")
ag = align(g, b, loss_fn=loss_fn, max_disp = max_disp, big=big, name=name)
print("Aligning blue and red: ")
ar = align(r, b, loss_fn=loss_fn, max_disp = max_disp, big=big, name=name)
# create a color image
im_out = np.dstack([ar, ag, b])
plt.show()
# save the image
iname = image_name.split('.')
iname[-1] = 'jpg'
image_name = '.'.join(iname)
fname = 'out_' + image_name
skio.imsave(fname, im_out)
# display the image
skio.imshow(im_out)
plt.show()
skio.show()
示例2: test_with_pro_2
def test_with_pro_2(rawImg,pro):
''' Use this fuc when ### above are first implement'''
ref = rawImg.copy()
img = auto_resized(rawImg,conf['train_resolution'])
img_gray = cv2.cvtColor( img , cv2.COLOR_BGR2GRAY)
roi = img_gray
(boxes, probs) = od.detect(roi, winStep=conf["step_size"], winDim=conf["sliding_size"],
pyramidScale=1.1, minProb=pro)
# since for size effect with the camera, pyramidScale = 1.001, mnust>1,
# if positive size would change, we have to use 1.5 or 2 ...etc
pick = non_max_suppression(np.array(boxes), probs, conf["overlap_thresh"])
orig = img.copy()
# Resize Back, I am GOD !!!!!
y_sizeFactor = ref.shape[0]/float(img.shape[0])
x_sizeFactor = ref.shape[1]/float(img.shape[1])
# loop over the allowed bounding boxes and draw them
for (startX, startY, endX, endY) in pick:
#cv2.rectangle(orig, (startX, startY), (endX, endY), (0, 255, 0), 2)
startX = int(startX* x_sizeFactor)
endX = int(endX * x_sizeFactor)
startY = int(startY* y_sizeFactor)
endY = int(endY * y_sizeFactor)
cv2.rectangle(ref, (startX, startY), (endX, endY), (0, 255, 0), 2)
cv2.putText(ref, "Hodling SkrewDriver", (startX, startY), cv2.FONT_HERSHEY_SIMPLEX, 1.5, (0, 255, 0), 4)
#print (startX, startY), (endX, endY)
show(ref)
return ref, pick
示例3: main
def main():
args = vars(parser.parse_args())
filename = os.path.join(os.getcwd(), args["image"][0])
image = skimage.img_as_uint(color.rgb2gray(io.imread(filename)))
subsample = 1
if (not args["subsample"] == 1):
subsample = args["subsample"][0]
image = transform.downscale_local_mean(image, (subsample, subsample))
image = transform.pyramid_expand(image, subsample, 0, 0)
image = exposure.rescale_intensity(image, out_range=(0,args["depth"][0]))
if (args["visualize"]):
io.imshow(image)
io.show()
source = generate_face(image, subsample, args["depth"][0], FLICKER_SPEED)
if source:
with open(args["output"][0], 'w') as file_:
file_.write(source)
else:
print "Attempted to generate source code, failed."
示例4: recog_show
def recog_show(self, img):
hand_5 = cv2.CascadeClassifier(self.xmlPath)
ref = img.copy()
hand5 = hand_5.detectMultiScale(
ref.copy()[50:550,50:800],
scaleFactor=1.2,
minNeighbors=15, #35 ==> 1
#flags = cv2.cv.CV_HAAR_SCALE_IMAGE
)
hand = []
hand_roi=[]
for (x,y,w,h) in hand5:
# Position Aware + Size Aware
if (x < 160 and y < 160) or y<160 or h<90:
pass
else:
# draw rectangle at the specific location
cv2.rectangle(ref,(x+50,y+50),(x+50+w,y+50+h),(255,0,0),2)
cv2.putText(ref, "Hand", (x+50,y+50), cv2.FONT_HERSHEY_SIMPLEX, 1.5, (255, 0, 0), 4)
hand.append([(x+50+x+50+w)/2,(y+50+h+y+50)/2])
#show(ref)
print ((x+50,y+50),(x+50+w,y+50+h))
hand_roi.append([x+50,y+50,x+50+w,y+50+h])
if len(hand_roi)>1:
result_box = max(hand_roi)
elif len(hand_roi)==1:
result_box = hand_roi.pop()
else:
result_box = 0
show(ref)
示例5: color_slicing
def color_slicing():
# 彩色分层
image=io.imread('trafficlight.png')
segred=image.copy()
seggreen=image.copy()
segyellow=image.copy()
maskred=(image[:,:,0]>100) & (image[:,:,1]<50 ) & (image[:,:,2]<50)
maskgreen=(image[:,:,0]<100) & (image[:,:,1]>100 ) & (image[:,:,2]<100)
maskyellow=(image[:,:,0]>100) & (image[:,:,1]>100 ) & (image[:,:,2]<70)
segred[:,:,0]*=maskred
segred[:,:,1]*=maskred
segred[:,:,2]*=maskred
io.imshow(segred)
io.imsave('lightred.png',segred)
io.show()
seggreen[:,:,0]*=maskgreen
seggreen[:,:,1]*=maskgreen
seggreen[:,:,2]*=maskgreen
io.imshow(seggreen)
io.imsave('lightgreen.png',seggreen)
io.show()
segyellow[:,:,0]*=maskyellow
segyellow[:,:,1]*=maskyellow
segyellow[:,:,2]*=maskyellow
io.imshow(segyellow)
io.imsave('lightyellow.png',segyellow)
示例6: test_with_hc_v2
def test_with_hc_v2(frame_id,pro,falsePositive=False,falseNegative=False):
''' Use this fuc when ### above are first implement'''
img = vid.get_data(frame_id)
img = auto_resized(img,conf['train_resolution'])
img_gray = cv2.cvtColor( img , cv2.COLOR_BGR2GRAY)
roi = img_gray[20:180,35:345]
(boxes, probs) = od.detect(roi, winStep=conf["step_size"], winDim=conf["sliding_size"],
pyramidScale=1.1, minProb=pro)
# since for size effect with the camera, pyramidScale = 1.001, mnust>1,
# if positive size would change, we have to use 1.5 or 2 ...etc
pick = non_max_suppression(np.array(boxes), probs, conf["overlap_thresh"])
orig = img.copy()
# loop over the allowed bounding boxes and draw them
for (startX, startY, endX, endY) in pick:
if startY < 50 and startX < 50:
pass
else :
cv2.rectangle(orig, (startX+35, startY+20), (endX+35, endY+20), (0, 255, 0), 2)
print (startX+35, startY+20), (endX+35, endY+20)
###
##
###
if falsePositive == True:
hard_neg_extrect(conf,)
show(orig)
return img_gray, orig
示例7: test_with_hc_222
def test_with_hc_222(frame_id,pro):
''' Use this fuc when ### above are first implement'''
img = vid.get_data(frame_id)
img = auto_resized(img,conf['train_resolution'])
# ROI roi
roi = img[20:180,35:345]
# use check_hsv
img_gray = check_hsv(roi)
(boxes, probs) = od.detect(img_gray, winStep=conf["step_size"], winDim=conf["sliding_size"],
pyramidScale=1.1, minProb=pro)
# since for size effect with the camera, pyramidScale = 1.001, mnust>1,
# if positive size would change, we have to use 1.5 or 2 ...etc
pick = non_max_suppression(np.array(boxes), probs, conf["overlap_thresh"])
orig = img.copy()
# loop over the allowed bounding boxes and draw them
for (startX, startY, endX, endY) in pick:
if startY < 50 and startX < 50:
pass
elif abs(startX - endX)>80: # Size effect
pass
elif (check_hsv2(img)[startY+20:endY+20,startX+35:endX+35]).sum()<255*300:
# White region = 255
print (startX, startY, endX, endY)
print '[*] White Value Index must > 20'
print (check_hsv2(img)[startY+20:endY+20,startX+35:endX+35]).sum()
print '[*] End'
else:
cv2.rectangle(orig, (startX+35, startY+20), (endX+35, endY+20), (0, 255, 0), 2)
show(orig)
return img_gray, orig
示例8: test_with_pro_depth_size
def test_with_pro_depth_size(rawImg,pro):
''' Use this fuc when ### above are first implement'''
#img = vid.get_data(frame_id)
roi = auto_resized(rawImg,conf['train_resolution'])
(boxes, probs) = od.detect(roi, winStep=conf["step_size"], winDim=conf["sliding_size"],
pyramidScale=1.1, minProb=pro)
# since for size effect with the camera, pyramidScale = 1.001, mnust>1,
# if positive size would change, we have to use 1.5 or 2 ...etc
pick = non_max_suppression(np.array(boxes), probs, conf["overlap_thresh"])
orig = roi.copy()
# loop over the allowed bounding boxes and draw them
hand_roi=[]
for (startX, startY, endX, endY) in pick:
if endX-startX>30:
pass
else:
cv2.rectangle(orig, (startX, startY), (endX, endY), (0, 255, 0), 2)
print (startX, startY), (endX, endY)
hand_roi.append([startX, startY, endX, endY])
show(orig)
###############
if len(hand_roi)>1:
result_box = max(hand_roi)
elif len(hand_roi)==1:
result_box = hand_roi.pop()
else:
result_box = 0
#####
return orig, result_box
示例9: test_with_pro_depth_iter
def test_with_pro_depth_iter(rawImg,pro):
''' Use this fuc when ### above are first implement'''
#img = vid.get_data(frame_id)
roi = auto_resized(rawImg,conf['train_resolution'])
def memo(proThresh):
(boxes, probs) = od.detect(roi, winStep=conf["step_size"], winDim=conf["sliding_size"],
pyramidScale=1.1, minProb=proThresh)
# since for size effect with the camera, pyramidScale = 1.001, mnust>1,
# if positive size would change, we have to use 1.5 or 2 ...etc
pick = non_max_suppression(np.array(boxes), probs, conf["overlap_thresh"])
if pick>1:
proThresh+=0.01
memo(proThresh)
elif pick ==0:
proThresh-=0.01
memo(proThresh)
else:
return pick
pick = memo(0.5)
orig = img.copy()
# loop over the allowed bounding boxes and draw them
for (startX, startY, endX, endY) in pick:
cv2.rectangle(orig, (startX+35, startY+20), (endX+35, endY+20), (0, 255, 0), 2)
print (startX+35, startY+20), (endX+35, endY+20)
show(orig)
return roi, orig
示例10: _detect_spots_hough_circle
def _detect_spots_hough_circle(image, radius):
edges = canny(image)
imshow(edges)
show()
hough_radii = np.arange(radius/2, radius*2, 10)
hough_circles = hough_circle(edges, hough_radii)
print(hough_circles)
示例11: main
def main():
from skimage import data, io, filters
testfolder='/Users/davidgreenfield/Downloads/pics_boots/'
testimage='B00A0GVP8A.jpg'
image = io.imread(testfolder+testimage,flatten=True) # or any NumPy array!
edges = filters.sobel(image)
io.imshow(edges)
io.show()
示例12: main
def main(sc, outputDir, outputIndices, filename, onThreshold, speciesToBin, skipTime, interactive):
global globalSpeciesToBin, globalSkipTime, globalOnThreshold
# Broadcast the global variables.
globalSpeciesToBin=sc.broadcast(speciesToBin)
globalSkipTime=sc.broadcast(skipTime)
globalOnThreshold = sc.broadcast(onThreshold)
# Load the records from the sfile.
allRecords = sc.newAPIHadoopFile(filename, "robertslab.hadoop.io.SFileInputFormat", "robertslab.hadoop.io.SFileHeader", "robertslab.hadoop.io.SFileRecord", keyConverter="robertslab.spark.sfile.SFileHeaderToPythonConverter", valueConverter="robertslab.spark.sfile.SFileRecordToPythonConverter")
# Bin the species counts records and sum across all of the bins.
# results = allRecords.filter(filterSpeciesCounts).map(binSpeciesCounts).values().reduce(addBins)
results = allRecords.filter(filterSpeciesCounts).map(storeEvent).values().reduce(addBins)
results[0].sort()
# print("results = " + str(results))
#.reduceByKey(addLatticeBins).values().collect()
# Save the on events in a file in pickle format.
pickle.dump(results, open("analysis/pdf.dat/onEvent_gradient_sp2.p", "wb"))
# Save the pdfs into a .mat file in the output directory named according to the output indices.
# pdfs=np.zeros((len(speciesToBin),),dtype=object)
# for i in range(0,len(speciesToBin)):
# minCount=results[i][0]
# maxCount=results[i][1]
# bins=results[i][2]
# pdf = np.zeros((len(bins),2),dtype=float)
# pdf[:,0]=np.arange(minCount,maxCount+1).astype(float)
# pdf[:,1]=bins.astype(float)/float(sum(bins))
# pdfs[i] = pdf
# print("Binned species %d: %d data points from %d to %d into %s"%(speciesToBin[i],sum(bins),minCount,maxCount,outputDir))
# cellio.cellsave(outputDir,pdfs,outputIndices);
# cellio.cellsave(outputDir,results,outputIndices);
# If interactive, show the pdf.
if interactive:
for repidx in range(len(results[0])):
replicate = results[0][repidx][0]
times=[]
event=[]
for val in results[0][repidx][1:]:
times.append(val[0])
event.append(val[1])
print("times = " + str(times))
print("event = " + str(event))
plt.figure()
plt.subplot(1,1,1)
plt.plot(times,event)
plt.axis([0, times[-1], -1, 2])
plt.xlabel('time')
plt.ylabel('event')
plt.title('replicate = %s'%(replicate))
io.show()
else:
print "Warning: cannot plot PDF with only a single bin."
示例13: color_transformation
def color_transformation():
# 彩色变换
image=data.coffee()
brighter=np.uint8(image*0.5+255*0.5)
darker=np.uint8(image*0.5)
io.imshow(brighter)
io.show()
io.imshow(darker)
io.show()
示例14: main
def main(argv):
filename = argv[1]
img = io.imread(filename, as_grey=True)
lpyra = tuple(transform.pyramid_laplacian(img))
l = lpyra[0]
l = exposure.equalize_hist(l)
y, x = np.indices((l.shape[0],l.shape[1]))
vect = np.array(zip(y.reshape(y.size),x.reshape(x.size),l.reshape(l.size)))
io.imshow(l)
io.show()
示例15: test1
def test1():
data, key = load_h5(ROOT + os.sep + 'train320.h5')
X = data['X']
img = np.squeeze(X[700])
score = data['y'][700]
img = np.swapaxes(img, 0, 2)
img = np.swapaxes(img, 0, 1)
skio.imshow(img)
print score
skio.show()