Save images in C++, without OpenCV
Hello. I know some might find this weird. I have a SoftKinetic DS311 camera, and we managed to get a LabVIEW interface somewhat working. It works by having modified a sample code to writing .txt files containing the depth info, LabVIEW then scans these files as strings.
The sample code is written in C++, and I would like to also access the color image. Usually I would use LabVIEW to access the camera, but I can't when the sample code is running (the USB is probably busy). So I would like to modify the C++ code to save an image while simoultaneously writing depth info. I would prefer to do so without having to install OpenCV, since this seems quite extensive for my needs. Cheers
now , how is this related to opencv ?
Well, this is a forum for asking questions about opencv, not about not opencv.
Anyway, as I think you are a beginner in C++, I would recommend to use opencv in this case, if you want to save your image as JPG without hassles (see the imwrite function).
Otherwise you can use the libjpeg library. Search google for examples, but I wouldn't recommend it if you are absolute beginner.
BTW, I think it's better to save the depth data to a more compact lossless image format, like tiff instead of txt files.
If you do not wish use OpenCV, you should use a dedicated library targeted to load/save images (libjpeg, libpng, libfreeimage), and see how incorporate it to your code, pretty much as OpenCv does with its own code. Or maybe you should read the specifications of some format (maybe a simple one such as PPM/PGM) and implement it yourself.
I know, this is a weird place to post, but I figured that since you guys know a lot about computer vision, I thought the answer might be here. Yes, I am new to C++. For some reason I have to use Visual Studio 2008, otherwise I get errors when I build my solution. And it seems that OpenCV runs best on VS2010 and forth (or am I mistaken?) Regarding fileformat: again, I am new, and this was a way to make LabVIEW read the depth data :)
If you are really in a pinch to write such images and do not want incorporate external libs to your code, write a function write such data in PPM/PGM format. It is very simple, and I always ask to my students (Programming I) to do that as exercise. Give a look in the specifications here: http://netpbm.sourceforge.net/doc/pgm.html
As far I know, LabView can read such format later without any problems.
^^ voice of reason ;)
Okay, I decided to try OpenCV, However, do there exist an installing guide, where alle the links to all the additional packages and stuff that is required to work, are updated?
there are prebuild opencv libs for windows , unfortunately, afaik, no more for vs2008. (2.4.6 was the last i've seen including those, but it's no more available. falling back to 2.3.1 is not recommended(too old))
so, with vs2008, you'd have to build opencv from src, using cmake. that's absolutely doable, but not for the faint of heart.
hmm, reconsider the ppm idea ? even for a n00b, it's more like 2 hours work vs. 2 days of frustration.
I did reconsider, however you never know if I would need it again in the future. And also the method of writing a .txt file for LabVIEW interpretation is a crude method - it works, but just barely. I actually have Visual Studio 2013. Do I just download and install or how does it work? Btw, I really appreciate you guys taking time to help me though!
for vs2013, it's just download/unpack. (and setup include/library/bin paths)
(and stick with 2.4.9 or 2.4.10 for now. 3.0 might be too much adventure..)