Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions Tasks/Task1.md

This file was deleted.

Binary file added Tasks/Task1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions Tasks/Task1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# ## Task 1:

# You have have been given an image with a white canvas containing few non white pixels. The task is to use OpenCV to **find the number of non white pixels and also return the positions** of the pixels you have found.


# #### Link for the image: https://drive.google.com/file/d/1OTYYn3tJJ_iT4f0fUmPSnl71gYHjRphl/view?usp=drive_link
import cv2
import numpy as np

img1 = cv2.imread("/home/rudrakshi/projectxopenCV/Xplore2.0/Tasks/Task1.png")
# print(img1.shape)
# pixel = img1[50,450]
# print(pixel)
# cv.imshow("img1" , img1)
# cv.waitKey(0)
# cv.destroyAllWindows()

white = [255,255,255]
count = 0
for y in range (img1.shape[0]):
for x in range (img1.shape[1]):
if(img1[y,x] != [255,255,255]).all():
print("coordinate are : (",y,x,")"
)
count=count+1


print("The total number of non-white pixels are ", count)




3 changes: 3 additions & 0 deletions Tasks/tempCodeRunnerFile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cv.imshow("img1" , img1)
# cv.waitKey(0)
# cv.destroyAllWindows()