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
#Splitting image into Blue, Green, Red channels | |
#Method 1 | |
b,g,r = cv2.split(img) | |
#Method 2 | |
b = img[:,:,0] | |
g = img[:,:,1] | |
r = img[:,:,2] | |
vis2 = np.concatenate((b, g, r), axis=1) |
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
#Image ROI | |
img_roi = img.copy() | |
ball = img_roi[310:370, 350:405] | |
img_roi[120:180, 120:175] = ball | |
vis1 = np.concatenate((img, img_roi), axis=1) | |
cv2.imshow('Original Image vs Image with copied ROI', vis1) | |
cv2.waitKey(0) | |
cv2.destroyAllWindows() |
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
#Accessing Image Properties | |
print("Shape of the Image: ", img.shape) | |
print("Total number of pixels in images: ", img.size) | |
print("Datatype of the images: ", img.dtype) |
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
#Acessing Red value in coordinates (50, 50) | |
print("Pixel value of Red in (50,50) coordinate: ", img_mod1.item(50,50,2)) | |
# modifying Red value in coordinates (50, 50) | |
img_mod1.itemset((50,50,2), 225) | |
print("Pixel value of Red in (50,50) coordinate after modification: ", img_mod1.item(50,50,2)) | |
cv2.imshow('Billiards Modified', img_mod1) | |
cv2.waitKey(0) | |
cv2.destroyAllWindows() |
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
#Modifying pixel values | |
img_mod1 = img.copy() | |
img_mod1[100,100] = [255,255,255] | |
print("Pixel value in (100,100) coordinate after modification: ", img_mod1[100,100] ) | |
cv2.imshow('Billiards Modified', img_mod1) | |
cv2.waitKey(0) | |
cv2.destroyAllWindows() |
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
#Accessing BGR value of pixel in coordinates 100,100 | |
pixel = img[100,100] | |
print("Pixel value in (100,100) coordinate: ", pixel) | |
#Accessing blue, Red, Green pixel individually | |
blue = img[100,100,0] | |
green = img[100,100,1] | |
red = img[100,100,2] | |
print("Pixel value of Blue in (100,100) coordinate: ", blue) |
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
import numpy as np | |
import cv2 | |
img = cv2.imread('C:\\Users\\Admin\\Downloads\\operations on images\\Billiards.jpg') |
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
import gensim | |
from gensim.summarization import summarize | |
summary = summarize(text) | |
print(summary) |
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
doc_lda_test = lda_model[test_corpus] | |
print("Topic Distribution in the test article: ", doc_lda_test[0]) |
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
test_article = "wipro beats forecasts once again wipro india s thirdbiggest software firm has reported a 60 percent rise in profit topping market expectations net income in the last quarter was 43bn rupees dollar 98m 52m against 27bn a year earlier profit had been forecast to be 41bn rupees wipro offers services such as call centres to foreign clients and has worked for more than half of the companies on the fortune 500 list wipro said demand was strong allowing it to increase the prices it charged on the face of it the results don t look very exciting said apurva shah an analyst at askraymond james but the guidance is positive and pricing going up is good news thirdquarter sales rose 34 percent to 209bn rupees one problem identified by wipro was the high turnover of its staff it said that 90 percent of employees at its business process outsourcing operations had had to be replaced we have to get that under control said vicechairman vivek paul wipro is majority owned by india s richest man azim premji" |