QCameraImageCapture saves to file instead of buffer - c++

I would like to when I capture a photo with my camera it doesn't create a file in the default directory but it uses the buffer instead.
So I have set the capture destination to buffer :cameraImageCapture->setCaptureDestination(QCameraImageCapture::CaptureToBuffer)
However it still saves a file in the directory. I'm on Ubuntu 16.04. Do you have any ideas to solve my problem ? Thank you.

Related

Screen: continuously record the buffer values and save onto a file

I am asking using the screen command in Ubuntu. I know there is a command that use hardcopy which basically save the buffer onto the file. But how do I continously ask screen to write the output onto a file for me?
If I do the following: python my_program > recorder_this.txt, it won't print the stdout and I can't see the print result. I tried the other method and I am currently running it on AWS, it seems to me that it will cause the machine to freeze. Any help?
You can record the screen output with the -L option. screen will then create a file called screenlog.0 in the directory where you ran screen (on Ubuntu you will be able to specify the filename if you want).
screen -L
Another solution is to pipe to tee. It will save the output to a file and also print it.
Example
echo "Hello" | tee file_name

ARToolKit Calibration Result Saving Error

I have been using ARToolKit to calibrate my camera, everything went fine until I tried to save the result, it came up with this error:
Error (13): unable to open camera parameters file "camera_para.dat" for writing.
Result too large
Parameter write error!!
I used the ARToolKit's calib_camera example code.
Thank you in advance!
I've actually figured this out...it was just because my ARToolKit was installed in Program Files folder, which is read-only. To save the results successfully, all you need to do is to run as administrator at the beginning.

Can I queue a delete on a file?

I have data in memory that represents an image. I want to open the image in the default program to open images. Therefore, I create a temporary file, write the data to it, and then open the file with the default application. Currently, I am using Qt to do the last step via QDesktopServices::openUrl ( const QUrl & url ). The problem is that I now have this random file lying around on disk. Is there a way that I can queue a delete on the file so that after the app closes it gets deleted?
As far as OS is concerned, I'd prefer a os independent solution, but I am guessing that none probably exists. Therefore, if you could link to/post how to do it in linux/osx/windows, that would be really helpful.
On a POSIX system (any Unix or Linux machine), there's a nice trick you can take advantage of: you can remove the directory entry for the file with unlink after opening the file. As long as you keep an open filehandle on the file, it will not be removed, but once you've closed it, the filesystem will automatically reclaim the storage.

ImageMagick open and write image with qt ans magick++

Im using Magick++ Library with Qt
Im using the following code to read and write an image:
Image image;
image.read(qPrintable(f.absoluteFilePath()));
image.addNoise(GaussianNoise);
image.magick("png");
image.write("image_name");
Where f.absoluteFilePath is the absolute path for my image
Example: /Users/user/Desktop/test/P1030673.jpg
After the completion of the code, I cannot locate the image named 'image_name'.
I looked into the folder of the first image '/Users/macmini/Desktop/test/' and its not there
I tried to search the image, but it seems is not in my computer.
Where do I go wrong?
How can I save the image in my computer?
is there any way to specify the path that I want the image to be saved?
Thank you
You should find the file saved in the current working directory. If you want to save it elsewhere give an absolute path.
For everyone who might have tha same problem:
Imagemagick will save the images inside the .app bundle
You will not be able to find the image files unless you specify a path inside the read() function
I noticed the following by checking the size of my .app file
It was increased everytime I was trying to save images.

Qt save a QImage to a relative location

I'm using QImage.save to save an image of my OpenGL framebuffer to disk. If I just call save("plot.jpg"), I have no idea where the image ends up. It's not in the application directory. I can call save("/Users/wallacer/desktop/plot.jpg") to save the file on my desktop, but obviously that's no good for running on anyone else's machine. Is there an environment variable or something I can use to save the QImage to a known location? Or is there a way I can just save the image to the directory the application resides in?
This seems obvious, but I can't seem to find anything about choosing a save location in the docs.
Thanks!
You could use QDir::homePath or QDir::home to get a relative (and IIRC, platform independent) path.
ETA: Or the applcation's current path should be in QDir::currentPath.
Ok I feel dumb. I'm just going to use a file dialog to allow the user to select a directory to save the image file in.