OpenCV. Copy image from unsigned char buffer, resize and save to file

How to copy image from unsigned char buffer, resize and save to file.
If you use single-channel image.

#include <opencv/cv.h>
#include <opencv/highgui.h>

                int coeff = 4;
                cv::Mat src( height, width, CV_8UC1, (void *) source_byte_beffer ) );
                cv::Mat small(height/ coeff, width/ coeff, CV_8UC1 );

                cv::Size s_half(width/ coeff, height/ coeff);
                cv::resize( src, small, s_half, 1, 1, cv::INTER_LINEAR ); // resize from src to small

                IplImage* writeImage;
                writeImage=cvCloneImage(&(IplImage)src);
                cvSaveImage("src1.bmp", writeImage);
                cvReleaseImage( &writeImage );

                writeImage=cvCloneImage(&(IplImage)small);
                cvSaveImage("little.bmp", writeImage);
                cvReleaseImage( &writeImage );


                //Another way of writtting:               
                /*cvWrite("src.bmp", src );
                cv::imwrite( "small.bmp", small );*/

                
         

SVN copy certain subdirectories to a branch

There was always a problem for me to copy only certain directories from one branch to another.
For example we have following directory structure:
trunk
      - project1
      - project2
          -subdir1
          -subdir2
          -subdir3        
We want to copy only subdir2 to a branch /branches/branch1 with saving all the structure of projects.
branches/branch1
      - project1
      - project2
          -subdir2
We want to copy only subdir2 to a branch /branches/branch1 with saving all the structure of projects.
Such a manipulation is required if you want to make a private branch for outsorcer and you don't wan him to see the other parts of the code. However you want to support reintegration of the branch back to the trunk.

The solution is 
svn cp --parents ./project2/subdir2 http://repo.url/branches/branch1/project2/subdir2
or
svn cp --parents http://<svn_path>/trunk/project2/subdir2 <working copy path>/branches/branch1/project2/subdir2
Subversion creates all intermediate directories.

Trim frames from raw YUV video using FFMPEG

Trim 5 frames starting from 160-th frame and write to png sequence

ffmpeg -pix_fmt yuv420p -s 1920x1088  -r 1 -i input_video.yuv -r 1 -ss 160 -frames 5  output_sequence_%d.png

size of input video is 1920x1088, format YUV420 progressive

UPD:
ffmpeg is renamed to avconv.
Using it for trimming AVI video:

avconv -ss 00:58:00 -t 00:59:30 -i ./video.avi frame_%05d.png