Created
September 13, 2016 03:20
-
-
Save sriharsha0806/7658ddeab2a7603ebc8fa6878e788274 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Created on Wed Aug 31 17:40:33 2016 | |
@author: sriharsha | |
""" | |
import cv2 | |
img = cv2.imread('Tom-and-Jerry-014.jpg') | |
cv2.imshow('img',img) | |
cv2.waitKey(100) | |
# Read an RGB image and plot three color bands R,G,B in separate space | |
cv2.imshow('B_image',img[:,:,0]) | |
cv2.waitKey(100) | |
cv2.imwrite('B_image.tif',img[:,:,0]) | |
cv2.imshow('G_image',img[:,:,1]) | |
cv2.waitKey(100) | |
cv2.imwrite('G_image.tif',img[:,:,1]) | |
cv2.imshow('R-image',img[:,:,2]) | |
cv2.waitKey(100) | |
cv2.imwrite('R-image.tif',img[:,:,2]) | |
# Convert RGB image to hsv and plot H, and V bands | |
hsv_img = cv2.cvtColor(img,cv2.COLOR_BGR2HSV) | |
cv2.imshow('hsv_image.',hsv_img) | |
cv2.waitKey(100) | |
cv2.imwrite('hsv_image.tif',hsv_img) | |
cv2.imshow('h_image',hsv_img[:,:,0]) | |
cv2.waitKey(100) | |
cv2.imwrite('h_image.tif',hsv_img[:,:,0]) | |
cv2.imshow('v_image',hsv_img[:,:,2]) | |
cv2.waitKey(100) | |
cv2.imwrite('v_image.tif',hsv_img[:,:,2]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment