Esempio n. 1
0
def lowProcess():
    keyDict = request.get_json()
    userId = hashlib.sha224(keyDict['userId']).hexdigest()
    grabcutOutput = cv2.imread('../users/' + userId +'/grabcutOutputlower.png') 
    processInst = userPreprocess(grabcutOutput)
    processInst.cropImg()
    processOut = processInst.removeTurds()
    cv2.imwrite('../users/' + userId + '/processOutLower.png',processOut)
    pickle.dump(processInst.returnUserBox(),open('../users/' + userId + '/userLowBox.p','wb'))
    resp = Response(status=200, mimetype='application/json')
    return resp
Esempio n. 2
0
def preprocess():
    keyDict = request.get_json()
    userId = hashlib.sha224(keyDict['userId']).hexdigest()
    grabcutOutput = cv2.imread('../users/' + userId +'/grabcutOutputupper.png') 
    processInst = userPreprocess(grabcutOutput)
    processInst.cropImg()
    processOut = processInst.removeTurds()
    cv2.imwrite('../users/' + userId + '/processOutupper.png',processOut)
    processInst.segImage(processOut)
    LU, RU = processInst.getSegLines()
    leftArmUser = processInst.armSegment(processOut,'left')
    cv2.imwrite('../users/' + userId + '/leftArmUser.png',leftArmUser)
    rightArmUser = processInst.armSegment(processOut,'right')
    cv2.imwrite('../users/' + userId + '/rightArmUser.png',rightArmUser)
    segLines = (LU,RU)
    pickle.dump(segLines,open('../users/' + userId + '/segLines.p','wb'))
    pickle.dump(processInst.returnUserBox(),open('../users/' + userId + '/userBox.p','wb'))
    resp = Response(status=200, mimetype='application/json')
    return resp
Esempio n. 3
0
# Debug folder provides historical models to be used and segmentation of the apparel
if not os.path.exists('debug/'):
    os.makedirs('debug/')

# Once a user creates the frame for her/himself grabcut is made and fitted to his/her dimensions therefor using the 3rd argument
if sys.argv[3] == "1":
    grabcutOutput = cv2.imread('debug/grabcutOutput.png')
# If its first time a 3rd argument of 0 is entered to create a frame for pieces of apparel to be fitted to the person
else:
    img = cv2.imread(sys.argv[1])
    grabInst = grabcut(img)
    grabcutOutput = grabInst.grabcut()
    cv2.imwrite("debug/grabcutOutput.png/", grabcutOutput)

processInst = userPreprocess(grabcutOutput)
processInst.cropImg()
processOut = processInst.removeTurds()

processInst.segImage(processOut)
LU, RU = processInst.getSegLines()

leftArmUser = processInst.armSegment(processOut, 'left')
rightArmUser = processInst.armSegment(processOut, 'right')

catImg = cv2.imread(sys.argv[2])
catInst = catPreprocess(catImg)
floodOut = catInst.edgeDetect()

cropFlood = catInst.cropImg(floodOut)
catInst.segImage(cropFlood)