COSC345CoolGroupASLtoSpeech
BridgingASLandspokenlanguagewithAI:Translategesturestospeechforinclusivecommunication.
|
The Camera class represents the main application window and camera functionalities. More...
#include <camera.h>
Public Slots | |
void | setupMenus () |
setupMenus More... | |
void | displayCameraError () |
displayCameraError More... | |
void | translateText () |
translateText More... | |
void | addToHistory (const QString &original) |
addToHistory More... | |
void | startCamera () |
Start the current Camera. More... | |
void | stopCamera () |
Stop the current Camera. More... | |
QString | getHistoryText () |
getHistoryText More... | |
void | imageAvailable (QVideoFrame frame) |
imageAvailable More... | |
bool | getCameraActive () |
Returns the current camera. More... | |
QString | getLastHistory () |
Returns the last translated text. More... | |
QString | getTranslateText () |
void | setTranslateText (QString str) |
void | setSubtitle (QString str) |
QString | getSubtitle () |
Returns the subtitle text. More... | |
void | onAboutToQuit () |
QString | getHistoryForTranslate () |
void | openSettings () |
void | closeSettings () |
void | closeApp () |
Allows the application to be closed from the file menu. More... | |
void | enableTyping () |
Updates the readOnly variable of the translate text input box. More... | |
void | signTimer () |
void | updateProgressBar () |
void | startProgressBar () |
void | setProgressBarValue (int value) |
int | getGender () |
void | openHelp () |
void | closeHelp () |
Public Member Functions | |
Camera () | |
Camera() is the constructor for the Camera class. More... | |
Public Attributes | |
Ui::Camera * | ui |
QStackedWidget * | stacked |
QList< QString > | history |
list to store history of translations More... | |
QActionGroup * | videoDevicesGroup = nullptr |
group of video devices More... | |
QMediaDevices | m_devices |
available multimedia input/output devices instance More... | |
QImageCapture | m_imageCapture |
image capture instance More... | |
QMediaCaptureSession | m_captureSession |
media capture session instance More... | |
QCamera | m_camera |
camera instance More... | |
QCamera * | cam |
QScopedPointer< QAudioInput > | m_audioInput |
QScopedPointer< QMediaRecorder > | m_mediaRecorder |
QMessageBox | msgBox |
QMenu * | fileMenu |
QMenu * | devicesMenu |
QMenu * | cameraMenu |
bool | m_isCapturingImage = false |
bool | m_applicationExiting = false |
bool | m_doImageCapture = true |
QProgressBar * | progressBar |
QRadioButton * | maleButton |
QRadioButton * | femaleButton |
The Camera class represents the main application window and camera functionalities.
This class represents the main application window and provides functionalities related to camera capture, image processing, and user interaction. It also provides a UI for the user to interact with the application.
Camera::Camera | ( | ) |
Camera() is the constructor for the Camera class.
Camera::Camera() : ui(new Ui::Camera) constructs a new Camera:: Camera object.
The Camera() constructor initializes the Camera class and sets up the UI and camera-related components.
The Camera::Camera() : ui(new Ui::Camera) constructor initializes the Camera object and sets up various connections for button clicks and video frame updates. It also initializes camera resources.
Connect Camera::imageAvailable to QVideoSink::videoFrameChanged.
Everytime QVideoSink has a new frame, Camera::imageAvailable is called.
|
slot |
addToHistory
Adds an entry to the translation history.
Adds the text in the text box to the history.
original | The original text. |
This function appends a pair of original and translated text to the translation history data structure. It updates the history display in the GUI to reflect the new entry.
original | The original text before translation. |
|
slot |
Allows the application to be closed from the file menu.
This function is called when the user selects the 'close' item in the file menu.
|
slot |
|
slot |
|
slot |
displayCameraError
Displays a camera error message.
Displays an error message if the camera fails to start.
This function displays a camera error message in a message box if there is an error with the camera.
|
slot |
Updates the readOnly variable of the translate text input box.
This function updates the readOnly function of the translate text input box.
|
slot |
Returns the current camera.
This function returns the current camera that is being used.
|
slot |
|
slot |
|
slot |
getHistoryText
Retrieves formatted text for displaying translation history.
Gets the text from the history.
This function generates a formatted text string containing all entries in the translation history data structure. Each entry includes the original and translated (or modified) text. The formatted text is suitable for display in the history spot in the GUI.
|
slot |
Returns the last translated text.
This function returns the last translated text, which is the last entry in the translation history.
|
slot |
Returns the subtitle text.
This function returns the current subtitle text.
|
slot |
|
slot |
imageAvailable
Slot called when a new video frame is captured.
This function is connected to the QVideoSink::imageAvailable function. Everytime the camera recieves a new frame, this function is also called. This checks the frame for a recognised ASL sign.
frame | The current frame from the camera. |
This slot processes the incoming video frame, interacts with a Python module, and updates the video frame display. It also performs necessary data conversion between C++ and Python.
frame | The incoming video frame. |
|
slot |
|
slot |
|
slot |
|
slot |
|
slot |
|
slot |
|
slot |
|
slot |
|
slot |
Start the current Camera.
updates the camera device for the application to use.
This function starts the current Camera.
This function updates the camera device for the application to use.
action | the QAction corresponding to the camera device to use Starts the current camera. |
This function starts the current camera.
|
slot |
|
slot |
|
slot |
translateText
Translates and displays input text using text-to-speech.
Translates the text in the text box.
This function is triggered when the "Translate" button is clicked in the GUI. It retrieves the input text from the UI, performs translation logic (if any), and then uses the text-to-speech function to generate speech from the input text. The translated text is displayed in the GUI, and the original and translated text are stored in the history for reference.
|
slot |
QCamera* Camera::cam |
QMenu* Camera::cameraMenu |
QMenu* Camera::devicesMenu |
QRadioButton* Camera::femaleButton |
QMenu* Camera::fileMenu |
QList<QString> Camera::history |
list to store history of translations
bool Camera::m_applicationExiting = false |
QScopedPointer<QAudioInput> Camera::m_audioInput |
QCamera Camera::m_camera |
camera instance
QMediaCaptureSession Camera::m_captureSession |
media capture session instance
QMediaDevices Camera::m_devices |
available multimedia input/output devices instance
bool Camera::m_doImageCapture = true |
QImageCapture Camera::m_imageCapture |
image capture instance
bool Camera::m_isCapturingImage = false |
QScopedPointer<QMediaRecorder> Camera::m_mediaRecorder |
QRadioButton* Camera::maleButton |
QMessageBox Camera::msgBox |
QProgressBar* Camera::progressBar |
QStackedWidget* Camera::stacked |
Ui::Camera* Camera::ui |
QActionGroup* Camera::videoDevicesGroup = nullptr |
group of video devices