示例#1
0
文件: main.py 项目: tasuku246/gzo
def main():
	##input image files
	filename = 'images/DSC_0030.JPG'
#	filename = 'images/s_DSC_0030.JPG'
#	filename = 'images/redSpot.JPG'
	img = cv2.imread(filename,cv2.CV_LOAD_IMAGE_COLOR)

	hsv = cv2.cvtColor(img,cv2.COLOR_BGR2HSV)
	hue = hsv[:,:,0]
	saturation = hsv[:,:,1]
	meido = hsv[:,:,2]

	##process
	output_image,binary_img,area = getContactArea(img)

	## image output
	print 'area=',area,'[mm^2]'
	images = {'image':img,'hsv':hsv,'hue':hue,'saturation':saturation,'meido':meido,'red':output_image,'binary':binary_img}
	#images = {'image':img,'ContactArea':output_image}
	myCV.displayImages(images)
示例#2
0
文件: main.py 项目: tasuku246/gazou
def main(filename):
	img = cv2.imread(filename,cv2.CV_LOAD_IMAGE_COLOR)
	cv2.imwrite('res' + filename,img)

	hsv = cv2.cvtColor(img,cv2.COLOR_BGR2HSV)
	hue = hsv[:,:,0]
	saturation = hsv[:,:,1]
	meido = hsv[:,:,2]


	##process
	output_image,binary_img,area = getContactArea(img)

	## image output
	print 'area=',area,'[mm^2]'
	f.write(str(area) + '\t' + filename + '\n')
	cv2.imwrite(filename,img)

	images = {'image':img,'hsv':hsv,'hue':hue,'saturation':saturation,'meido':meido,'red':output_image,'binary':binary_img}
	#images = {'image':img,'ContactArea':output_image}
	myCV.displayImages(images)