Let us worry about your assignment instead!

We Helped With This Python Programming Homework: Have A Similar One?

SOLVED
CategoryProgramming
SubjectPython
DifficultyGraduate
StatusSolved
More InfoPython Help Online
52991

Short Assignment Requirements

I want to detect rectangle of irregular shape in an image.I applied canny edge detector from opencv2 to detect edges now from edges i want to detect the irregular rectangle shown in bot1.jpg,bot2.jpg.please will you help me or give me some idea to process further.I will be thankful to you!Thank you!

Assignment Code


import cv2
import numpy as np
img=cv2.imread("bot1.jpg")
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
gray = cv2.GaussianBlur(gray, (7, 7), 0)
edged_image = cv2.Canny(gray,75,150)
edged1 = cv2.dilate(edged_image, None, iterations=1)
edged2 = cv2.erode(edged_image, None, iterations=1)
print "shape",img.shape,edged_image.shape
print edged_image
#Apply mask contain only true
xmask = np.ma.make_mask(edged_image,copy=True,shrink=True,dtype=np.bool)
print xmask
store = np.array(img[xmask])
print store
#(obtain coordinates where true)
temp=np.where(edged_image)
print "got=",temp
''''
#validate whether we r getting coordinates
aa=(temp[0][0],temp[1][0])

a1=(temp[0][1],temp[1][1])

a2=(temp[0][2],temp[1][2])

a3=(temp[0][3],temp[1][3])

img[aa]=[0,255,0]

img[a1]=[0,255,0]
img[a2]=[0,255,0]
img[a3]=[0,255,0]'''

cv2.imshow( "result1",img)

cv2.imshow( "result3",edged1)

cv2.imshow( "result4",edged2)
cv2.imshow( "result2",edged_image)
#cv2.imwrite("image.jpg",image)
cv2.waitKey(0)


Customer Feedback

"Thanks for explanations after the assignment was already completed... Emily is such a nice tutor! "

Order #13073

Find Us On

soc fb soc insta


Paypal supported