Skip to content

Commit

Permalink
Merge branch 'rework' into 'main'
Browse files Browse the repository at this point in the history
Set up UI for the final presentation

See merge request jesture/jestureui!4
  • Loading branch information
soundeffects committed Apr 13, 2023
2 parents c297568 + adf4532 commit dd0f159
Show file tree
Hide file tree
Showing 74 changed files with 3,438 additions and 1,076 deletions.
18 changes: 17 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,21 @@
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": []
"configurations": [
{
"name": "Jesture",
"preLaunchTask": "Build jesture (dbg)",
"type": "cppdbg",
"request": "launch",
"cwd": "${workspaceFolder}",
"program": "${workspaceRoot}/bazel-bin/jesture/jesture",
"environment": [
{
"name": "GLOG_logstderr",
"value": "1"
}
],
"args": []
}
]
}
22 changes: 22 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Build jesture (dbg)",
"type": "shell",
"command": "bazel",
"args": [
"build",
"--compilation_mode=dbg",
"//jesture"
],
"presentation": {
"reveal": "silent"
},
"group": {
"kind": "build",
"isDefault": false
}
}
]
}
88 changes: 71 additions & 17 deletions BUILD
Original file line number Diff line number Diff line change
@@ -1,23 +1,77 @@
config_setting (
name = "linux",
constraint_values = [
"@platforms//os:linux"
],
visibility = ["//visibility:public"]
load("//distribution:dist_vars.bzl", "dist_vars")
load("@rules_pkg//pkg:mappings.bzl", "pkg_attributes", "pkg_files", "pkg_mklink")
load("@rules_pkg//pkg:deb.bzl", "pkg_deb")
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")

# distribution(
# name = "dist",
# bin = "//jesture",
# deb_package_desc = "TODO",
# deb_package_name = "jesture",
# maintainer = "TODO",
# product_name = "jesture",
# version = "0.5.0",
# )

VERSION = "0.5.0"

dist_vars(
name = "jesture_dist_vars",
arch = select({
"@platforms//cpu:x86_64": "x86_64",
"//conditions:default": "UNKNOWN",
}),
product_name = "jesture",
version = VERSION,
)

config_setting (
name = "windows",
constraint_values = [
"@platforms//os:windows"
pkg_files(
name = "jesture_linux_bin",
srcs = ["//jesture"],
attributes = pkg_attributes(
mode = "0551",
),
prefix = "/opt/jesture",
)

pkg_files(
name = "jesture_linux_models",
srcs = ["//jesture:models"],
prefix = "/opt/jesture/models",
)

pkg_mklink(
name = "jesture_linux_usr_bin",
link_name = "/usr/bin/jesture",
target = "/opt/jesture/jesture",
)

pkg_tar(
name = "jesture_linux_tar",
srcs = [
":jesture_linux_bin",
":jesture_linux_models",
":jesture_linux_usr_bin",
],
visibility = ["//visibility:public"]
package_file_name = "{product_name}-{version}-{arch}-linux.tar",
package_variables = ":jesture_dist_vars",
)

config_setting (
name = "macos",
constraint_values = [
"@platforms//os:macos"
pkg_deb(
name = "jesture_deb",
data = ":jesture_linux_tar",
description = "TODO",
maintainer = "",
package = "jesture",
package_file_name = "{product_name}-{version}-{arch}.deb",
package_variables = ":jesture_dist_vars",
version = VERSION,
)

filegroup(
name = "distribution",
srcs = [
":jesture_deb",
":jesture_linux_tar",
],
visibility = ["//visibility:public"]
)
)
13 changes: 13 additions & 0 deletions Contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Development Requirements
* [Bazel](https://bazel.build/)

# IDE setup
For any IDEs using some form of `clangd` for IntelliSense run
```
bazel run //.vscode:compile_commands
```
to generate a `compile_commands.json` file.

## VSCode
VSCode is the preferred IDE as we have setup some tooling to make working in this
code base easier.
31 changes: 28 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
# Jesture UI
This is a C++ frontend to link with JesturePipe using the Qt framework.
This is the home for the Jesture app. Jesture can recognize your hand gestures
using your webcam, and issue commands (like keyboard or mouse events) to your
computer after recognizing a gesture!

This repo is the base for the C++ frontend to link with our gesture recognition
pipeline. It is built using the Qt framework.

## Platforms
The frontend has been tested for Linux and macOS.

Currently, the pipeline cannot issue actions on macOS. You can run the frontend,
and you can see the program recognize your gestures, but it will not issue mouse
or keyboard events.

## Quick Start
Just run `bazel run //jesture` to start!
Just run `bazel run -c opt //jesture` to start!

Note that for macOS, you need to install Qt6 and OpenCV using homebrew before
running the command above.
Expand All @@ -11,6 +23,19 @@ running the command above.
brew install qt@6 opencv
```

Here's a screenshot of how it looks.
## Usage
Go to the gesture list tab, and press record to add a new gesture. In the
gesture list, you can also change the actions (keyboard events or mouse events)
which will be sent upon a gesture being recognized.

You can set the camera used in the settings tab. Try it with the new "continuity
camera" on macOS--you can reposition your iPhone as the camera to give the app a
better view of your hand gestures when you're far away or in a difficult
position.

Once you have set up the gestures you want, you can minimize the app and start
using your hands!

Here's a screenshot of the app.

![Progress Screenshot](./docs/progress_screenshot.png)
60 changes: 54 additions & 6 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,62 @@ load("//:repositories.bzl", "jesture_repositories")

jesture_repositories()

load("//:setup0.bzl", "jesture_setup0")
# SETUP STAGE 1
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
load("@bazel_skylib//lib:versions.bzl", "versions")
load("@jesture//qt:qt_configure.bzl", "qt_configure")
load("@jesturepipe//:repositories.bzl", "jesturepipe_repositories")
load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")

jesture_setup0()
bazel_skylib_workspace()

load("//:setup1.bzl", "jesture_setup1")
rules_pkg_dependencies()

jesture_setup1()
versions.check(
maximum_bazel_version = "5.3.0",
minimum_bazel_version = "5.0.0",
)

qt_configure()

jesturepipe_repositories()

# SETUP STAGE 2
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("@local_config_qt//:local_qt.bzl", "local_qt_base_path")
load("@rules_foreign_cc//:workspace_definitions.bzl", "rules_foreign_cc_dependencies")
load("@org_tensorflow//tensorflow:workspace3.bzl", "tf_workspace3")
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
load("@actions//:repositories.bzl", "actions_repositories")

maybe(
new_local_repository,
name = "qt",
build_file = "@jesture//third_party:qt.BUILD",
path = local_qt_base_path(),
)

register_toolchains(
"@qt//:qt_local_toolchain",
)

rules_foreign_cc_dependencies()

protobuf_deps()

tf_workspace3()

actions_repositories()

# SETUP STAGE 3
load("@actions//display:display_configure.bzl", "display_configure")
load("@org_tensorflow//tensorflow:workspace2.bzl", "tf_workspace2")

display_configure()

tf_workspace2()

load("//:setup2.bzl", "jesture_setup2")
# SETUP STAGE 4
load("@display//:local_display.bzl", "display_repositories")

jesture_setup2()
display_repositories()
Empty file added distribution/BUILD
Empty file.
38 changes: 38 additions & 0 deletions distribution/dist_vars.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""
TODO
"""

load("@rules_pkg//pkg:providers.bzl", "PackageVariablesInfo")
load("@rules_cc//cc:find_cc_toolchain.bzl", "find_cc_toolchain")

def _dist_vars_impl(ctx):
values = {}

# cc_toolchain = find_cc_toolchain(ctx)

values["product_name"] = ctx.attr.product_name
values["version"] = ctx.attr.version.replace(".", "_")

values["arch"] = ctx.attr.arch

return PackageVariablesInfo(values = values)

dist_vars = rule(
implementation = _dist_vars_impl,
attrs = {
"product_name": attr.string(
doc = "Placeholder for our final product name.",
),
"version": attr.string(
doc = "Placeholder for our release version.",
),
"arch": attr.string(),
"_cc_toolchain": attr.label(
default = Label(
"@rules_cc//cc:current_cc_toolchain",
),
),
},
toolchains = ["@rules_cc//cc:toolchain_type"],
incompatible_use_toolchain_transition = True,
)
Binary file modified docs/progress_screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 35 additions & 4 deletions icons/BUILD
Original file line number Diff line number Diff line change
@@ -1,10 +1,41 @@
load("//qt:qt.bzl", "qt_resource")

package(default_visibility = ["//visibility:public"])

exports_files([
"jesture.svg",
"jesture.ico",
"settings.svg",
"settings.png",
"show.svg",
"show.png",
"hide.svg",
"quit.svg",
"hide.png",
"add.svg",
"add.png",
"add_element.svg",
"add_element.png",
"cross.svg",
"left_arrow.svg",
"add.svg"
])
"cross.png"
])

qt_resource(
name = "icons",
files = {
"jesture.svg": ":jesture.svg",
"jesture.ico": ":jesture.ico",
"settings.svg": ":settings.svg",
"settings.png": ":settings.png",
"show.svg": ":show.svg",
"show.png": ":show.png",
"hide.svg": ":hide.svg",
"hide.png": ":hide.png",
"add.svg": ":add.svg",
"add.png": ":add.png",
"add_element.svg": ":add_element.svg",
"add_element.png": ":add_element.png",
"cross.svg": ":cross.svg",
"cross.png": ":cross.png"
},
prefix = "/jesture/icons",
)
Binary file added icons/add.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/add_element.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/cross.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/hide.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/jesture.ico
Binary file not shown.
Loading

0 comments on commit dd0f159

Please sign in to comment.