bytedeco / procamcalib

A User-Friendly Method to Calibrate Cameras and Projector-Camera Systems
GNU General Public License v2.0
74 stars 26 forks source link

Using procamcalib with CCDbcamera #4

Closed DanLighter closed 8 years ago

DanLighter commented 8 years ago

Hi Samuel,

Firstly, thank you for developing this awesome piece of software!

I am basically using it to calibrate the positions of cameras and projectors for a surface capture imaging system. This consists of 1 webcam, 1 projector and 1 CCD camera.

I have managed to get the calibration procedure to work when using just the webcam and projector straight through OpenCV setting. I am now trying to add the additional CCD camera simultaneously.

I have downloaded and compiled the libdc1394 library and when I run it I can get the camera to capture frames.

However what settings would I need to point the procamcalib software in the direction of the CCD camera please? When I run at the moment I get the following error. ps. I am not very familiar with Java.

error

These are the settings I currently have (basically default) for the ProCamCalib software.

settings for sam

Many thanks in advance for your help!

Dan

saudet commented 8 years ago

You've compiled libdc1394 for Windows and you've confirmed that it works for your camera?

saudet commented 8 years ago

I see you did. So, we would need to generate JNI bindings for that now... Could you try to follow the instructions on the following page? https://github.com/bytedeco/javacpp-presets/#build-instructions Or at least could you tell me how you got libdc1394 to work on Windows, and I'll add it to the cppbuild.sh script? Thanks!

DanLighter commented 8 years ago

Hi sam, thanks for the quick response. I compiled libdc1394 using MinGW to create an exe file which can run the camera. So I have all the cpp files available in the environment path. I will try following those build instructions and let you know how i get on! Thanks

saudet commented 8 years ago

You didn't need to specify any special configure flags? It just worked?

DanLighter commented 8 years ago

The only thing I changed from default settings in the cpp code was the image resolution to 1024 x 1024. When I compiled it, it recognized the camera from the IEEE1394 port.

saudet commented 8 years ago

It requires the CMU 1394 Camera Driver to be installed though:

checking for GetCmdrVersion in -l1394camera... no
configure: error: lib1394camera not found or too old. Please upgrade to 6.4.5 or a more recent version.

And we might want to install libusb as well: pacman -S mingw-w64-x86_64-libusb mingw-w64-i686-libusb

I can easily produce an EXE with that, but not a DLL like we need for Java. Do you know how to make it create a DLL?

saudet commented 8 years ago

Oh, I think I got something working. Get the latest commit above and try a mvn clean install on that!

DanLighter commented 8 years ago

Yes sorry I forgot to mention I installed the CMU driver and changed the driver on the camera to the CMU one. Ok looks great. I am away from work for the next 9 days on a conference, but I will try the above when I am back on my uni computer with the CCD. Thanks for the help!

DanLighter commented 8 years ago

hi samuel, I have been back and having a play with this again this week. we have been trying desperately to get it to compile but had a lot of issues along the way

am i right in saying that I first need to build javacpp in maven and javacpp presets then once that is in the repository run install on the libdc1394 build? is it possible to simply compile the libdc1394 in maven and the copy over the jar files into the existing folder. at the moment i am just running mvn install --projects .,libdc1394

or will i need to compile all the different plugins by building and running mvn clean install on all of these files after downloading them all?

would it also be possible to get a copy of the compiled jar file that worked for you please so i can test it in the software to see if it will be compatible with my CMU? thanks for your help in advance

saudet commented 8 years ago

You could build libdc1394 only yes, but you would need to backport the changes to JavaCPP 1.1.

Anyway, we should be making a new release by next week, so you could also wait a bit.

saudet commented 8 years ago

I've released version 1.2, which should work out of the box with libdc1394 on Windows.

Thanks for reporting this!

DanLighter commented 8 years ago

Hi Samuel,

Thanks for the update. I have been playing with it this morning. At the moment I am having difficulty with the new 1.2 version. It crashes on my system the moment I do anything ie. try to load in previous calibration pcc settiongs. I get the following error

java platform se binary has stopped working

And then it closes. However version 1.1 seems to work so I wouldn't think it is an issue with my java platform but I could be wrong. I have the most up to date version. I have also tried it on multiple computers and I get the same issue.

Thanks for your help again,

saudet commented 8 years ago

Well, it works here (Windows 10), so I will not be able to debug something that works fine.

If you could try to build from source and figure out what makes it work on your system, that would help.

DanLighter commented 8 years ago

Ok I will have another go at the build again and let you know how I get on

saudet commented 8 years ago

Thanks! BTW, instructions for that are here: https://github.com/bytedeco/javacpp-presets/wiki/Build-Environments#windows-x86-and-x86_64

saudet commented 8 years ago

You know, I don't have a camera to test libdc1394 at the moment, so there are good chances this is related to the new libdc1394 module for Windows. If you remove the libdc1394*jar files from the modules directory, does it still crash? If not, then we could limit our investigation to that module...

DanLighter commented 8 years ago

yep we did have a go at just removing those files, but it still crashed. the good news is before it crashes when i have the camera plugged in it recognises it. do you know of a way i could debug or get a problem signature when running the module to give you a bit more info? I tried running the file through command line but got no information back on why it crashed.

i am just trying the build again from source and getting further than before

saudet commented 8 years ago

When the JVM crashes, it usually creates a log file with a name like hs_err_pidxxxx.log either in the current directory or in a temporary directory somewhere. That should contain useful information.

DanLighter commented 8 years ago

Ok I think i have found the Java error. Does this mean anything useful? (sorry for the lack of knowledge, i am not a computer science student) hs_err_pid5852.txt

saudet commented 8 years ago

I've seen crashes like that with older system libraries on Linux before. Maybe the same bug is in the current version of libraries on Windows in MSYS2...

DanLighter commented 8 years ago

one question, if i boot in linux and run procamcalib either 1.1 or 1.2 i shouldnt have the same problem?

saudet commented 8 years ago

It's possible, but I think it's a bug in some versions of the libraries that's used on both platforms...

saudet commented 8 years ago

Since this problem seems to be happening only during deallocation, you could try to set the "org.bytedeco.javacpp.nopointergc" system property to "true". This will lead to memory leaks, but the calibration session doesn't usually take too much time, so I don't think it would be an issue. :)

saudet commented 7 years ago

While doing some testing for the release of version 1.3, I encountered those crashes and setting the "org.bytedeco.javacpp.nopointergc" property to "true" does indeed work around the problem so I have added that flag to the launch script by default...