当前位置: 首页>>代码示例>>Python>>正文


Python Image.show方法代码示例

本文整理汇总了Python中SimpleCV.Image.show方法的典型用法代码示例。如果您正苦于以下问题:Python Image.show方法的具体用法?Python Image.show怎么用?Python Image.show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SimpleCV.Image的用法示例。


在下文中一共展示了Image.show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import show [as 别名]
def main():
    camera = cv2.VideoCapture('video2.avi')
    background_subtractor = cv2.BackgroundSubtractorMOG()

    # Store previous tracking image
    previous_track_image = Image()

    while camera.isOpened():
        is_success, image = camera.read()
        if is_success:
            mask = background_subtractor.apply(image, None, 0.1)
            # Vehicles will be detected from this image
            track_image = Image(ndimage.median_filter(mask, 3), cv2image=True)

            blobs = track_image.findBlobs(minsize=250, maxsize=800)

            if not blobs:
                # print('No Blobs Found.')
                continue
            else:
                # print("Width: {0}; Height: {1}".format(blobs[0].width(), blobs[0].height()))
                # Only keep near square blobs
                blobs = filter(lambda b: 0.25 < b.width() / b.height() < 4, blobs)

            # print("Found {0} Blobs. {1}".format(len(blobs)))

            if len(vehicle_track_set_list) == 0:
                # Find first batch of blobs
                for blob in blobs:
                    blob.drawRect(color=Color.BLUE, width=3, alpha=225)
                    # bounding_box = tuple(blob.boundingBox())
                    # print("Area: {0}".format(blob.area()))

                    track_set = track_image.track(method='mftrack', img=track_image, bb=blob.boundingBox())
                    if track_set:
                        vehicle_track_set_list.append(VehicleTrackSet(track_set))
                        track_set.drawBB(color=(255, 0, 0))
                        track_set.drawPath()
                        track_image.show()

            else:
                for blob in blobs:
                    blob.drawRect(color=Color.BLUE, width=3, alpha=225)
                    # print("Blob Coordinate: ({0}, {1}).".format(blob.x, blob.y))
                    update_track_set(track_image, previous_track_image, blob.boundingBox())

            # Save current image
            previous_track_image = track_image

            # time.sleep(0.1)
        else:
            camera.release()
            break
开发者ID:jeremysong,项目名称:CarsDetection,代码行数:55,代码来源:cars_detection.py

示例2: processQuote

# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import show [as 别名]
def processQuote(src):
	try:
		img = Image(src)
		text = img.binarize().readText()
	except Exception as e:
		print e
		print '###'
	else:
		cleantext = cleanText(text)
		translated = trans.translate(cleantext, langpair)
		if translated:
			img.drawText(translated, 0, 0, color=Color.BLACK, fontsize=24)
			print lan1 + ": " + cleantext
			print lan2 + ": " + translated.encode('utf-8')
			print '###'
		img.show()
开发者ID:pianiel,项目名称:simplecv-demo,代码行数:18,代码来源:quotes.py

示例3: visualize_consumer

# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import show [as 别名]
def visualize_consumer(to):
    """A consumer that visualizes the data on an image

    :param TrackerOut to: A TrackerOut objects that receives data
    """
    img = Image((600, 600))
    while True:
        to.flush()
        img.clearLayers()
        for pos, timestamp in to:
            for finger in pos:
                if finger is not None:
                    img.dl().rectangle2pts((finger[0]-4, finger[1]-4),
                                           (finger[0]+4, finger[1]+4),
                                           color=Color.RED,
                                           filled=True)
            print "{}: {}".format(int(timestamp), pos)
            img.show()
        to.clear()
    del img
开发者ID:DenerosArmy,项目名称:asterisk,代码行数:22,代码来源:util.py

示例4:

# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import show [as 别名]
#!/usr/bin/env python
#import the necessary packages


from sklearn.cluster import KMeans
import time
import matplotlib.pyplot as plt
import numpy as np

from SimpleCV import Image,Camera,Display,Image,Color


img=Image("lunarr2.jpg")#importamos la imagen a la cual deseamos determinarle los bordes
foto=img.show()




#imagen en escala de grises
imgGray=img.grayscale()
imgGray.save("grayLab2.png")
hist=imgGray.histogram(255)

plt.figure(1)
plt.plot(hist)
plt.savefig("histogray.png")


#imagen en escala RGB
(red,green,blue)=img.splitChannels(False)
开发者ID:franmir,项目名称:lab3-PDI,代码行数:32,代码来源:Bordes.py

示例5: Image

# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import show [as 别名]
#import the modules
import time
import SimpleCV
from SimpleCV import Image
from SimpleCV import Color

hay_alguien = Image("me.jpg")

win = hay_alguien.show()
time.sleep(3)
win.quit()

extraccion_color = hay_alguien.colorDistance(Color.BLACK)
win = extraccion_color.show()
time.sleep(3)
win.quit()

me = hay_alguien - extraccion_color
win = me.show()
time.sleep(3)
win.quit()

print('resultados primera comparacion:')
R = me.meanColor()[2]
print('R: ' + str(R))
G = me.meanColor()[1]
print('G: ' + str(G))
B = me.meanColor()[0]
print('B: ' + str(B))

cam = SimpleCV.Camera()
开发者ID:rcervantes-dev,项目名称:python-development,代码行数:33,代码来源:detect_me.py

示例6: Image

# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import show [as 别名]
#! /usr/bin/python2.7

# Program to Test Haar Features

import picamera
from SimpleCV import Image
import time

with picamera.PiCamera() as camera:
	camera.resolution = (640, 480)
	camera.start_preview()
	time.sleep(2)
	camera.capture('foto.jpg')
	foto = Image("foto.jpg")

	print(foto.listHaarFeatures())
	trovati = foto.findHaarFeatures('face.xml')
	if trovati:
		for trovato in trovati:
			print "Face Found at Coordinates : " + str(trovato.coordinates())
			trovato.draw()
	else:
		print "Not Found"
	camera.stop_preview()
	foto.save('foto1.jpg')
	foto.show()
	time.sleep(10)
开发者ID:team05guys,项目名称:421_521_final_project,代码行数:29,代码来源:test_Haar.py

示例7: read_puzzle_from_image

# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import show [as 别名]
        puzzle_repr, number_pictures = read_puzzle_from_image(raw_image, puzzle_image,
                                                              puzzle_offset_x, puzzle_offset_y)

        # If there are less than 17 numbers, we can't solve
        # or if there aren't 81 blocks
        print puzzle_repr
        if len(puzzle_repr) <> 81 or puzzle_repr.count('.') > 64:
            return

        # Solve the puzzle
        solved_puzzle = sudoku.solve(puzzle_repr)
        print solved_puzzle
        if not solved_puzzle:
            return

        print solved_puzzle
        # Place the solution on the original image and return
        augment_image_with_solution(raw_image, puzzle_offset_x, puzzle_offset_y,
                                    puzzle_image.width, puzzle_image.height, 
                                    puzzle_repr, solved_puzzle, number_pictures)

# Test
if __name__ == '__main__':
    # Load the Image
    raw_image = Image('images/sudoku.jpg')

    solve(raw_image)
    raw_image.show()
    raw_input()

开发者ID:jamescjackson,项目名称:cvarp-pytn,代码行数:31,代码来源:solver.py

示例8: Image

# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import show [as 别名]
import cv2
import cv2.cv as cv
from SimpleCV import Image

logo = Image('/Users/hackreactor/code/sheltowt/PIXLEE/coke_recognition/red_back.jpg')

machine = Image('/Users/hackreactor/code/sheltowt/PIXLEE/coke_recognition/coke_photos/93.png')

matches = machine.findTemplate(logo)

matches.draw(width=3)

machine.show()
cv.WaitKey(5000)

count = 0

for match in matches:
  count = count + 1

print(matches)

print(count)
开发者ID:sheltowt,项目名称:PIXLEE-public,代码行数:25,代码来源:image_recognition.py

示例9: Image

# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import show [as 别名]
from SimpleCV import Image

imgA = Image("ex20.png")

# Add the image to itself, generates a "brightness++" effect
imgA = imgA + imgA
imgA.show()
开发者ID:italofernandes84,项目名称:Python-SimpleCV_Course_Examples,代码行数:9,代码来源:ex20.py

示例10: Image

# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import show [as 别名]
#!/usr/bin/python
# apt-get install python-beautifulSoup

from SimpleCV import Image

webimg = Image("http://simplecv.s3.amazonaws.com/simplecv_lg.png")
webimg.show()
开发者ID:relsi,项目名称:Python-SimpleCV_Course_Examples,代码行数:9,代码来源:ex10.py

示例11: lasmanchas

# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import show [as 别名]
red.save("fotoenrojo.png")
green.save("fotoenverde.png")
blue.save("fotoenazul.png")

#codigo para encontrarn manchas solo se a echo en escala de grises  
prueba69=green.binarize() #la binarizo por que se vera mejor asi 
mancha=prueba69.findBlobs() #ocupo el comando para encontrar lasmanchas (lunares)
mancha.show(Color.YELLOW)
prueba69.save("porfavorguardate3.png")


invertidos=green.invert()#se invierte la imagen para obtener manchas negras en la foto
blob=invertidos.findBlobs()#se ve si se encuentrasn las mannchas en la foto invertida
blob.show(width=2)
pruebalunar.addDrawingLayer(invertidos.dl())
pruebalunar.show()
pruebalunar.save("porfavorguardate2.png") #guardamos la imagen 


#enncontrar manchas por color especifico para el cual tenemos:
brown_distance=green.colorDistance(Color.BLACK).invert()##cmo buscamos de color negro , le pknemos black 
blobs2_=brown_distance.findBlobs()
blobs2_.draw(color=Color.PUCE ,width=3)#se va  hacer el mismo ejemplo de la guia
brown_distance.show()
green.addDrawingLayer(brown_distance.dl())
green.show()
green.save("Porfavorguaradte5.png")

#lineas=pruebalunar.findLines()
#lineas.draw(width=3)
#pruebalunar.show()
开发者ID:yavier123,项目名称:lab3pdi2016,代码行数:33,代码来源:fotoslunar.py

示例12: Camera

# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import show [as 别名]
#!/usr/bin/python

from SimpleCV import Camera, Display, Image
import matplotlib.pyplot as plt
import time

cam = Camera()
img = cam.getImage().save("img.jpg")
img = Image("img.jpg")
img.show()
imgGray = img.grayscale().save("imgGray.jpg")
imgGray = Image("imgGray.jpg")
imgGray.show()
hist = imgGray.histogram(255)

(red, green, blue) = img.splitChannels(False)
red_histogram = red.histogram(255)
green_histogram = green.histogram(255)
blue_histogram = blue.histogram(255)
plt.figure(1)
plt.subplot(411)
plt.plot(hist)
plt.subplot(412)
plt.plot(red_histogram)
plt.subplot(413)
plt.plot(green_histogram)
plt.subplot(414)
plt.plot(blue_histogram)
plt.show()

print("Ingresar parametro para binarizar: ")
开发者ID:Grupopdicyf,项目名称:PDI_2016,代码行数:33,代码来源:Lab2PDI.py

示例13: Image

# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import show [as 别名]
__author__ = 'becks'
import time
from SimpleCV import Image

head = Image('head.png')

amgothic = Image('amgothic.png')

scream = Image('scream.png')

amgothic.dl().blit(head,(175, 110))

amgothic.show()

time.sleep(2)

layer = amgothic.getDrawingLayer()

scream.addDrawingLayer(layer)

scream.show()
time.sleep(2)

print amgothic._mLayers
print scream._mLayers

layer.blit(head,(75,220))

amgothic.show()
time.sleep(2)
scream.show()
开发者ID:vizcacha,项目名称:practicalcv,代码行数:33,代码来源:HeadOnSpike.py

示例14: Image

# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import show [as 别名]
 
display = SimpleCV.Display()

img = Image("ping/source/image3.jpeg")

# parametre pour image1 : (dilate=2), (stretch(200,255), isCircle(0.2)
# parametre pour image2 : non trouvé
# parametre pour image3 : (dilate=2), (stretch(2,120), isCircle(0.2)
# parametre pour image4 : (dilate=2), (stretch(2,120), isCircle(0.2)
# parametre pour image5 : (dilate=2), (stretch(2,120), isCircle(0.2)
# parametre pour image6 : plante
# parametre pour image7 : non trouvé
            
dist = img.colorDistance(SimpleCV.Color.ORANGE).dilate(2)

segmented = dist.stretch(2,120).invert()

blobs = segmented.findBlobs()

if blobs:

        balles = blobs.filter([b.isCircle(0.2) for b in blobs])
                
        if balles:
                for balle in balles:
                        img.drawCircle((balle.x,balle.y),balle.radius(),SimpleCV.Color.BLUE,3 )

img.show()


开发者ID:othebault,项目名称:Trackball,代码行数:30,代码来源:trackball3.py

示例15: Image

# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import show [as 别名]
from SimpleCV import Image
img = Image("logo")
# This will show the logo image in a web browser
img.show(type="browser")
开发者ID:2uanta,项目名称:SimpleCV-exercises,代码行数:6,代码来源:02-display-in-browser.py


注:本文中的SimpleCV.Image.show方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。