How to have MATLAB provide picture output from a typed sentence

1 view (last 30 days)
Hello all,
I would like to create a program which will provide me with pictures based on a sentence/word/phrase that I type in before running the code. If I have a data set of sign language/hand gesture images, how can I create a code to display pictures to interpret the words/letters that I type into the code?
Thank you.
  1 Comment
Rik
Rik on 13 Jun 2022
If you are fine with a 'dumb' system, you could create a lookup table that matches phrases and loads the corresponding image.

Sign in to comment.

Answers (2)

Pratheek
Pratheek on 22 Sep 2023
Edited: Pratheek on 22 Sep 2023
Hello Denise,
I understand you want to create a program in MATLAB that displays pictures based on a sentence/word/phrase you type in, using a dataset of sign language/hand gesture images, you can follow these steps:
  1. Load the dataset: Write code to load the dataset into your MATLAB program. This involves reading the images and their corresponding labels or filenames. You can use functions like imread to read the images and store them in an appropriate data structure, such as a cell array or structure array.
  2. Input the word/phrase: Use the input function to prompt the user to enter the word/phrase they want to interpret. Store the input in a variable.
  3. Find the corresponding image(s): Search your dataset for images that match the input word/phrase. You can iterate through the dataset and compare the labels or filenames with the input. Store the matching images in a separate data structure, such as a cell array or structure array.
  4. Display the image(s): Use the imshow function to display the image(s) that correspond to the input word/phrase. You can loop through the matching images and display them one by one using a loop. Alternatively, you can randomly select an image from the matching set to display.
Hope this will help you!

Image Analyst
Image Analyst on 22 Sep 2023
Use a dictionary to find the image file name corresponding to the word. For example the word "speak" might correspond to the "speak.png" image file. Then use imread to read that image, and imshow to display it.
help dictionary
dictionary - Object that maps unique keys to values A dictionary is useful for fast lookup of values in a larger set. Creation Syntax d = dictionary(keys,values) d = dictionary(k1,v1,...,kN,vN) d = dictionary Input Arguments keys - Keys scalar | array values - Values scalar | array | cell array k1,v1,...,kN,vN - Key-value pairs (as separate arguments) scalar | array Usage Syntax valueOut = d(keys) d(keys) = newValues d(keys) = [] valueOut = d{keys} d{keys} = newValues Object Functions entries - Key-value pairs of dictionary insert - Add entries to a dictionary isConfigured - Determine if dictionary has types assigned to keys and values isKey - Determine if dictionary contains key keys - Keys of dictionary lookup - Find value in dictionary by key numEntries - Number of key-value pairs in dictionary remove - Remove dictionary entries types - Types of dictionary keys and values values - Values of dictionary Examples openExample('matlab/CreateADictionaryWithSpecifiedKeysAndValuesExample') openExample('matlab/StoreHeterogeniousDataInADictionaryExample') openExample('matlab/CreateAnEmptyInitializedDictionaryExample') openExample('matlab/AddEntriesToAnUnconfiguredDictionaryExample') See also configureDictionary, insert, lookup, remove, entries, keys, values, types, numEntries, isConfigured, isKey, keyHash, keyMatch Introduced in MATLAB in R2022b Documentation for dictionary doc dictionary Folders named dictionary datatypes/dictionary

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!