jhdewitt / sltk

An OpenCV-based structured light processing toolkit.
MIT License
255 stars 63 forks source link

make error #3

Closed prahjister closed 6 years ago

prahjister commented 6 years ago

Hey I am trying to compile on my S905X box and I get this error

g++ -c -o hid.o hid_LINUX.c hid_LINUX.c: In function ‘int rawhid_recv(int, void, int, int)’: hid_LINUX.c:123:64: error: invalid conversion from ‘void’ to ‘char’ [-fpermissive] r = usb_interrupt_read(hid->usb, hid->ep_in, buf, len, timeout); ^ In file included from hid_LINUX.c:34:0: /usr/include/usb.h:310:5: note: initializing argument 3 of ‘int usb_interrupt_read(usb_dev_handle, int, char, int, int)’ int usb_interrupt_read(usb_dev_handle dev, int ep, char bytes, int size, ^ hid_LINUX.c: In function ‘int rawhid_send(int, void, int, int)’: hid_LINUX.c:145:70: error: invalid conversion from ‘void’ to ‘const char’ [-fpermissive] return usb_interrupt_write(hid->usb, hid->ep_out, buf, len, timeout); ^ In file included from hid_LINUX.c:34:0: /usr/include/usb.h:308:5: note: initializing argument 3 of ‘int usb_interrupt_write(usb_dev_handle, int, const char, int, int)’ int usb_interrupt_write(usb_dev_handle dev, int ep, const char bytes, int size, ^ hid_LINUX.c:147:77: error: invalid conversion from ‘void’ to ‘char’ [-fpermissive] return usb_control_msg(hid->usb, 0x21, 9, 0, hid->iface, buf, len, timeout); ^ In file included from hid_LINUX.c:34:0: /usr/include/usb.h:312:5: note: initializing argument 6 of ‘int usb_control_msg(usb_dev_handle, int, int, int, int, char, int, int)’ int usb_control_msg(usb_dev_handle *dev, int requesttype, int request, ^ Makefile:94: recipe for target 'hid.o' failed make: *** [hid.o] Error 1

prahjister commented 6 years ago

I see that you are making some changes so i started over and getting this now. I just noticed that you made some changes so i checked it out. With the current changes I get this FYI I am testing in windows subsystem for linux as well and get the same error. It is promising that it will work.

g++ -c -o util.o util.cpp util.cpp: In function ‘bool file_exists(const char)’: util.cpp:35:37: error: ‘fopen’ was not declared in this scope FILE file = fopen(filename, "r"); ^ util.cpp:38:20: error: ‘fclose’ was not declared in this scope fclose(file); ^ util.cpp: In function ‘std::cxx11::string get_pattern_filename(std::cxx11::string)’: util.cpp:48:36: error: ‘sprintf’ was not declared in this scope sprintf(buf,pattern.c_str(),num); ^ util.cpp: In function ‘char findNextName(const char, int)’: util.cpp:58:47: error: ‘calloc’ was not declared in this scope char buf = (char)calloc(100,sizeof(char)); ^ util.cpp:59:27: error: ‘sprintf’ was not declared in this scope sprintf(buf,pattern,n); ^ util.cpp: In function ‘bool getExifMap(std::cxx11::string, exifmap&)’: util.cpp:147:78: error: ‘sprintf’ was not declared in this scope sprintf( command, "/usr/local/bin/exiftool -s -G1 %s 2>&1", fname.c_str() ); ^ util.cpp:148:27: error: ‘popen’ was not declared in this scope fp = popen(command, "r"); ^ util.cpp:151:16: error: ‘stderr’ was not declared in this scope fprintf( stderr, "Failed to run command" ); ^ util.cpp:151:48: error: ‘fprintf’ was not declared in this scope fprintf( stderr, "Failed to run command" ); ^ util.cpp:161:39: error: ‘fgets’ was not declared in this scope while( fgets(sbuf, sizeof(sbuf), fp) != NULL ) ^ util.cpp:165:43: error: ‘strncmp’ was not declared in this scope if(strncmp( sbuf,fnf, sizeof(fnf)-1 )==0){ ^ util.cpp:167:19: error: ‘stderr’ was not declared in this scope fprintf( stderr, "bad filename: %s\n", fname.c_str() ); ^ util.cpp:167:63: error: ‘fprintf’ was not declared in this scope fprintf( stderr, "bad filename: %s\n", fname.c_str() ); ^ util.cpp:168:19: error: ‘pclose’ was not declared in this scope pclose(fp); ^ util.cpp:176:57: error: ‘sscanf’ was not declared in this scope sscanf(sbuf,"[%[^]]] %s : %[^\n]\n",cbuf,kbuf,vbuf); ^ util.cpp:197:13: error: ‘pclose’ was not declared in this scope pclose(fp); ^ util.cpp: In function ‘bool getExifList(std::vector<std::__cxx11::basic_string >&, std::vector<std::map<std::cxx11::basic_string, std::__cxx11::basic_string > >&)’: util.cpp:216:87: error: ‘printf’ was not declared in this scope rintf("(%d chars) list: [%s]\n",(int)concat_list.length(),concat_list.c_str()); ^ util.cpp:222:81: error: ‘sprintf’ was not declared in this scope sprintf( command, "/usr/local/bin/exiftool -s %s 2>&1", concat_list.c_str() ); ^ util.cpp:224:34: error: ‘printf’ was not declared in this scope printf( "$%s\n", command ); ^ util.cpp:225:28: error: ‘popen’ was not declared in this scope fp = popen(command, "r"); ^ util.cpp:239:40: error: ‘fgets’ was not declared in this scope while( fgets(sbuf, sizeof(sbuf), fp) != NULL ) ^ util.cpp:243:46: error: ‘strncmp’ was not declared in this scope if(strncmp( sbuf, fnf, sizeof(fnf)-1 )==0){ ^ util.cpp:244:22: error: ‘stderr’ was not declared in this scope fprintf( stderr, "file for exif data not found\n" ); ^ util.cpp:244:63: error: ‘fprintf’ was not declared in this scope fprintf( stderr, "file for exif data not found\n" ); ^ util.cpp:245:22: error: ‘pclose’ was not declared in this scope pclose(fp); ^ util.cpp:255:53: error: ‘strncmp’ was not declared in this scope if(strncmp( sbuf,fhead, sizeof(fhead)-1 )==0){ ^ util.cpp:256:53: error: ‘sscanf’ was not declared in this scope sscanf(sbuf,"======== %[^\n]\n",fbuf); ^ util.cpp:264:63: error: ‘sscanf’ was not declared in this scope } else if(sscanf(sbuf,"%d image files read",&total)==1){ ^ util.cpp:266:41: error: ‘printf’ was not declared in this scope printf("end found\n"); ^ util.cpp:278:50: error: ‘sscanf’ was not declared in this scope sscanf(sbuf,"%s : %[^\n]\n",kbuf,vbuf); ^ util.cpp:285:14: error: ‘pclose’ was not declared in this scope pclose(fp); ^ util.cpp:288:54: error: ‘printf’ was not declared in this scope printf("[%d maps parsed]\n", (int)maps.size()); ^ util.cpp: In function ‘exifstub parseExifMap(exifmap)’: util.cpp:317:48: error: ‘sscanf’ was not declared in this scope if( sscanf(ImageWidth.c_str(),"%d",&img_w) != 1 ){ ^ util.cpp:320:49: error: ‘sscanf’ was not declared in this scope if( sscanf(ImageHeight.c_str(),"%d",&img_h) != 1 ){ ^ util.cpp:360:52: error: ‘sscanf’ was not declared in this scope if( sscanf(ExifImageWidth.c_str(),"%d",&img_w) != 1 ){ ^ util.cpp:363:53: error: ‘sscanf’ was not declared in this scope if( sscanf(ExifImageHeight.c_str(),"%d",&img_h) != 1 ){ ^ util.cpp:376:61: error: ‘sscanf’ was not declared in this scope int res = sscanf(ExposureTime.c_str(),"%f/%f",&a,&b); ^ util.cpp:389:44: error: ‘sscanf’ was not declared in this scope if( sscanf(FNumber.c_str(),"%f",&fnum) != 1 ){ ^ util.cpp:396:39: error: ‘sscanf’ was not declared in this scope if( sscanf(ISO.c_str(),"%d",&iso) != 1 ){ ^ util.cpp:403:46: error: ‘sscanf’ was not declared in this scope if( sscanf(FocalLength.c_str(),"%f",&fl) != 1 ){ ^ util.cpp:460:60: error: ‘sscanf’ was not declared in this scope if( sscanf(ScaleFactor35efl.c_str(),"%f",&crop_factor) != 1 ){ ^ util.cpp:467:54: error: ‘sscanf’ was not declared in this scope if( sscanf(HyperfocalDistance.c_str(),"%f",&hfd) != 1 ){ ^ util.cpp:474:43: error: ‘sscanf’ was not declared in this scope if( sscanf(FOV.c_str(),"%f deg",&fov) != 1 ){ ^ util.cpp:481:45: error: ‘sscanf’ was not declared in this scope if( sscanf(LightValue.c_str(),"%f",&lv) != 1 ){ ^ util.cpp: In function ‘void printStub(exifstub)’: util.cpp:525:53: error: ‘printf’ was not declared in this scope printf("%s : %s\n",s.make.c_str(),s.model.c_str()); ^ util.cpp: In function ‘bool getExif(std::__cxx11::string, stringmap&)’: util.cpp:544:75: error: ‘sprintf’ was not declared in this scope sprintf( command, "/usr/local/bin/exiftool -s %s 2>&1", fname.c_str() ); ^ util.cpp:545:28: error: ‘popen’ was not declared in this scope fp = popen(command, "r"); ^ util.cpp:548:18: error: ‘stderr’ was not declared in this scope fprintf( stderr, "Failed to run command" ); ^ util.cpp:548:50: error: ‘fprintf’ was not declared in this scope fprintf( stderr, "Failed to run command" ); ^ util.cpp:557:40: error: ‘fgets’ was not declared in this scope while( fgets(sbuf, sizeof(sbuf), fp) != NULL ) ^ util.cpp:561:45: error: ‘strncmp’ was not declared in this scope if(strncmp( sbuf,fnf, sizeof(fnf)-1 )==0){ ^ util.cpp:563:22: error: ‘stderr’ was not declared in this scope fprintf( stderr, "bad filename: %s\n", fname.c_str() ); ^ util.cpp:563:66: error: ‘fprintf’ was not declared in this scope fprintf( stderr, "bad filename: %s\n", fname.c_str() ); ^ util.cpp:564:22: error: ‘pclose’ was not declared in this scope pclose(fp); ^ util.cpp:569:46: error: ‘sscanf’ was not declared in this scope sscanf(sbuf,"%s : %[^\n]\n",kbuf,vbuf); ^ util.cpp:575:14: error: ‘pclose’ was not declared in this scope pclose(fp); ^ Makefile:98: recipe for target 'util.o' failed make: *** [util.o] Error 1

jhdewitt commented 6 years ago

Hello please try latest version of repo; the three recent commits fix different stuff. And the util.ccp errors. Thank!

prahjister commented 6 years ago

Both give this g++ -c -o util.o util.cpp g++ -lstdc++ -lGL -lGLU -lglut sdl2-config --static-libs --cflags pkg-config --libs --cflags liblo sldisp.cpp util.cpp -o bin/sldisp /bin/sh: 1: sdl2-config: not found /bin/sh: 1: pkg-config: not found sldisp.cpp:11:19: fatal error: lo/lo.h: No such file or directory compilation terminated. Makefile:64: recipe for target 'sldisp' failed make: *** [sldisp] Error 1

jhdewitt commented 6 years ago

Aha, sorry I really need to write up a comprehensive install guide for linux..

These errors indicate you do not have SDL2, pkg-config, or liblo (OSC communication).

Please try these commands to get the libraries. Sorry for so many hangups in compilation. sudo apt-get install pkg-config sudo apt-get install libsdl2-dev sudo apt-get install liblo-dev

If you wish to run the processing programs on raspi as well you will need to install opencv which I don't know of a oneliner to install. slcrunch and slcalibrate both need opencv. Removing those two from the makefile until opencv is installed might be good.

prahjister commented 6 years ago

getting further now I installed these sudo apt install pkg-config libsdl2-dev liblo-dev python-opencv freeglut3-dev

But now i just removed opencv and using this script to install

https://milq.github.io/install-opencv-ubuntu-debian/

I don't think it is opencv related and I found some reference to the linking and linking order during searching sdl error but I don't know how to correct..I am sorry this is above my paygrade

I am keeping my notes and will pass along in the end. opencv is compiling now.

Looks like this will take a while....will come back tomorrow night

g++ -c -o util.o util.cpp g++ -lstdc++ -lGL -lGLU -lglut sdl2-config --static-libs --cflags pkg-config --libs --cflags liblo sldisp.cpp util.cpp -o bin/sldisp /tmp/ccO0ZMZQ.o: In function logSDLError(std::ostream&, std::__cxx11::basic_str ing<char, std::char_traits<char>, std::allocator<char> > const&)': sldisp.cpp:(.text+0x26c): undefined reference toSDL_GetError' /tmp/ccO0ZMZQ.o: In function gen_graycode(SDL_Surface*, std::vector<unsigned in t, std::allocator<unsigned int> >&, bool, int, int, float, float, float)': sldisp.cpp:(.text+0x380): undefined reference toSDL_LockSurface' sldisp.cpp:(.text+0x5bc): undefined reference to SDL_UnlockSurface' /tmp/ccO0ZMZQ.o: In functiongen_sine(SDL_Surface, int, float, float, float, f loat, float)': sldisp.cpp:(.text+0x620): undefined reference to SDL_LockSurface' sldisp.cpp:(.text+0x878): undefined reference toSDL_UnlockSurface' /tmp/ccO0ZMZQ.o: In function `gen_rgb(SDL_Surface, float, float, float)': sldisp.cpp:(.text+0x8dc): undefined reference to SDL_LockSurface' sldisp.cpp:(.text+0xa58): undefined reference toSDL_UnlockSurface' /tmp/ccO0ZMZQ.o: In function configure_SDL(CLIENT_STATE*)': sldisp.cpp:(.text+0xaa0): undefined reference toSDL_Init' sldisp.cpp:(.text+0xb08): undefined reference to SDL_GetCurrentDisplayMode' sldisp.cpp:(.text+0xb38): undefined reference toSDL_GetError' sldisp.cpp:(.text+0xbf8): undefined reference to SDL_CreateWindow' sldisp.cpp:(.text+0xc4c): undefined reference toSDL_CreateRGBSurface' sldisp.cpp:(.text+0xc64): undefined reference to SDL_GetWindowSurface' sldisp.cpp:(.text+0xcd8): undefined reference toSDL_CreateRenderer' sldisp.cpp:(.text+0xd44): undefined reference to SDL_GL_CreateContext' /tmp/ccO0ZMZQ.o: In functionconfigure_GL(CLIENT_STATE)': sldisp.cpp:(.text+0xe04): undefined reference to SDL_GL_SetSwapInterval' sldisp.cpp:(.text+0xe18): undefined reference toglClearColor' sldisp.cpp:(.text+0xe20): undefined reference to glMatrixMode' sldisp.cpp:(.text+0xe24): undefined reference toglLoadIdentity' sldisp.cpp:(.text+0xe2c): undefined reference to glEnable' sldisp.cpp:(.text+0xe40): undefined reference toglGenTextures' sldisp.cpp:(.text+0xe54): undefined reference to glBindTexture' sldisp.cpp:(.text+0xe64): undefined reference toglTexParameteri' sldisp.cpp:(.text+0xe74): undefined reference to glTexParameteri' /tmp/ccO0ZMZQ.o: In functiondraw_pattern(SDL_Window)': sldisp.cpp:(.text+0xeb8): undefined reference to SDL_GetWindowSize' sldisp.cpp:(.text+0xec0): undefined reference toglClear' sldisp.cpp:(.text+0xedc): undefined reference to glViewport' sldisp.cpp:(.text+0xee4): undefined reference toglMatrixMode' sldisp.cpp:(.text+0xee8): undefined reference to glLoadIdentity' sldisp.cpp:(.text+0xef0): undefined reference toglMatrixMode' sldisp.cpp:(.text+0xef4): undefined reference to glLoadIdentity' sldisp.cpp:(.text+0xf20): undefined reference toglOrtho' sldisp.cpp:(.text+0xf28): undefined reference to glBegin' sldisp.cpp:(.text+0xf34): undefined reference toglTexCoord2i' sldisp.cpp:(.text+0xf44): undefined reference to glVertex3f' sldisp.cpp:(.text+0xf50): undefined reference toglTexCoord2i' sldisp.cpp:(.text+0xf64): undefined reference to glVertex3f' sldisp.cpp:(.text+0xf70): undefined reference toglTexCoord2i' sldisp.cpp:(.text+0xf88): undefined reference to glVertex3f' sldisp.cpp:(.text+0xf94): undefined reference toglTexCoord2i' sldisp.cpp:(.text+0xfac): undefined reference to glVertex3f' sldisp.cpp:(.text+0xfb0): undefined reference toglEnd' sldisp.cpp:(.text+0xfb8): undefined reference to SDL_UpdateWindowSurface' /tmp/ccO0ZMZQ.o: In functionmain': sldisp.cpp:(.text+0x103c): undefined reference to lo_server_thread_new' sldisp.cpp:(.text+0x1060): undefined reference tolo_server_thread_add_method' sldisp.cpp:(.text+0x1090): undefined reference to lo_server_thread_add_method' sldisp.cpp:(.text+0x10c0): undefined reference tolo_server_thread_add_method' sldisp.cpp:(.text+0x10f0): undefined reference to lo_server_thread_add_method' sldisp.cpp:(.text+0x1120): undefined reference tolo_server_thread_add_method' /tmp/ccO0ZMZQ.o:sldisp.cpp:(.text+0x1150): more undefined references to lo_serv er_thread_add_method' follow /tmp/ccO0ZMZQ.o: In functionmain': sldisp.cpp:(.text+0x1158): undefined reference to lo_server_thread_start' sldisp.cpp:(.text+0x116c): undefined reference tolo_address_new' sldisp.cpp:(.text+0x11c8): undefined reference to lo_address_errno' sldisp.cpp:(.text+0x11d4): undefined reference tolo_address_errstr' sldisp.cpp:(.text+0x122c): undefined reference to SDL_ShowCursor' sldisp.cpp:(.text+0x1234): undefined reference toSDL_PollEvent' sldisp.cpp:(.text+0x12e4): undefined reference to SDL_GetWindowDisplayIndex' sldisp.cpp:(.text+0x1308): undefined reference toSDL_GetDisplayBounds' sldisp.cpp:(.text+0x1344): undefined reference to SDL_SetWindowFullscreen' sldisp.cpp:(.text+0x134c): undefined reference toSDL_ShowCursor' sldisp.cpp:(.text+0x136c): undefined reference to SDL_SetWindowFullscreen' sldisp.cpp:(.text+0x1374): undefined reference toSDL_ShowCursor' sldisp.cpp:(.text+0x1384): undefined reference to SDL_SetWindowBordered' sldisp.cpp:(.text+0x13a4): undefined reference toSDL_GetWindowSize' sldisp.cpp:(.text+0x13c8): undefined reference to SDL_SetWindowSize' sldisp.cpp:(.text+0x1410): undefined reference toSDL_GetWindowDisplayIndex' sldisp.cpp:(.text+0x1424): undefined reference to SDL_GetDisplayBounds' sldisp.cpp:(.text+0x1454): undefined reference toSDL_GetWindowSize' sldisp.cpp:(.text+0x1718): undefined reference to glBindTexture' sldisp.cpp:(.text+0x1764): undefined reference toglTexImage2D' sldisp.cpp:(.text+0x17cc): undefined reference to SDL_UpperBlit' sldisp.cpp:(.text+0x17d8): undefined reference toSDL_RenderPresent' sldisp.cpp:(.text+0x17f0): undefined reference to SDL_DestroyRenderer' sldisp.cpp:(.text+0x17fc): undefined reference toSDL_DestroyWindow' sldisp.cpp:(.text+0x1800): undefined reference to SDL_Quit' sldisp.cpp:(.text+0x1808): undefined reference tolo_server_thread_free' /tmp/ccO0ZMZQ.o: In function generic_handler(char const*, char const*, lo_arg** , int, void*, void*)': sldisp.cpp:(.text+0x192c): undefined reference tolo_arg_pp' /tmp/ccO0ZMZQ.o: In function send_display_info(void*, int, int)': sldisp.cpp:(.text+0x2014): undefined reference tolo_send_internal' /tmp/ccO0ZMZQ.o: In function send_pattern_status(void*, int, int, int, float, f loat, float)': sldisp.cpp:(.text+0x20d0): undefined reference tolo_send_internal' /tmp/ccO0ZMZQ.o: In function send_pattern_state(void*, int, float, float, float , float, float, float, float)': sldisp.cpp:(.text+0x21a4): undefined reference tolo_send_internal' /tmp/ccO0ZMZQ.o: In function send_heartbeat(void*)': sldisp.cpp:(.text+0x2214): undefined reference tolo_send_internal' collect2: error: ld returned 1 exit status Makefile:64: recipe for target 'sldisp' failed make: *** [sldisp] Error 1

jhdewitt commented 6 years ago

Hello looks like a mucky situation for now. It seems that neither SDL2 or liblo headers/library are being properly found after installation. Blech.

I will try to get sltk building on a fresh raspbian install and document steps. Not sure what if any important differences there are with armbian flavor. This is honestly the first time I've seriously considered building every single program on rpi (originally just intended to run sldisp for output and mjpg-streamer for input with slturn for turntable, these are all rather light programs). My preferred setup has been to have those three run on raspi and then do all heavy lifting on a "desktop class" computer.

Anyways, compiling opencv from source on raspberry pi can be a painfully long process. Will update in a day or two with findings on fresh build instructions.

edit: thanks a lot for the opencv install link; i use homebrew on macos so my apt-get-fu is a bit weak.

prahjister commented 6 years ago

i am getting the same error in wsl. These are both based on ubuntu 16.04. May want to fire up a virtual machine with 16.04 and test that way to save some time

how can i test this https://stackoverflow.com/questions/17386032/sdl2-wont-link-properly and https://stackoverflow.com/questions/33192991/undefined-reference-to-sdl2-functions-in-linked-library-codeblocks and https://stackoverflow.com/questions/33192991/undefined-reference-to-sdl2-functions-in-linked-library-codeblocks

or maybe

https://ubuntuforums.org/archive/index.php/t-1081422.html

or is this not an issue

jhdewitt commented 6 years ago

can you please paste the result of sdl2-config --static-libs --cflags and pkg-config --libs --cflags liblo

thank

these are the results on my arm box

$sdl2-config --static-libs --cflags

-L/usr/lib/arm-linux-gnueabihf -lSDL2 -lpthread -Wl,--no-undefined -lm -ldl -lasound -lm -ldl -lpthread -lpulse-simple -lpulse -lX11 -lXext -lXcursor -lXinerama -lXi -lXrandr -lXss -lXxf86vm -lwayland-egl -lwayland-client -lwayland-cursor -lxkbcommon -lpthread -lrt -I/usr/include/SDL2 -D_REENTRANT

$pkg-config --cflags --libs sdl2

-D_REENTRANT -I/usr/include/SDL2 -lSDL2

$pkg-config --libs --cflags liblo

-llo -lpthread

prahjister commented 6 years ago
cnx@amlogicocto:~$ sdl2-config --static-libs --cflags
-L/usr/lib/aarch64-linux-gnu -lSDL2 -Wl,--no-undefined -lm -ldl -lasound -lm -ldl -lpthread -lpulse-simple -lpulse -lsndio -lX11 -lXext -lXcursor -lXinerama -lXi -lXrandr -lXss -lXxf86vm -lwayland-egl -lwayland-client -lwayland-cursor -lxkbcommon -lpthread -lrt
-I/usr/include/SDL2 -D_REENTRANT
cnx@amlogicocto:~$ pkg-config --libs --cflags liblo
-llo -lpthread
cnx@amlogicocto:~$

i was just looking at https://wiki.libsdl.org/Installation

prahjister commented 6 years ago

what do these differences mean?

jhdewitt commented 6 years ago

Hello thank you for the output. The only difference I see between our output is: -L/usr/lib/aarch64-linux-gnu vs -L/usr/lib/arm-linux-gnueabihf (mine) and -lsndio vs [x] (not present in mine)

I take it this means the library was installed in a different directory, but this shouldn't matter as long as it's passed in. I am not sure why you are seeing those errors in conjunction with that sdl2-config output. This SO post seems promising: https://stackoverflow.com/a/18182369 . I updated Makefile to reflect that answer's suggestion. Perhaps it might fix the errors you are seeing.

Here is a rough draft of a start-to-finish compilation guide (not yet tested):

https://github.com/jhdewitt/sltk/wiki/Compilation-Guide

prahjister commented 6 years ago

Spectrum has stopped my progress for the night. I think they are doing work in the area. Seems to go out at midnight every night for the past couple weeks. I have no choice but to stop. Ohh make clean doesn't seem to work and get an error. I think this is how to start over testing changes

prahjister commented 6 years ago

BTW thank you for the time you r spending

jhdewitt commented 6 years ago

Thanks. Sharing software doesn't do much good if it can't be used/reproduced on other peoples' machines, so cheers for participating in testing.

prahjister commented 6 years ago

I think it will be worth it. It will help bring this technology down to a reasonable price point.

On a side note I saw some of your scans using photogrammetry. Which gets better scans? Photogrammetry or structured light? Are there any free desktop apps ? All I found r cloud based. I am wanting to test both versions out.

jhdewitt commented 6 years ago

:)

Agisoft photoscan (has a trial mode, is desktop app) is the program I use most for photogrammetry, recommend trying. Generally I find that structured light results in more detailed/rich geometry because camera+projector=direct binary code matches vs optimized feature "guess" matching. Textures are basically same because source image is same if that makes sense.

Recently began trying out realitycapture (desktop app) but their subscription model is not appealing to me despite some perks vs photoscan (some parts of processing seem faster).

prahjister commented 6 years ago

Morning...i started over and I get this error now

g++ -c -o sl_util.o sl_util.cpp sl_util.cpp: In function ‘void printbin(int)’: sl_util.cpp:31:15: error: ‘printf’ was not declared in this scope printf("["); ^ Makefile:104: recipe for target 'sl_util.o' failed make: *** [sl_util.o] Error 1

prahjister commented 6 years ago

i added #include to sl_util.cpp to get past this error

now getting back cv error

prahjister commented 6 years ago

after reordering the remaining similar to this I was able to compile all except plyalign, plytrim, plymerge

$(CC) chessgen.cpp util.cpp -o bin/chessgen $(CFLAGS) $(CLIB) $(FLAGS_OPENCV)

I am getting pcl error on these. I am compiling pcl now

jhdewitt commented 6 years ago

I was able to compile all except plyalign, plytrim, plymerge

Oh wow, exciting news! PCL is even fatter than OpenCV, and is only linked in ply* programs (plyalign,trim,merge). These represent the least developed part of the project.

I have to admit, the makefile stuff for including PCL is pretty janky. Documentation on the most recent version only has info for CMakeFiles.txt. Not sure how to add CMakeFiles.txt and integrate that into the Makefile just for those three programs.

now getting back cv error

Can has cv error if it's still happening?

i added #include to sl_util.cpp to get past this error

Fixed, oops I had the include on local but repo wasn't up to date. https://github.com/jhdewitt/sltk/commit/d25cda6d41a08971aa576f2ef5ba962438bf3e78

prahjister commented 6 years ago

Here is the makefile i have been using. Mostly working

Makefile.zip

prahjister commented 6 years ago

sorry i didnt refresh my browser only error now if ply is experimental is this is with above makefile

g++      slcrunch.cpp util.cpp sl_util.cpp -o bin/slcrunch  -lstdc++     `pkg-config --libs --cflags opencv`
/tmp/ccFG6E85.o: In function `parseStringList(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&)':
slcrunch.cpp:(.text+0x5dc): undefined reference to `is_dir(char const*)'
/tmp/ccFG6E85.o: In function `main':
slcrunch.cpp:(.text+0x35a8): undefined reference to `is_dir(char const*)'
collect2: error: ld returned 1 exit status
Makefile:69: recipe for target 'slcrunch' failed
make: *** [slcrunch] Error 1
prahjister commented 6 years ago

can you use older pcl 1.7.2

prahjister commented 6 years ago

I will be back in about 4 hours Family Time

jhdewitt commented 6 years ago

g++ slcrunch.cpp util.cpp sl_util.cpp -o bin/slcrunch -lstdc++ pkg-config --libs --cflags opencv /tmp/ccFG6E85.o: In function parseStringList(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&)': slcrunch.cpp:(.text+0x5dc): undefined reference tois_dir(char const*)'

This error should be fixed now https://github.com/jhdewitt/sltk/commit/6fcbcd1a63e18410a296243ab9744ff78676ff53 (shortsighted ifdef)

Will update Makefile later today.

can you use older pcl 1.7.2

Yes good idea will try building ply* with older PCL version today and change software setup accordingly if goes well.

prahjister commented 6 years ago

i updated then used the makefile with no ply* and we have success This is on S905x box. Trying Ubuntu on Windows 10

cnx@amlogicocto:~/sltk-master$ make
g++      -c -o util.o util.cpp
g++      -c -o sl_util.o sl_util.cpp
g++      slcrunch.cpp util.cpp sl_util.cpp -o bin/slcrunch  -lstdc++     `pkg-config --libs --cflags opencv`
g++      slcalibrate.cpp util.cpp -o bin/slcalibrate  -lstdc++   `pkg-config --libs --cflags opencv`
g++      plotlens.cpp util.cpp sl_util.cpp -o bin/plotlens  -lstdc++     `pkg-config --libs --cflags opencv`
g++      chessgen.cpp util.cpp -o bin/chessgen  -lstdc++         `pkg-config --libs --cflags opencv`
g++      chessfind.cpp util.cpp -o bin/chessfind  -lstdc++       `pkg-config --libs --cflags opencv`
g++      listcreator.cpp -o bin/listcreator  -lstdc++    `pkg-config --libs --cflags opencv`
cnx@amlogicocto:~/sltk-master$
prahjister commented 6 years ago

lol i dont think it worked i think first 2 failed

jhdewitt commented 6 years ago

Oh boy!

Do they compile but produce errors upon running?

prahjister commented 6 years ago

i dont have any output in the bin folder

prahjister commented 6 years ago

cnx@amlogicocto:~/sltk-master$ make sldisp g++ -lstdc++ -lGL -lGLU -lglut sldisp.cpp util.cpp -o bin/sldisp sdl2-config --static-libs --cflags pkg-config --libs --cflags liblo /tmp/ccgTujHZ.o: In function configure_GL(CLIENT_STATE*)': sldisp.cpp:(.text+0xe18): undefined reference toglClearColor' sldisp.cpp:(.text+0xe20): undefined reference to glMatrixMode' sldisp.cpp:(.text+0xe24): undefined reference toglLoadIdentity' sldisp.cpp:(.text+0xe2c): undefined reference to glEnable' sldisp.cpp:(.text+0xe40): undefined reference toglGenTextures' sldisp.cpp:(.text+0xe54): undefined reference to glBindTexture' sldisp.cpp:(.text+0xe64): undefined reference toglTexParameteri' sldisp.cpp:(.text+0xe74): undefined reference to glTexParameteri' /tmp/ccgTujHZ.o: In functiondraw_pattern(SDL_Window*)': sldisp.cpp:(.text+0xec0): undefined reference to glClear' sldisp.cpp:(.text+0xedc): undefined reference toglViewport' sldisp.cpp:(.text+0xee4): undefined reference to glMatrixMode' sldisp.cpp:(.text+0xee8): undefined reference toglLoadIdentity' sldisp.cpp:(.text+0xef0): undefined reference to glMatrixMode' sldisp.cpp:(.text+0xef4): undefined reference toglLoadIdentity' sldisp.cpp:(.text+0xf20): undefined reference to glOrtho' sldisp.cpp:(.text+0xf28): undefined reference toglBegin' sldisp.cpp:(.text+0xf34): undefined reference to glTexCoord2i' sldisp.cpp:(.text+0xf44): undefined reference toglVertex3f' sldisp.cpp:(.text+0xf50): undefined reference to glTexCoord2i' sldisp.cpp:(.text+0xf64): undefined reference toglVertex3f' sldisp.cpp:(.text+0xf70): undefined reference to glTexCoord2i' sldisp.cpp:(.text+0xf88): undefined reference toglVertex3f' sldisp.cpp:(.text+0xf94): undefined reference to glTexCoord2i' sldisp.cpp:(.text+0xfac): undefined reference toglVertex3f' sldisp.cpp:(.text+0xfb0): undefined reference to glEnd' /tmp/ccgTujHZ.o: In functionmain': sldisp.cpp:(.text+0x1718): undefined reference to glBindTexture' sldisp.cpp:(.text+0x1764): undefined reference toglTexImage2D' collect2: error: ld returned 1 exit status Makefile:67: recipe for target 'sldisp' failed make: *** [sldisp] Error 1

prahjister commented 6 years ago

before we go any further....can these be launched from the command line or do i need a gui?

jhdewitt commented 6 years ago

Aha, all the tools in this repo are command line runnables. That said, there are some visual things. I keep a bookmark to mjpg-streamer so I can get the focus and framing right.

Control of slcapture.py is done by OSC packets which are generated for now by a Processing Sketch called slcontrol which I just added to the repo.

Updated Compliation Guide with screenshot and info about copying the GUI program.

Here's what the interface looks like: https://raw.githubusercontent.com/jhdewitt/sltk/master/img/slcontrol_gui_simple.png

To capture data, I configure the IP endpoints in the code and do the following:

The progress bars in the interface should show the progress of the scan sequence to help with moments of impatience, since it can take a while (something I hear is common with 3d printing)

jhdewitt commented 6 years ago

Regarding the OpenGL related linking/undefined reference errors: this post seems promising.

As per the thread, maybe try moving $(FLAGS_GL) to the end of the Makefile line for sldisp

prahjister commented 6 years ago

yes moving flags+gl to the end worked.

prahjister commented 6 years ago

ok i am flashing a new img...didnt realize we needed a gui

jhdewitt commented 6 years ago

Would you have any interest in a (hypothtical, not yet written) command line tool to kick off a scan?

For now, slcontrol is the only turnkey convenient way to generate the OSC packets that slcapture.py uses to decide when to begin triggering the projector/camera.

prahjister commented 6 years ago

i only have to run that one command?

prahjister commented 6 years ago

where is slcontrol i dont see it in the bin or makefile

jhdewitt commented 6 years ago

Hi sorry I haven't written such a command line program yet, just was wondering if a GUI is inconvenient for your use case (e.g. triggering at end of print?). Right now slcontrol is a Processing sketch GUI, not a command line program.

All the programs mentioned in Data Capture How-to are needed to get it working

prahjister commented 6 years ago

i believe i need sldisp to have a gui to work

prahjister commented 6 years ago

you will really need to dumb this down for me to get this to work lol

jhdewitt commented 6 years ago

Ahhh right yes sorry I conflated some stuff. I'm trying to iron out what details are important to mention in guides so I can put them into the wiki.

sldisp does require gui because it's meant to run as a fullscreen program

jhdewitt commented 6 years ago

Data Capture How-to This guide. Trying to centralize stuff because long threads are easy to get lost in for me.

I think a source of confusion here might be the way I use the programs in my setup. For me, there's two computers: laptop and raspi

laptop runs:

raspi runs:

Raspi runs continuously, and I can come and go with laptop as please. When on same LAN as raspi, I run slcapture.py and open slcontrol, then click START_CAPTURE in the gui to begin capturing data. If only one scan is desired, the GUI can be safely closed before the sequence finishes.

In your case, it sounds like you're trying to run all the software on the raspberry pi. Is this accurate? I absolutely want to support that use case (all programs on raspi).

prahjister commented 6 years ago

I would like to run all apps on one box preferable through an ssh session and or remote desktop app

prahjister commented 6 years ago

if it is not one thing its another. mjpeg streamer installing working not on this img i downloaded. I think i have to update opencv

prahjister commented 6 years ago

How do you start slcontrol? What is it?

jhdewitt commented 6 years ago

how to start slcontrol

It is a *.pde file for https://processing.org/ which is based on Java. To run it, download from https://processing.org/download/ and move https://github.com/jhdewitt/sltk/tree/master/slcontrol to your Processing folder in home/documents folder then double click and run. Usually ~/Documents/Processing

As a reminder IP address endpoint config is hardcoded so this likely must be all changed to 127.0.0.1.

what is it?

slcontrol is a control GUI only; no logic happens there and no processing at all, just a friendly user interface to craft a single OSC packet. It sends an OSC packet to slcapture.py specifying what type of structured light pattern is desired and how many turns/degrees per turn and slcapture.py handles the rest. So just buttons and sliders and remote procedure call that kicks everything off.

prahjister commented 6 years ago

Can I run slcontrol on Windows box and everything else on other. Then use a putty session to start and stop everything.

jhdewitt commented 6 years ago

Yes, that should work and is my preferred style of use.

Perhaps to demystify this program, the critical function slcontrol serves is this snippet:

OscMessage startMessage = new OscMessage("/start_capture"); startMessage.add(scanN); startMessage.add(int(16*turnN*STEP_PER_DEG)); startMessage.add(cp5.get(Textfield.class, "scan_name").getText()); oscP5.send(startMessage, remoteControl);

(remoteControl is slcapture.py)

Three values determine the "capture sequence":

  1. how many total scans
  2. how many steps to turn between each scan
  3. what to name the folder of folders containing images

The rest of the program is basically pretty sliders to control the above parameters.