He, Peng

A Roboticist.

Robotic is the integration of all human knowledge, so far.


My Test Post

A useful post should be quick and dirty, at least on my blog. I don't teach people basics, I teach them how to pick up the basics.


To-Do List 2018

  • K-Means
  • Dijkstra's
  • Bellman-ford
  • A*

ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required=True,
                help="type in the input image path")
args = vars(ap.parse_args())

for cnt in cnts:
    # computer center
    M = cv2.moments(cnt)
    cntX = int(M["m10"] / M["m00"])
    cntY = int(M["m01"] / M["m00"])
    # detect shape type
    shapeName = sd.detect(cnt)
    # say where it is
    print shapeName+" center at "+str(cntX)+" x "+str(cntY)
    # drawings
    cv2.drawContours(image, [cnt], -1, (0,255,0), 2)
    cv2.circle(image, (cntX,cntY), 5, (0,0,255), -1)
    cv2.putText(image, shapeName, (cntX - 20, cntY - 20),
                cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255,255,255), 2)
    cv2.imshow("Find Contour Center", image)
    keypress = cv2.waitKey(0)

#end

test flickr img