What image file type is expected by Matlab Stereo Camera Calibrator app? - matlab

The Matlab Calibration Workflow documention just says "capture images."
But it doesn't say how, or what file format is required.
My Matlab script has the line:
load('handshakeStereoParams.mat');
...and this .mat file I believe is generated by Matlab's Stereo Camera Calibrator app.

The Mathworks documentation on the Stereo Camera Calibration app does give specific advice on image formats:
Use uncompressed images or lossless compression formats such as PNG.
There's also a great deal more information on the details of what sort of images you need, under the "Image, Camera, and Pattern Preparation" subheading, in the expandable sections.

"Capture images" means take images of the checkerboard pattern with the cameras that you are trying to calibrate. Generally, you can load images of any format that imread can read into the Stereo Camera Calibrator app. However, it is much better not to use a format with lossy compression, like JPEG, because the calibration artifacts affect the calibration accuracy. So if you can configure your camera to save the images as PNG or BMP, you should do that. And if your camera only lets you use JPEG, then turn the image quality up to 100%.

Related

Uploading dynamic textures fast in Unity 3D

I receive jpeg compressed video frames over network in every 30 frames. But I have a low power mobile device and it seems to lag a lot if I upload with the following lines.
Texture2D tex;
tex.LoadImage(MyUDPReceiver.Instance.data_JPG);
Are there any more efficient ways to solve this problem?
You should not use JPEG or PNG images as their decoding is very slow. These textures are also decoded to uncompressed and use a lot of ram.
You should use ETC1 textures, of if you need the alpha channel, DXT5. Note that DXT5 is not supported everywhere so you might also need to support a different type of texture for this (PVRTC?).
There is tex.LoadImageRaw for this, to use it you will need to parse the header for width/height values (just a simple struct).

Correct Video for lens distortion in Matlab?

I have a video that was taken with a GoPro and I would like to get rid of the fisheye distortion. I know I can get rid of the fisheye with the gopro software, but I want to do this using Matlab instead.
I know there's this http://www.mathworks.com/help/vision/ref/undistortimage.html that applies for images, however, how would I apply it for a full video? The number of frames in the video 207 (it's like 5 - 6 second short video).
Thank you very much!
Can't you just sample your video stream at 24fp (using e.g. ffmpeg, see here ), apply your Matlab routine one frame at a time, then rebuild the video stream in Matlab itself?
You can apply undistortImage to each frame of the video. If the video is saved to a file, you can use vision.VideoFileReader to read it one frame at a time, and then you call undistortImage. Then you can write the undistorted frame to a different file using vision.VideoFileWriter, or you can display it using vision.VideoPlayer.
Of course, this is all assuming that you have calibrated your camera beforehand using the Camera Calibrator App.

Opencv open 3d stereo video file and output to display

is there anyone working on extracting the data from a 3d stereo video by using opencv? (e.g. 3d blu-ray). From some documentation, it stated .avi is the only supporting video file format on opencv. If there you are or you know, would you mind to give me a tutorial how to do that. (e.g.A frame of a 3d stereo video should be an image of 2 views plus one depth map? or A frame of a 3d stereo video is 2 images of 2 views and some depth maps?) How to read the information?
An other question is, is there any API in opencv can control the output from the graphic cards ports? I mean if I have a graphic card with two DVI ports, would it be possible for the monitor connected to A-DVI display the left-sided image of the 3d-stereo video while B-DVI display the right-sided image.

How do I convert .pvr (PVRTC) files to .png in iphone?

I need to convert some images from pvr to a png, in run-time in iphone. I need to read them, decompress, transform some colors and then save then to pvr again or png. Any advice ?
This is apple example program that shows you how to load PVR texture files using the included PVRTexture class and then display them using OpenGL.
Do you specifically mean compressed PVRTC textures or any of the formats (e.g. 565, 1555) supported under the PVR? Also, what sort of transformations did you want to do to the colours?
The reason I ask is that, IIRC, there is code to read/manipulate PVR files on the Imagination Technologies dev web pages but if you want to change the colours of PVRTC compressed textures without actually recompressing the data entirely, there will be limits to what you can achieve. Certainly, changing the hue of regions etc will be possible, but manipulating individual pixels is likely to be too difficult.

jpeg to png conversion

I am working on images in iPhone. There are lots of jpeg images which range from 35kb to 50kb. I may need to transfer this over internet which comes around 6 mb. I tried to change a 35kb jpeg image to png. The actual size got increase jpeg was 56.1kb and png is 576 kb. I used mspaint to change the format. jpeg to png should actually decrease the size of the image right ? If no is that ideal to have jpeg files on iphone or only png like typical mobile applications have ?
JPEG and PNG are very different file formats; any given image that is smaller in one may not be smaller in another. And furthermore, their quality is not directly comparable.
For example, photographic content is very well represented in JPEG. The subdivision-of-blocks composed with pattern recognition makes for a format that does a very good job of discarding visual information in a way that human eyes do not easily notice. Of course, a highly-compressed JPEG may throw away too much information and show the blocks and instantly break the illusion of photographic reality, but used carefully, JPEG is fantastic for photos of the 'real world'.
And computer-generated content is very well represented in PNG. The lossless encoding is great for showing the straight lines of standard computer-generated displays, and naively-created gradients are replicated exactly with PNG. Had JPEG been used for either straight lines or naive gradients, the shortcomings would stand out instantly. Also, because PNG can be palette-based, it can very efficiently store images with only a few dozen colors.
So, pick the file format based on its use: JPEG for photos of reality or for very good approximations of reality, and PNG for computer-generated content.
PNG files are usually smaller if their contents are graphical and contain a lot of evenly colored shapes. For photos or scans jpeg files are way smaller, since they use a much more sophisticated, yet lossy, algorithm for compression.
For your iPhone project you should use whatever is smaller, in your case jpeg.