-
Notifications
You must be signed in to change notification settings - Fork 15
Solved task1, task2, task4 and task7 #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
+97
−0
Closed
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
34859ed
Solved task1 and task4
SakshiKalunge07 3022002
Task2.py added
SakshiKalunge07 e4dbd86
task7.py added
SakshiKalunge07 28ee536
corrected task2.py
SakshiKalunge07 a1fbb15
Merge branch 'ProjectX-VJTI:main' into main
SakshiKalunge07 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| Name:- Sakshi Kalunge | ||
| Registration ID:- 241071032 | ||
| Branch:- Computer Engineering | ||
| College email ID:- [email protected] |
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.
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import cv2 | ||
| image=cv2.imread("Task1.png") | ||
| img =cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) | ||
| count=0 | ||
| positions=[] | ||
| for y in range (img.shape[0]): | ||
| for x in range (img.shape[1]): | ||
| if img[y][x]!=255: | ||
| count+=1 | ||
| positions.append((y,x)) | ||
| print(count) | ||
| print(positions) | ||
|
|
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import cv2 | ||
|
|
||
| image=cv2.imread("Task2.png") | ||
| image =cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) | ||
|
|
||
| morse_code="" | ||
| for y in range(image.shape[0]): | ||
| for x in range(image.shape[1]): | ||
| if image[y][x]==0: | ||
| morse_code+="-" | ||
| elif image[y][x]==255: | ||
| morse_code+="." | ||
| elif image[y][x] in range(120,220): | ||
| morse_code+=" " | ||
|
|
||
| print(morse_code) | ||
|
|
||
|
|
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import cv2 as cv | ||
|
|
||
| image =cv.imread('Task4.png') | ||
|
|
||
| image=cv.cvtColor(image,cv.COLOR_BGR2GRAY) | ||
|
|
||
| sumofpixel=0 | ||
| noofpixel=0 | ||
| norm=image.tolist() | ||
| noofpixel=image.shape[0]*image.shape[1] | ||
|
|
||
| for y in range(image.shape[0]): | ||
| for x in range(image.shape[1]): | ||
| sumofpixel=sumofpixel+norm[y][x] | ||
| thv=sumofpixel/noofpixel | ||
|
|
||
| count=0 | ||
| max=0 | ||
| for y in range(image.shape[0]): | ||
| for x in range(image.shape[1]): | ||
| if image[y][x]<thv: | ||
| image[y][x]=0 | ||
| else: | ||
| image[y][x]=255 | ||
|
|
||
| for y in range(image.shape[0]): | ||
| for x in range(image.shape[1]): | ||
| if image[y][x]==0: | ||
| count+=1 | ||
| else: | ||
| if(count>max):max=count | ||
| count=0 | ||
|
|
||
| print(max*max) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import cv2 | ||
| import numpy as np | ||
| height,width=500,500 | ||
|
|
||
| image=np.ones((height,width,3),dtype=np.uint8)*255 | ||
| image[:]=(230,215,170) | ||
|
|
||
| cv2.line(image,(0,500),(500,500),(32,46,126),30) | ||
|
|
||
| cv2.rectangle(image,(140,300),(354,500),(111,198,255),-1) | ||
|
|
||
| triangle= np.array([[140,300],[247,200],[354,300]],np.int32) | ||
| cv2.fillPoly(image,[triangle],(237,126,213)) | ||
|
|
||
| cv2.rectangle(image,(230,380),(270,500),(248,173,232),-1) | ||
|
|
||
| cv2.rectangle(image,(165,340),(200,370),(172,245,255),-1) | ||
|
|
||
| cv2.rectangle(image,(294,340),(329,370),(172,245,255),-1) | ||
|
|
||
| cv2.circle(image,(420,70),30,(0,255,255),-1) | ||
|
|
||
| cv2.putText(image,"My House",(175,295),cv2.FONT_ITALIC,1,(0,0,0),2) | ||
|
|
||
| cv2.imshow("Task7",image) | ||
| cv2.waitKey(0) | ||
| cv2.destroyAllWindows() | ||
|
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.