import argparse import imutils import cv2 frame1 = cv2.imread(r'C:\Users\PIYUSH\Desktop\pic1.jpg') frame2 = cv2.imread(r'C:\Users\PIYUSH\Desktop\pic2.jpg') #while True: #flag, frame = cap.read() #cv2.imwrite(r'C:\Users\PIYUSH\Desktop\pic2.jpg',frame) #frame2=cv2.imread(r'C:\Users\PIYUSH\Desktop\pic2.jpg') # load the two images and resize them to have a width of 400 pixels # (for faster processing) #imageA = cv2.imread(r'C:\Users\PIYUSH\Desktop\pic1.jpg') #imageB = cv2.imread(r'C:\Users\PIYUSH\Desktop\pic2.jpg') frame1 = imutils.resize(frame1, width=400) frame2 = imutils.resize(frame2, width=400) # stitch the images together to create a panorama stitcher = stitcher() (result, vis) = stitcher.stitch([frame1, frame2], showMatches=True) #frame1=frame2 # show the images #cv2.imshow("Image A", imageA) cv2.imshow("stiched",vis) cv2.waitKey(0) #v2.imshow("Keypoint Matches",vis) #cv2.imshow("Result", result) #if cv2.waitKey(10) & 0xFF == ord('q'): # break
def karnapadega(): while (True): cap1 = cv2.VideoCapture(1) cap2 = cv2.VideoCapture(0) ret1, frame1 = cap1.read() ret2, frame2 = cap2.read() if ret1 == True and ret2 == True: cv2.imshow("frame", frame1) cv2.imshow("frame", frame2) print("dududu") #gray = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) if result1 > 0.01: #gray = cv2.cvtColor(frame) cv2.imwrite(outpath1, frame1) cv2.waitKey(1) cap1.release() cv2.imwrite(outpath2, frame2) cv2.waitKey(1) cap2.release() cv2.destroyAllWindows() # construct the argument parse and parse the arguments '''ap = argparse.ArgumentParser() ap.add_argument("-f", "--first", required=True, help="path to the first image") ap.add_argument("-s", "--second", required=True, help="path to the second image") args = vars(ap.parse_args())''' # load the two images and resize them to have a width of 400 pixels # (for faster processing) imageA = cv2.imread(outpath1) imageB = cv2.imread(outpath2) imageA = imutils.resize(imageA, width=400) imageB = imutils.resize(imageB, width=400) from Stitcher import stitcher # stitch the images together to create a panorama stitcher = stitcher() (result, vis) = stitcher.stitch([imageA, imageB], showMatches=True) # show the images #cv2.imshow("Image A", imageA) #cv2.imshow("Image B", imageB) #cv2.imshow("Keypoint Matches", vis) cv2.imwrite(outpath, vis) cv2.waitKey(1) cap1.release() cap2.release() cv2.destroyAllWindows() upload(outpath) break else: cv2.destroyAllWindows() break