Opencv and "OpenCV Error: Bad flag"
I had pretty simple code with opencv:
cv::Mat t;
t = cv::imread( "qq.bmp" ) ;
cv::imwrite( "q.bmp", t );
cv::namedWindow( "asdads", CV_WINDOW_AUTOSIZE );
cv::imshow( "asdads", t );
cv::waitKey( -1 );
return 0;
It caused crash in debug configuration:
OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupport
ed array type) in unknown function, file ..\..\..\src\opencv\modules\core\src\ar
ray.cpp, line 2482
In release configuration it was ok. Finally i found the solution. Both in debug and release configurations I used static libraries for release conguration
opencv_core231.lib opencv_imgproc231.lib opencv_highgui231.lib
And one should use
opencv_core231d.lib opencv_imgproc231d.lib opencv_highgui231d.lib
for debug.
It seems wrong libraries cause crashes only sometimes. I had used release version of static opencv libraries for my debu and release configurations for a long time an only now it caused problems
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.
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:
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
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
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
Color problems in avisynth->overlay
I processed depth maps using avisynth 2.5.8 and I found out it causes color degradation
I have a depth map (from http://vision.middlebury.edu/stereo/data/scenes2001/data/imagehtml/sawtooth.html)
They have slightly different colors.
I have a depth map (from http://vision.middlebury.edu/stereo/data/scenes2001/data/imagehtml/sawtooth.html)
And two scripts
1) just_show.avs
v = ImageSource( "depth.jpg" ).Trim(0, -1)2) overlay.avs
return v
v = ImageSource( "depth.jpg" ).Trim(0, -1)
return overlay( v, v, mode = "blend", opacity = 0.80)
They have slightly different colors.
just show
overlay
Overlay has chroma component
The cause was in wrong color conversion in avisynth 2.5.8. I downloaded AVS 2.6.0 Alpha 4 [130114] and the problem gone. http://sourceforge.net/projects/avisynth2/files/AviSynth_Alpha_Releases/AVS%202.6.0%20Alpha%204%20%5B130114%5D/
Add path in linux/cygwin and windows
Add path in cygwin /linux
PATH=$PATH:~/your_path
PATH=~/your_path:$PATH
Add path windows
PATH=%PATH%;C:\Your_Path;
Subscribe to:
Posts (Atom)



