Skip to content

Commit 4d5ad03

Browse files
Add files via upload
0 parents  commit 4d5ad03

16 files changed

Lines changed: 322 additions & 0 deletions
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#calculation project
2+
3+
num1=int(input("enter num1 number:"))
4+
num2=int(input("enter num1 number:"))
5+
operator=input()
6+
if operator == "+":
7+
print(f"adddition of{num1+num2}")
8+
elif operator == "-":
9+
print(f"subtraction of{num1-num2}")
10+
elif operator == "/":
11+
print(f"division of{num1/num2}")
12+
elif operator == "*":
13+
print(f"multipication of{num1*num2}")
14+
else:
15+
print("invalid numbers")

python programming/decision.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
w=input()
2+
if w==sunny:
3+
print("hello world")
4+
else:
5+
print("hi")
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
a=100
2+
a=float(a)
3+
print(type(a))
4+
print(a)

python programming/gradeproblem.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
m=int(input("maths marks:"))
2+
s=int(input("science marks:"))
3+
p=int(input("physics marks:"))
4+
total=m+s+p
5+
average=total/3
6+
percentage=(total/300)*100
7+
grade=""
8+
if percentage > 90:
9+
grade="A"
10+
elif percentage > 80:
11+
grade="B"
12+
elif percentage > 70:
13+
grade="C"
14+
elif percentage > 60:
15+
grade="D"
16+
else:
17+
grade="p"
18+
print(total)
19+
print(average)
20+
print(grade)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
a=input()
2+
x,y,z=a.split(",")
3+
num1=int(x)
4+
num2=int(y)
5+
num3=int(z)
6+
if num1>num2:
7+
if num1>num3:
8+
great=num1
9+
else:
10+
great=num3
11+
elif num2>num1:
12+
if num2>num3:
13+
great=num2
14+
else:
15+
great=num3
16+
elif num3>num1:
17+
if num3>num2:
18+
great=num3
19+
else:
20+
great=num2
21+
print(great)

python programming/leapproblem.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
year=int(input())
2+
leap=False
3+
if year%100==0 and year%400!=0:
4+
leap=False
5+
elif year%4==0:
6+
leap=True
7+
else:
8+
leap=True
9+
print(leap)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import cv2
2+
#img1=cv2.imread(r"c:\Users\POOJA\Downloads\ganesha.jpg",1)
3+
#img1=cv2.resize(img1,(1000,800))
4+
#cv2.imshow("colored image",img1)
5+
#print("give image with color==\n",img1)
6+
#cv2.waitKey(0)
7+
#cv2.destroyAllWindows()
8+
9+
##cv2.imread_grayscale or use 0 for black and white
10+
#img1=cv2.imread(r"c:\Users\POOJA\Downloads\ganesha.jpg",0)
11+
#img1=cv2.resize(img1,(1000,800))
12+
#cv2.imshow("gray scale",img1)
13+
#print("give image with grayscale==\n",img1)
14+
#cv2.waitKey(0)
15+
16+
##cv2.imread_unchanged loads image as such inluding alpha
17+
#img1=cv2.imread(r"c:\Users\POOJA\Downloads\ganesha.jpg",-1)
18+
#img1=cv2.resize(img1,(1000,800))
19+
#cv2.imshow("original image",img1)
20+
#print("image in original==\n",img1)
21+
#cv2.waitKey(0)
22+
23+
#image coverting image into gray
24+
img1=cv2.imread(r"c:\Users\POOJA\Downloads\ganesha.jpg",0)
25+
img1=cv2.resize(img1,(560,800))
26+
img1=cv2.flip(img1,-1)#rotating the with it have 3 parameters like 1,-1,0
27+
cv2.imshow("gray scale",img1)
28+
word =cv2.waitKey(0)& 0xFF
29+
if word == ord("q"):
30+
cv2.destroyAllWindows()
31+
elif word == ord("s"):
32+
cv2.imwrite("output.png",img1)# if it accepts this it will save the image in the file path
33+
cv2.destroyAllWindows()
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import cv2
2+
from pyzbar.pyzbar import decode
3+
import webbrowser
4+
5+
# Open webcam
6+
cap = cv2.VideoCapture(0)
7+
8+
opened_links = set()
9+
10+
while True:
11+
success, frame = cap.read()
12+
13+
# Detect QR codes
14+
for qr in decode(frame):
15+
data = qr.data.decode('utf-8')
16+
points = qr.polygon
17+
18+
# Draw rectangle
19+
x, y, w, h = qr.rect
20+
cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 3)
21+
22+
# Show text
23+
cv2.putText(frame, data, (x, y - 10),
24+
cv2.FONT_HERSHEY_SIMPLEX,
25+
0.5, (255, 0, 0), 2)
26+
27+
print("QR Code:", data)
28+
29+
# Open link only once
30+
if data.startswith("http") and data not in opened_links:
31+
webbrowser.open(data)
32+
opened_links.add(data)
33+
34+
# Show camera
35+
cv2.imshow("QR Scanner", frame)
36+
37+
# Press Q to quit
38+
if cv2.waitKey(1) & 0xFF == ord('q'):
39+
break
40+
41+
cap.release()
42+
cv2.destroyAllWindows()
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import cv2
2+
import webbrowser
3+
4+
# Initialize Webcam
5+
cap = cv2.VideoCapture(0)
6+
cap.set(3, 1280) ## width
7+
cap.set(4, 720) ## height
8+
9+
# Built-in OpenCV QR Detector
10+
detector = cv2.QRCodeDetector()
11+
12+
print("QR Scanner is running... Press 'q' to quit.")
13+
14+
last_data = None
15+
16+
while True:
17+
success, img = cap.read()
18+
if not success:
19+
break
20+
21+
# Detect and Decode
22+
data, bbox, _ = detector.detectAndDecode(img)
23+
24+
# If a QR code is found
25+
if bbox is not None:
26+
# FIXED: Reshaping the bbox to a simple 4x2 array
27+
bbox = bbox.reshape(-1, 2)
28+
29+
for i in range(len(bbox)):
30+
# Draw green bounding box using integer coordinates
31+
pt1 = tuple(bbox[i].astype(int))
32+
pt2 = tuple(bbox[(i+1) % len(bbox)].astype(int))
33+
cv2.line(img, pt1, pt2, (0, 255, 0), 3)
34+
35+
if data:
36+
# Place text near the top corner of the box
37+
cv2.putText(img, "QR Detected!", (int(bbox[0][0]), int(bbox[0][1]) - 10),
38+
cv2.FONT_HERSHEY_SIMPLEX, 0.8, (0, 255, 0), 2)
39+
40+
if data != last_data:
41+
print(f"Decoded Data: {data}")
42+
if data.startswith("http"):
43+
webbrowser.open(data)
44+
last_data = data
45+
46+
cv2.imshow("OpenCV QR Scanner", img)
47+
48+
if cv2.waitKey(1) & 0xFF == ord('q'):
49+
break
50+
51+
cap.release()
52+
cv2.destroyAllWindows()
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import numpy as np
2+
import cv2
3+
img=cv2.imread(r"c:\Users\POOJA\Downloads\ganesha.jpg")
4+
img=cv2.resize(img,(600,700))
5+
6+
## if we want black background we use zeros or for white we use ones
7+
img=np.zeros([512,512,3],np.uint8)*255
8+
img=np.ones([512,512,3],np.uint8)*255
9+
10+
## shapes(starting,ending,color,thicknes)
11+
img=cv2.line(img,(0,0),(200,200),(154,92,428),8)
12+
img=cv2.arrowedLine(img,(0,125),(255,255),(255,0,125),10)
13+
img=cv2.rectangle(img,(384,10),(510,128),(128,0,255),8)
14+
img=cv2.cricle(img,(447,125),63,(213,255,0)-5)
15+
img=cv2.ellipse(img,(400,600),(100,50),0,180,155,5)
16+
pts=np.array([[100,150],[200,300],[170,20],[50,10]],np.int32)
17+
pts=pts.reshape((-1,1,2))
18+
img=cv2.polylines(img,[pts],True,(0,255,155))
19+
20+
##font text
21+
font=cv2.FONT_ITALIC
22+
img=cv2.putText(img,'THOR',(20,500),font,4,(0,125,255))
23+
24+
cv2.imshow("image",img)
25+
cv2.waitKey(0)
26+
cv2.destroyAllWindows()

0 commit comments

Comments
 (0)