Package: thslt
Thai sign language translator (ThSLT)DescriptionThis is a Thai sign language library for python used for translating Thai sign language into plain Thai characters. This library is used withMediapipeandOpenCV, so you should install those libraries first to make ThSLT function properly. Although the code works about 90% of the time, there are a lot of factors that you need to consider such as background , lighting , camera quality , hardware qualities. To increase the accuracy, you can adjust themin_tracking_confidenceandmin_detection_confidencefrom the default values.Table of ContentsInstallationUsageConfigurationFeaturesLicenseSupportAcknowledgmentsInstallationUse the following methods to install nessecary librariesTo install OpenCV, use the following commandpip install opencv-pythonTo install Mediapipe, use the following commandpip install mediapipeUse the following method to install ThSLTTo install ThSLT, use the following commandpip install thsltUsageHere's an example setup for ThSLT:import thslt , cv2 
import mediapipe as mp

mpdraw = mp.solutions.drawing_utils
mphands = mp.solutions.hands
mpdrawing_styles = mp.solutions.drawing_styles
hands = mphands.Hands(static_image_mode=False,
                      model_complexity=1,
                      min_detection_confidence=0.8,
                      min_tracking_confidence=0.8,
                      max_num_hands=2)

capture = cv2.VideoCapture(0)
text_encode = [] 

while True:
    ret, frame = capture.read()
    bgrtorgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
    results = hands.process(bgrtorgb)
    thslt.translate(frame,results,text_encode)
    if results.multi_hand_landmarks:
        for hand_landmarks in results.multi_hand_landmarks:
            for id, lm in enumerate(hand_landmarks.landmark):
                h,w,c = frame.shape
                Cx,Cy = int(lm.x*w), int(lm.y*h)
                mpdraw.draw_landmarks(frame,
                                    hand_landmarks,
                                    mphands.HAND_CONNECTIONS,
                                    mpdrawing_styles.get_default_hand_landmarks_style(),
                                    mpdrawing_styles.get_default_hand_connections_style())

    cv2.imshow("Hand Tracking",frame)
    key = cv2.waitKey(1)
    if key == 27: ### Esc key
        break
cv2.destroyAllWindows()

translation = thslt.decode(text_encode)
print(translation)ThSLT has a built in Mediapipe hand mapping. So mapping the hand landmarks is not necessary. It only helps you notice that the camera is actually mapping your hand.ConfigurationText_encodedeclare text_encode as a blank array before start capturing the videotext_encode = []FeaturesTranslateuse this function after you create a loop for OpenCVtranslate(frame,results,text_encode)Parametersframe = capture.read()results = Hands.process(bgrtorgb)text_encode = [ ]Decodeuse this function after you exit the loop for OpenCV to encodetext_encodetranslation = encode(text_encode)LicenseCopyright 2023 Papangkon NinarundechPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.AcknowledgmentsThank you to the individuals who assisted in creating this project.Mr.Jiraroj Wiruchpongsanon