Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
AshishSardana committed May 6, 2017
0 parents commit 3131c57
Show file tree
Hide file tree
Showing 35 changed files with 439 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added 1-Neonatal Jaunice Detection/Scripts/drawing.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions 1-Neonatal Jaunice Detection/Scripts/hack_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import numpy as np
import cv2
from matplotlib import pyplot as plt

x = np.random.randint(25,100,25)
y = np.random.randint(175,255,25)
z = np.hstack((x,y))
z = z.reshape((50,1))
z = np.float32(z)
plt.hist(z,256,[0,256]),plt.show()

# Define criteria = ( type, max_iter = 10 , epsilon = 1.0 )
criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 10, 1.0)

# Set flags (Just to avoid line break in the code)
flags = cv2.KMEANS_RANDOM_CENTERS

# Apply KMeans
compactness,labels,centers = cv2.kmeans(z,2, criteria,10,flags)

A = z[labels==0]
B = z[labels==1]
46 changes: 46 additions & 0 deletions 1-Neonatal Jaunice Detection/Scripts/skinDetect_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Required modules
import cv2
import numpy

# Constants for finding range of skin color in YCrCb
min_YCrCb = numpy.array([0,133,77],numpy.uint8)
max_YCrCb = numpy.array([255,173,127],numpy.uint8)

# Create a window to display the camera feed
cv2.namedWindow('Camera Output')

# Get pointer to video frames from primary device
videoFrame = cv2.VideoCapture(0)

# Process the video frames
keyPressed = -1 # -1 indicates no key pressed

while(keyPressed < 0): # any key pressed has a value >= 0

# Grab video frame, decode it and return next video frame
readSucsess, sourceImage = videoFrame.read()

# Convert image to YCrCb
imageYCrCb = cv2.cvtColor(sourceImage,cv2.COLOR_BGR2YCR_CB)

# Find region with skin tone in YCrCb image
skinRegion = cv2.inRange(imageYCrCb,min_YCrCb,max_YCrCb)

# Do contour detection on skin region
contours, hierarchy = cv2.findContours(skinRegion, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)

# Draw the contour on the source image
for i, c in enumerate(contours):
area = cv2.contourArea(c)
if area > 1000:
cv2.drawContours(sourceImage, contours, i, (0, 255, 0), 3)

# Display the source image
cv2.imshow('Camera Output',sourceImage)

# Check for user input to close program
keyPressed = cv2.waitKey(2) # wait 2 millisecond in each iteration of while loop

# Close window and camera after exiting the while loop
cv2.destroyWindow('Camera Output')
videoFrame.release()
61 changes: 61 additions & 0 deletions 1-Neonatal Jaunice Detection/Scripts/skindetect.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

# Required modules
import cv2
import numpy
from colorthief import ColorThief

# Constants for finding range of skin color in YCrCb
min_YCrCb = numpy.array([0,133,77],numpy.uint8)
max_YCrCb = numpy.array([255,173,127],numpy.uint8)


# Create a window to display the camera feed
cv2.namedWindow('Camera Output')

# Get pointer to video frames from primary device
# videoFrame = cv2.VideoCapture(0)

# Process the video frames
keyPressed = -1 # -1 indicates no key pressed

while(keyPressed < 0): # any key pressed has a value >= 0

# Grab video frame, decode it and return next video frame
# readSucsess, sourceImage = videoFrame.read()
sourceImage = cv2.imread('try.jpg')
# print sourceImage.shape

# Convert image to YCrCb
imageYCrCb = cv2.cvtColor(sourceImage,cv2.COLOR_BGR2YCR_CB)

# Find region with skin tone in YCrCb image
skinRegion = cv2.inRange(imageYCrCb,min_YCrCb,max_YCrCb)

#Morphology
#se = numpy.ones((1,1), dtype='uint8')
#image_close = cv2.morphologyEx(skinRegion, cv2.MORPH_CLOSE, se)
#cv2.imshow('camera_ouput', image_close)
#cv2.waitKey(0)

# Do contour detection on skin region
contours, hierarchy = cv2.findContours(skinRegion, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)

# Draw the contour on the source image
for i, c in enumerate(contours):
area = cv2.contourArea(c)
if area > 1000:
cv2.drawContours(sourceImage, contours, i, (0, 255, 0), 3)

# Display the source image
cv2.imshow('Camera Output',sourceImage)
color_thief = ColorThief('try.jpg')

dominant_color = color_thief.get_color(quality=1)
print dominant_color

# Check for user input to close program
keyPressed = cv2.waitKey(2) # wait 2 millisecond in each iteration of while loop

# Close window and camera after exiting the while loop
cv2.destroyWindow('Camera Output')
videoFrame.release()
Binary file added 1-Neonatal Jaunice Detection/Scripts/try.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 69 additions & 0 deletions 2-Smart Medical Record/Python/excel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Importing libraries
import openpyxl
import smtplib
import sys
from openpyxl.utils import get_column_letter, column_index_from_string

# Initial constants
breakfastCalorie = 95
lunchCalorie = 150
dinnerCalorie = 135
wb = openpyxl.load_workbook('mealRecord.xlsx')
sheet = wb.get_active_sheet()

maxRows = sheet.max_row
name = {}
email = {}
currentP = 0
currentM = ''

# Initializing total for 4 weeks
totalIndex = 11
for i in range(4):
for index in range(2, maxRows-2, 3):
sheet[get_column_letter(totalIndex)+str(index+2)] = int(0)
totalIndex = totalIndex + 1

totalIndex = 11

i = 1
# Storing names
for index in range(2, maxRows-2, 3):
name[i] = sheet.cell(row = index, column = 1).value
i = i + 1

i = 1
# Storing emails
for index in range(2, maxRows-2, 3):
email[i] = sheet.cell(row = index, column = 2).value
i = i + 1

def rowNo(currentM):
if currentM == 'b':
return 2
elif currentM == 'l':
return 3
elif currentM == 'd':
return 4

def calorie(currentM):
if currentM == 'b':
return breakfastCalorie
elif currentM == 'l':
return lunchCalorie
elif currentM == 'd':
return dinnerCalorie

# Writing values for Day-1
def writeToDay(day, currentP, currentM):
if (currentP==1):
sheet[get_column_letter(2+day) + str(rowNo(currentM))] = calorie(currentM)
else:
sheet[get_column_letter(2+day) + str(rowNo(currentM) + 3*(currentP-1))] = calorie(currentM)

# Total calories
def totalCalories(totalIndex):
for index in range(2, maxRows-2, 3):
sheet['J'+str(index+2)] = '=SUM(\'C\'+str(index):\'E\'+str(index+2))'
sheet[get_column_letter(totalIndex)+str(index+2)] = sheet['J'+str(index+2)].value
totalIndex = totalIndex + 1
69 changes: 69 additions & 0 deletions 2-Smart Medical Record/Python/excel1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Importing libraries
import openpyxl
import smtplib
import sys
from openpyxl.utils import get_column_letter, column_index_from_string

# Initial constants
breakfastCalorie = 95
lunchCalorie = 150
dinnerCalorie = 135
wb = Workbook()
sheet = wb.get_active_sheet()

maxRows = sheet.max_row
name = {}
email = {}
currentP = 0
currentM = ''

# Initializing total for 4 weeks
totalIndex = 11
for i in range(4):
for index in range(2, maxRows-2, 3):
sheet[get_column_letter(totalIndex)+str(index+2)] = int(0)
totalIndex = totalIndex + 1

totalIndex = 11

i = 1
# Storing names
for index in range(2, maxRows-2, 3):
name[i] = sheet.cell(row = index, column = 1).value
i = i + 1

i = 1
# Storing emails
for index in range(2, maxRows-2, 3):
email[i] = sheet.cell(row = index, column = 2).value
i = i + 1

def rowNo(currentM):
if currentM == 'b':
return 2
elif currentM == 'l':
return 3
elif currentM == 'd':
return 4

def calorie(currentM):
if currentM == 'b':
return breakfastCalorie
elif currentM == 'l':
return lunchCalorie
elif currentM == 'd':
return dinnerCalorie

# Writing values for Day-1
def writeToDay(day, currentP, currentM):
if (currentP==1):
sheet[get_column_letter(2+day) + str(rowNo(currentM))] = calorie(currentM)
else:
sheet[get_column_letter(2+day) + str(rowNo(currentM) + 3*(currentP-1))] = calorie(currentM)

# Total calories
def totalCalories(totalIndex):
for index in range(2, maxRows-2, 3):
sheet['J'+str(index+2)] = '=SUM(\'C\'+str(index):\'E\'+str(index+2))'
sheet[get_column_letter(totalIndex)+str(index+2)] = sheet['J'+str(index+2)].value
totalIndex = totalIndex + 1
Binary file added 2-Smart Medical Record/Python/mealRecord.xlsx
Binary file not shown.
Binary file added 2-Smart Medical Record/Python/newMealsRecord.xlsx
Binary file not shown.
46 changes: 46 additions & 0 deletions 2-Smart Medical Record/Python/sendDuesReminder.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import openpyxl
import smtplib
import sys


wb = openpyxl.load_workbook('duesRecords.xlsx')
sheet = wb.get_sheet_by_name('Sheet1')

lastCol = sheet.get_highest_column()

unpaidMembers = {}

for r in range(2, sheet.get_highest_row()+1):
payment = sheet.cell(row=r, column=lastCol).value
if payment != 'paid':
name = sheet.cell(row=r, column=1).value
email = sheet.cell(row=r, column=2).value
unpaidMembers[name] = email


#login details
smtpObj = smtplib.SMTP('smtp.gmail.com', 587)
smtpObj.ehlo()
smtpObj.starttls()
smtpObj.login(' ashishsardana21@gmail.com ','aufweidersehen')


for name, email in unpaidMembers.items():
body = "Subject: Pay your fee for the event..!!"
print('Sending email to %s...' % email)
sendmailStatus = smtpObj.sendmail('ashishsardana21@gmail', email, body)
if sendmailStatus != {}:
print('There was a problem sending email to %s: %s' % (email,
sendmailStatus))

smtpObj.quit()










23 changes: 23 additions & 0 deletions 2-Smart Medical Record/Python/try_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from openpyxl import Workbook
from openpyxl.compat import range
from openpyxl.utils import get_column_letter
wb = Workbook()
dest_filename = 'empty_book1.xlsx'


ws1 = wb.active
ws1.title = "range names"


for row in range(1, 40):
ws1.append(range(600))
ws2 = wb.create_sheet(title="Pi")

ws2['F5'] = 3.14
ws3 = wb.create_sheet(title="Data")
for row in range(10, 20):
for col in range(27, 54):
_ = ws3.cell(column=col, row=row, value="{0}".format(get_column_letter(col)))
print(ws3['AA10'].value)

wb.save(filename = dest_filename)
56 changes: 56 additions & 0 deletions 2-Smart Medical Record/sending_data/sending_data.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#include <SPI.h>
#include <MFRC522.h>

#define SS_PIN 10
#define RST_PIN 9

MFRC522 rfid(SS_PIN, RST_PIN);

void setup() {
Serial.begin(9600);
SPI.begin(); // Init SPI bus
rfid.PCD_Init();
}

void loop() {

// Look for new cards
if ( ! rfid.PICC_IsNewCardPresent())
return;

// Verify if the NUID has been readed
if ( ! rfid.PICC_ReadCardSerial())
return;
sendHex(rfid.uid.uidByte, rfid.uid.size);
Serial.println();
rfid.PICC_HaltA();
rfid.PCD_StopCrypto1();
}


void sendHex(byte *buffer, byte bufferSize)
{
byte t[4][4] = {{150,83,190,147},{194,150,179,171},{186,77,173,181},{66,03,174,181}};
byte temp[4];
byte c=0,s=0;
Serial.println(bufferSize);
for (byte i = 0; i < bufferSize; i++) {
Serial.print(buffer[i] < 0x10 ? " 0" : " ");
Serial.println(buffer[i]);
temp[i]=buffer[i];
}

for(byte j=0;j<4;j++)
{
for(byte k=0;k<4;k++)
{
if(temp[k]==t[j][k])
c++;
}
if(c==4)
s=j+1
c=0;
}
Serial.println(s);
}

Loading

0 comments on commit 3131c57

Please sign in to comment.