本文整理汇总了Python中skimage.io.show函数的典型用法代码示例。如果您正苦于以下问题:Python show函数的具体用法?Python show怎么用?Python show使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了show函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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()
开发者ID:girishbalaji,项目名称:girishbalaji.github.io,代码行数:25,代码来源:main.py
示例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
开发者ID:KentChun33333,项目名称:VistinoEventDes,代码行数:29,代码来源:testing_scrip_0801.py
示例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."
开发者ID:kctess5,项目名称:sad_robot,代码行数:27,代码来源:main.py
示例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)
开发者ID:KentChun33333,项目名称:VistinoEventDes,代码行数:30,代码来源:testing_script_0802_multi-detect.py
示例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)
开发者ID:xingnix,项目名称:learning,代码行数:26,代码来源:colorimage.py
示例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
开发者ID:KentChun33333,项目名称:VistinoEventDes,代码行数:27,代码来源:test_detect_hard_mining.py
示例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
开发者ID:KentChun33333,项目名称:VistinoEventDes,代码行数:30,代码来源:test_detect_hard_mining.py
示例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
开发者ID:KentChun33333,项目名称:VistinoEventDes,代码行数:30,代码来源:testing_scrip_0608.py
示例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
开发者ID:KentChun33333,项目名称:VistinoEventDes,代码行数:26,代码来源:testing_scrip_0605.py
示例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)
开发者ID:afrutig,项目名称:Moloreader,代码行数:8,代码来源:detection.py
示例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()
开发者ID:dgreenfi,项目名称:ImageRec,代码行数:8,代码来源:image_tests.py
示例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."
开发者ID:ratisharma,项目名称:LatticeMicrobes,代码行数:58,代码来源:sp_calc_lm_onEvents2.py
示例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()
开发者ID:xingnix,项目名称:learning,代码行数:9,代码来源:colorimage.py
示例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()
开发者ID:moritayasuaki,项目名称:pycv,代码行数:10,代码来源:mark2.py
示例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()
开发者ID:OleNet,项目名称:caffe-windows,代码行数:10,代码来源:load_h5data.py
示例16: main
def main():
os.chdir("daneA/set0")
for file in glob.glob("*.png"):
img = normalize_one_picture(file)
io.imshow(img)
print(file)
io.show()
return 0
开发者ID:khortur,项目名称:PiRO,代码行数:10,代码来源:projekt1.py
示例17: main
def main():
import skimage.io as io
import sys
if len(sys.argv) != 2:
print "Usage: skivi <image-file>"
sys.exit(-1)
io.use_plugin('qt')
io.imshow(io.imread(sys.argv[1]), fancy=True)
io.show()
开发者ID:Teva,项目名称:scikits.image,代码行数:11,代码来源:skivi.py
示例18: ApplyThresholdToImageRegion
def ApplyThresholdToImageRegion(image2, Tb, Bb, Lb, Rb,shouldThresholdImage):
image = rgb2gray(image2)
global foregroundPixelValue
global backgroundPixelValue
thresholdValue = threshold_otsu(image)
NumberOfRows = image.shape[0]
NumberOfColumns = image.shape[1]
numberOfBlackPixels = 0
numberOfWhitePixels = 0
selem = disk(3)
# simpe thresholding
for y in range(NumberOfRows):
for x in range(NumberOfColumns):
isWithinBoundary = IsWithinBoundary(y,x,image2, Tb, Bb, Lb, Rb,shouldThresholdImage)
if (isWithinBoundary):
if image[y,x] > thresholdValue:
#black
image[y,x] = 0
numberOfBlackPixels += 1
else:
#white
image[y,x] = 1
numberOfWhitePixels += 1
# assume foreground has more pixels in face region
if (numberOfWhitePixels > numberOfBlackPixels):
foregroundPixelValue = 1
backgroundPixelValue = 0
#print("foreground color is white")
else:
foregroundPixelValue = 0
backgroundPixelValue = 1
#print("foreground color is black")
image = opening(image,selem)
if (foregroundPixelValue == 0):
image = opening(image,selem)
else:
image = closing(image,selem)
if drawFaceImages:
io.imshow(image)
io.show()
return image
开发者ID:JimHowell20,项目名称:hw3,代码行数:54,代码来源:functions.py
示例19: show
def show(self,circle=False,data=None):
"""
Show the data in a debugging window.
"""
if data is None:
data = self.data
if circle:
io.imshow(self.data_with_circle())
else:
io.imshow(data)
io.show()
开发者ID:hbradlow,项目名称:em_hole_finder,代码行数:11,代码来源:pipeline.py
示例20: template_match_v2
def template_match_v2(refImg, newImg, thresHold):
res = cv2.matchTemplate(newImg, refImg, cv2.TM_CCOEFF_NORMED)
min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)
print min_val, max_val, min_loc, max_loc
top_left = max_loc
h , w, _ = refImg.shape
bottom_right = (top_left[0]+w,top_left[1]+h)
print (top_left, bottom_right)
cv2.rectangle(newImg, top_left, bottom_right, 255, 2)
show(newImg)
return newImg[top_left[1]:top_left[1]+h, top_left[0]:top_left[0]+w], (top_left, bottom_right)
开发者ID:KentChun33333,项目名称:VistinoEventDes,代码行数:11,代码来源:motion_tracking.py
注:本文中的skimage.io.show函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论