28 memcpy(
bwImage,pixels,640*480*4);
30 unsigned int * pntrBWImage= (
unsigned int *)
bwImage;
32 unsigned int fourBytes;
33 for (
int j=0;j<480; j++)
35 for (
int i=0; i<640; i++)
38 fourBytes=pntrBWImage[index];
39 bwImage[index]=((
unsigned char)fourBytes>>(2*8)) +((
unsigned char)fourBytes>>(1*8))+((
unsigned char)fourBytes>>(0*8));
44 void flip_vertically(
unsigned char *pixels,
const size_t width,
const size_t height,
const size_t bytes_per_pixel)
46 const size_t stride = width * bytes_per_pixel;
47 unsigned char *row = (
unsigned char*)malloc(stride);
48 unsigned char *low = pixels;
49 unsigned char *high = &pixels[(height - 1) * stride];
51 for (; low < high; low += stride, high -= stride) {
52 memcpy(row, low, stride);
53 memcpy(low, high, stride);
54 memcpy(high, row, stride);
62 for (
int i = 0; i<width*height*4; i+=4)
64 std::swap(pixels[i], pixels[i+2]);
72 void _StartSlam(
void* pointerString,
void* pointerPose,
void* pointerStringLog,
void* pointerArrayOfPoints)
74 std::cout <<
"=> Start SlamFlex service" << std::endl;
75 LOGV(
LOG_TAG,
"Info: %s",
"=> Start SlamFlex service");
86 std::cout <<
"-----Signal--StatusBar------" << std::endl;
87 LOGV(
LOG_TAG,
"Info: %s",
"-----Signal--StatusBar------");
93 unsigned char* data =
reinterpret_cast<unsigned char*
>(pointer);
97 clock_t tFrameStart, tFrameEnd;
98 tFrameStart = clock();
102 tFrameEnd = clock();;
106 std::ostringstream message;
107 message <<
"Number Of Corners:: "<<ptam.
getVCorners()<<
" :: Duration: " << (float)(tFrameEnd - tFrameStart)/CLOCKS_PER_SEC*1000 << std::endl;
116 std::cout <<
"=> _Stop SlamFlex" << std::endl;
#define LOGV(LOG_TAG,...)
void SendTrackerStartSig()
void RunOneFrame(unsigned char *bwImage, uint hnd)
System ptam
PTAM system, whole plane detection is located here.
void SendLogToUnity(const char *st)
Send string to Unity3D
SendMessage SM
used for communication between library and Unity3D
void SetSendMessagesFunc(sendMessageFunc smf, sendPoseFunc spf, sendArrayPoints sar, sendLogFunc sendLog)
Sets callback functions recived from Unity3D
void _StopSlam()
Stops slam plane detection.
void(* sendPoseFunc)(float, float, float, double, double, double)
void _StartPlaneDetection()
Initiate plane detection.
std::string getVCorners()
unsigned char * bwImage
Black and white image.
void(* sendArrayPoints)(int[], int size)
void _StartSlam(void *pointerString, void *pointerPose, void *pointerStringLog, void *pointerArrayOfPoints)
Exported functions from libSlamflex library.
void SendTrackerKillSig()
void SetSendMessageToUnity(SendMessage sm)
void convertToBlackWhite(unsigned char *pixels)
Convert Unity3D web texture image to black and white image.
void(* sendMessageFunc)(const char *)
const char * _SetNewFrame(void *pointer, int width, int height)
Function called each frame with pointer to image and width, height of image.
DetectionState GetCurrentDetectionState()
void(* sendLogFunc)(const char *)
void rgba_to_bgra(unsigned char *pixels, int width, int height)
Change image formats from RGBA to BGRA.
void flip_vertically(unsigned char *pixels, const size_t width, const size_t height, const size_t bytes_per_pixel)
Heleper function for pixel manipulation.