diff --git a/Makefile b/Makefile index ad0a55424ad701dc61a133f835dfacc40791e65c..4144bb019329b887c24361227516ef05497ed32a 100644 --- a/Makefile +++ b/Makefile @@ -4,11 +4,19 @@ API_PATH=../ar_sandbox_lib CFLAGS=-std=c++11 -Wall -Wextra -g CCP=g++ +all: app + app: app.o $(CCP) $^ -o $@ -L$(API_PATH) -lsandbox $(DEP_SANDBOX) %.o: %.cpp - $(CCP) $(CFLAGS) -I$(API_PATH)/includes -c $< -o $@ + $(CCP) $(CFLAGS) -I$(API_PATH)/inc -c $< -o $@ + +run: + ./app + +setup: + $(API_PATH)/app/SandboxSetupApp clean: rm -f *.o app diff --git a/app.cpp b/app.cpp index 0f62cdc538e9b64c4a7c6ff9f112de5bdf5d1c7c..9d39c03e9f783af195174ed14bd02a57379a4a71 100644 --- a/app.cpp +++ b/app.cpp @@ -1,5 +1,5 @@ -#include "../ar_sandbox_lib/includes/sandbox.h" +#include "../ar_sandbox_lib/sandbox.h" #include <numeric> #include <fstream> #include <string> @@ -10,7 +10,59 @@ using namespace cv; #define ESCAPE_CHAR 27 + + +Mat coloredFrame(Mat frameDepth); +void showLevel(); +void showDiff(); +//vector<int> findCercleZ(Mat &rgb); +//void trackCircle(); + + + Sandbox client; +void (*apps[2])() = {showLevel, showDiff}; + +int main(int argc, char *argv[]) +{ + if(client.loadConfig()){ + std::cout << "Error : Couldn't load the configuration" << std::endl; + return 1; + } + + showLevel(); + + /*cout << "Press: \n 0: Show level \n 1: Show difference \n"; + int n = 0; + cin >> n; + + apps[n]();*/ +} + +void showLevel() +{ + char windowName[] = "Sandbox"; + Mat frameData; + Mat colored; + Mat proj_frame; + + //client.initWindowsFullScreen(); + cv::namedWindow(windowName, CV_WINDOW_AUTOSIZE); + + do{ + client.getDepthFrame().copyTo(frameData); + colored = coloredFrame(frameData); + + colored.copyTo(proj_frame); + Mat* res = client.adjustProjection(&proj_frame); + cv::imshow(windowName, *res); + + //client.showImage(&colored); + + } while (waitKey(10) != ESCAPE_CHAR); + + cv::destroyAllWindows(); +} Mat coloredFrame(Mat frameDepth) { @@ -45,29 +97,16 @@ Mat coloredFrame(Mat frameDepth) } } } - bitwise_not(depthFrameColored, depthFrameColored); //reverse colormap - applyColorMap(depthFrameColored, depthFrameColored, cv::COLORMAP_JET); + cv::bitwise_not(depthFrameColored, depthFrameColored); //reverse colormap + cv::applyColorMap(depthFrameColored, depthFrameColored, cv::COLORMAP_JET); depthFrameColored.setTo(cv::Scalar(0, 0, 0), (frameDepth == 0)); return depthFrameColored; } -void showLevel() -{ - //char windowName[] = "Sandbox"; - Mat frameData; - client.getDepthFrame().copyTo(frameData); - Mat colored; - do - { - client.getDepthFrame().copyTo(frameData); - colored = coloredFrame(frameData); - client.showImage(&colored); - } while (waitKey(10) != ESCAPE_CHAR); - destroyAllWindows(); -} +void showDiff(){ /* -void showDiff(Mat frameBase) -{ + Mat frameData; + client.getDepthFrame(&frameData); Mat frameData; client.getDepthFrame(&frameData); resize(frameBase, frameBase, frameData.size()); //to match with camera frame @@ -89,8 +128,10 @@ void showDiff(Mat frameBase) keyCode = waitKey(10); } while (keyCode!= ESCAPE_CHAR); destroyAllWindows(); + */ } +/* vector<int> findCercleZ(Mat &rgb) { Mat src_gray; @@ -136,20 +177,4 @@ void trackCircle() } while (waitKey(100) != ESCAPE_CHAR); destroyAllWindows(); -}*/ - -int main(int argc, char *argv[]) -{ - client = Sandbox(); - cout << "Press: \n 0: Show difference \n 1: Show level \n"; - int f = 0; - cin >> f; - if (f == 0) - { - //Mat frameData; - //client.getDepthFrame(&frameData); - //showDiff(frameData); - } - else if (f == 1) - showLevel(); -} \ No newline at end of file +}*/ \ No newline at end of file diff --git a/beamer_config.sh b/beamer_config.sh index 9e02401a2ee1216c68c8c207de718010a4157360..8955109279bf1650c333a23ac5d631e3a4791e2c 100755 --- a/beamer_config.sh +++ b/beamer_config.sh @@ -1,6 +1,6 @@ -SCREEN=DVI-D-0 +SCREEN=eDP-1 SCN_RES=1920x1080 -BEAMER=HDMI-0 +BEAMER=HDMI-1 BM_RES=1400x1050 xrandr --output $SCREEN --rate 60 --mode $SCN_RES --fb $SCN_RES --panning $SCN_RES* \ diff --git a/sandbox_conf.yaml b/sandbox_conf.yaml new file mode 100644 index 0000000000000000000000000000000000000000..7dd1043be56a137175d13c641a7e15521da5de08 --- /dev/null +++ b/sandbox_conf.yaml @@ -0,0 +1,13 @@ +AdjustingMatrix: + width: 3 + height: 2 + matrix: [1, 0, 0, -0, 1, 0] +CroppingMask: + x: 160 + y: 120 + width: 320 + height: 245 +BeamerPosition: + x: 0 + y: 0 + z: 0