We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
0 parents commit 4d5ad03Copy full SHA for 4d5ad03
16 files changed
python programming/calculator_project.py
@@ -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
@@ -0,0 +1,5 @@
+w=input()
+if w==sunny:
+ print("hello world")
+ else:
+ print("hi")
python programming/first_program.py
@@ -0,0 +1,4 @@
+a=100
+a=float(a)
+print(type(a))
+print(a)
python programming/gradeproblem.py
@@ -0,0 +1,20 @@
+m=int(input("maths marks:"))
+s=int(input("science marks:"))
+p=int(input("physics marks:"))
+total=m+s+p
+average=total/3
+percentage=(total/300)*100
+grade=""
+if percentage > 90:
+ grade="A"
+elif percentage > 80:
+ grade="B"
+elif percentage > 70:
+ grade="C"
+elif percentage > 60:
+ grade="D"
16
17
+ grade="p"
18
+print(total)
19
+print(average)
20
+print(grade)
python programming/largestnumber.py
@@ -0,0 +1,21 @@
+a=input()
+x,y,z=a.split(",")
+num1=int(x)
+num2=int(y)
+num3=int(z)
+if num1>num2:
+ if num1>num3:
+ great=num1
+ great=num3
+elif num2>num1:
+ if num2>num3:
+ great=num2
+elif num3>num1:
+ if num3>num2:
21
+print(great)
python programming/leapproblem.py
@@ -0,0 +1,9 @@
+year=int(input())
+leap=False
+if year%100==0 and year%400!=0:
+ leap=False
+elif year%4==0:
+ leap=True
+print(leap)
python programming/opencv.py/image_reading_save.py
@@ -0,0 +1,33 @@
+import cv2
+#img1=cv2.imread(r"c:\Users\POOJA\Downloads\ganesha.jpg",1)
+#img1=cv2.resize(img1,(1000,800))
+#cv2.imshow("colored image",img1)
+#print("give image with color==\n",img1)
+#cv2.waitKey(0)
+#cv2.destroyAllWindows()
+##cv2.imread_grayscale or use 0 for black and white
+#img1=cv2.imread(r"c:\Users\POOJA\Downloads\ganesha.jpg",0)
+#cv2.imshow("gray scale",img1)
+#print("give image with grayscale==\n",img1)
+##cv2.imread_unchanged loads image as such inluding alpha
+#img1=cv2.imread(r"c:\Users\POOJA\Downloads\ganesha.jpg",-1)
+#cv2.imshow("original image",img1)
+#print("image in original==\n",img1)
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
python programming/opencv.py/project.py
@@ -0,0 +1,42 @@
+from pyzbar.pyzbar import decode
+import webbrowser
+# Open webcam
+cap = cv2.VideoCapture(0)
+opened_links = set()
+while True:
+ success, frame = cap.read()
+ # Detect QR codes
+ for qr in decode(frame):
+ data = qr.data.decode('utf-8')
+ points = qr.polygon
+ # Draw rectangle
+ x, y, w, h = qr.rect
+ cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 3)
+ # Show text
+ cv2.putText(frame, data, (x, y - 10),
+ cv2.FONT_HERSHEY_SIMPLEX,
+ 0.5, (255, 0, 0), 2)
+ print("QR Code:", data)
+ # Open link only once
+ if data.startswith("http") and data not in opened_links:
+ webbrowser.open(data)
+ opened_links.add(data)
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()
python programming/opencv.py/project_orcode.py
@@ -0,0 +1,52 @@
+# Initialize Webcam
+cap.set(3, 1280) ## width
+cap.set(4, 720) ## height
+# Built-in OpenCV QR Detector
+detector = cv2.QRCodeDetector()
+print("QR Scanner is running... Press 'q' to quit.")
+last_data = None
+ success, img = cap.read()
+ if not success:
+ # Detect and Decode
+ data, bbox, _ = detector.detectAndDecode(img)
+ # If a QR code is found
+ if bbox is not None:
+ # FIXED: Reshaping the bbox to a simple 4x2 array
+ bbox = bbox.reshape(-1, 2)
+ for i in range(len(bbox)):
+ # Draw green bounding box using integer coordinates
+ pt1 = tuple(bbox[i].astype(int))
+ pt2 = tuple(bbox[(i+1) % len(bbox)].astype(int))
+ cv2.line(img, pt1, pt2, (0, 255, 0), 3)
+ if data:
+ # Place text near the top corner of the box
+ cv2.putText(img, "QR Detected!", (int(bbox[0][0]), int(bbox[0][1]) - 10),
+ cv2.FONT_HERSHEY_SIMPLEX, 0.8, (0, 255, 0), 2)
+ if data != last_data:
+ print(f"Decoded Data: {data}")
+ if data.startswith("http"):
43
44
+ last_data = data
45
46
+ cv2.imshow("OpenCV QR Scanner", img)
47
48
49
50
51
52
python programming/opencv.py/shapes_text.py
@@ -0,0 +1,26 @@
+import numpy as np
+img=cv2.imread(r"c:\Users\POOJA\Downloads\ganesha.jpg")
+img=cv2.resize(img,(600,700))
+## if we want black background we use zeros or for white we use ones
+img=np.zeros([512,512,3],np.uint8)*255
+img=np.ones([512,512,3],np.uint8)*255
+## shapes(starting,ending,color,thicknes)
+img=cv2.line(img,(0,0),(200,200),(154,92,428),8)
+img=cv2.arrowedLine(img,(0,125),(255,255),(255,0,125),10)
+img=cv2.rectangle(img,(384,10),(510,128),(128,0,255),8)
+img=cv2.cricle(img,(447,125),63,(213,255,0)-5)
+img=cv2.ellipse(img,(400,600),(100,50),0,180,155,5)
+pts=np.array([[100,150],[200,300],[170,20],[50,10]],np.int32)
+pts=pts.reshape((-1,1,2))
+img=cv2.polylines(img,[pts],True,(0,255,155))
+##font text
+font=cv2.FONT_ITALIC
+img=cv2.putText(img,'THOR',(20,500),font,4,(0,125,255))
+cv2.imshow("image",img)
+cv2.waitKey(0)
0 commit comments