Created
May 1, 2023 19:41
-
-
Save fernandoc1/3afa383885116ec6aba84ad0fc1cc940 to your computer and use it in GitHub Desktop.
A library to dump texture in SoH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdint.h> | |
#include <unistd.h> | |
#include <opencv2/core.hpp> | |
#include <opencv2/imgcodecs.hpp> | |
#include <opencv2/highgui.hpp> | |
#include <opencv2/imgproc.hpp> | |
void displayTexture(const uint8_t* rgba32_buf, uint32_t width, uint32_t height) { | |
cv::Mat img = cv::Mat(width, height, CV_8UC4, (unsigned*)rgba32_buf); | |
cv::cvtColor(img, img, cv::COLOR_RGBA2BGRA); | |
cv::imshow("DISPLAY", img); | |
cv::waitKey(0); | |
cv::cvtColor(img, img, cv::COLOR_BGRA2RGBA); | |
} | |
extern "C" { | |
void texture_dumper(const uint8_t* rgba32_buf, uint32_t width, uint32_t height) { | |
printf("[PID: %d] Texture: %dx%d\n", getpid(), width, height); | |
displayTexture(rgba32_buf, width, height); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LIBS=-I/usr/include/opencv4/ -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_imgcodecs | |
all: | |
g++ -g $(LIBS) -Wl,--no-as-needed -fPIC -shared dumper.cpp -o libdumper.so | |
patchelf --add-needed libopencv_core.so libdumper.so | |
patchelf --add-needed libopencv_imgproc.so libdumper.so | |
patchelf --add-needed libopencv_highgui.so libdumper.so | |
patchelf --add-needed libopencv_imgcodecs.so libdumper.so |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
LIBDUMPER_PATH=$(readlink -f $(dirname $0)/libdumper.so) | |
SOH_DIR=$(readlink -f $(dirname $0)/../build/soh/) | |
export LD_PRELOAD=${LIBDUMPER_PATH} | |
#echo ${SOH_DIR} | |
#echo ${LIBDUMPER_PATH} | |
cd ${SOH_DIR} | |
./soh.elf | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment