Gesture interaction is an important direction in the development of human-computer interaction in the future. This article will refer to the use of Opencv to implement static gesture recognition and play rock-paper scissors to teach you how to use the Python script language to achieve simple hand recognition on the Dragoboard 410c development board. By taking a hand image from a USB camera, it then recognizes the stone-scissors-cloth three hand types.
The specific implementation steps are as follows:
1) Get the USB camera image:
Here is mainly through the Python interface cv2 provided by Opencv, specifically refer to the 410c board to obtain a USB camera image, which details the use of a USB camera to capture images on the dragonboard 410c.
2) Set the gesture area
Set a gesture area in the video area. Only when the hand is placed in the area, the system can correctly recognize the hand type. The system in other areas does not process. The specific code is as follows:
#Set the hand area
Cv2.rectangle(img,(426,0),(640,250),(170,170,0))
#Get the hand area image and save it
Img = img[0:210,426:640]
Cv2.imwrite("wif.jpg",img)
3) Image processing of the detection area, the core code is as follows:
Img = cv2.imread("wif.jpg",0)
Element = cv2.getStructuringElement(cv2.MORPH_RECT,(11,11))
Dilate = cv2.dilate(img, element)
Erode = cv2.erode(img, element)
Result = cv2.absdiff(dilate, erode);
Retval, result = cv2.threshold(result, 40, 255, cv2.THRESH_BINARY);
Result = cv2.bitwise_not(result);
Result =cv2.medianBlur(result,23)
4) Determine the hand type, some of which are as follows:
If width[i]<=20 or width[i]>=40:
Width_jiandao= False
Width_length += width[i]
If width_jiandao==True and count==2:
Return 1;
If(area <8500):
#print 'stone;
Return 0;
Print "width_leng", width_length
......
If(area>14000 or count>=3):
#print 'paper';
Return 2;
If(width_length<110):
#print 'rock';
Return 1;
Else:
#print 'paper';
Return 2;
Here we have completed the core part of the entire hand recognition, the specific code is longer, directly attached to http://pan.baidu.com/s/1kUKSxoV, with this code to run the hand type detection, the effect is as follows As shown, although not accurate, basically three different hand types can be detected:
In the e-bike market where innovative, minimalistic designs are talk of the day, we see that manufacturers are constantly looking for smart electrical wiring systems and reliable connections to support these developments. With years of experience with our e-bike customers, we have already worked successfully around themes like the integration of brake & signal, battery and number plate lighting, high power electrical connection.
Related products:bike wire assembly, ebikes connector,e-bike cable assemblies, waterproof e-bike cable, waterproof e-bike connector
bike wire assembly, ebikes connector,e-bike cable assemblies, waterproof e-bike cable, waterproof e-bike connector
ETOP WIREHARNESS LIMITED , https://www.wireharness-assembling.com