mirror of
https://github.com/opencv/opencv.git
synced 2025-01-19 06:53:50 +08:00
Merge pull request #3963 from Dikay900:2_4_diff_to_master
This commit is contained in:
commit
ebe979090e
@ -52,6 +52,11 @@ if(POLICY CMP0026)
|
||||
cmake_policy(SET CMP0026 OLD)
|
||||
endif()
|
||||
|
||||
if (POLICY CMP0042)
|
||||
# silence cmake 3.0+ warnings about MACOSX_RPATH
|
||||
cmake_policy(SET CMP0042 OLD)
|
||||
endif()
|
||||
|
||||
# must go before the project command
|
||||
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE)
|
||||
if(DEFINED CMAKE_BUILD_TYPE AND CMAKE_VERSION VERSION_GREATER "2.8")
|
||||
|
@ -193,8 +193,8 @@ VideoCapture
|
||||
------------
|
||||
.. ocv:class:: VideoCapture
|
||||
|
||||
Class for video capturing from video files or cameras.
|
||||
The class provides C++ API for capturing video from cameras or for reading video files. Here is how the class can be used: ::
|
||||
Class for video capturing from video files, image sequences or cameras.
|
||||
The class provides C++ API for capturing video from cameras or for reading video files and image sequences. Here is how the class can be used: ::
|
||||
|
||||
#include "opencv2/opencv.hpp"
|
||||
|
||||
|
@ -491,13 +491,18 @@ bool TiffEncoder::writeLibTiff( const Mat& img, const vector<int>& params)
|
||||
|| !TIFFSetField(pTiffHandle, TIFFTAG_SAMPLESPERPIXEL, channels)
|
||||
|| !TIFFSetField(pTiffHandle, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG)
|
||||
|| !TIFFSetField(pTiffHandle, TIFFTAG_ROWSPERSTRIP, rowsPerStrip)
|
||||
|| !TIFFSetField(pTiffHandle, TIFFTAG_PREDICTOR, predictor)
|
||||
)
|
||||
{
|
||||
TIFFClose(pTiffHandle);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (compression != COMPRESSION_NONE && !TIFFSetField(pTiffHandle, TIFFTAG_PREDICTOR, predictor) )
|
||||
{
|
||||
TIFFClose(pTiffHandle);
|
||||
return false;
|
||||
}
|
||||
|
||||
// row buffer, because TIFFWriteScanline modifies the original data!
|
||||
size_t scanlineSize = TIFFScanlineSize(pTiffHandle);
|
||||
AutoBuffer<uchar> _buffer(scanlineSize+32);
|
||||
|
@ -21,8 +21,9 @@ class AsyncServiceHelper
|
||||
final LoaderCallbackInterface Callback)
|
||||
{
|
||||
AsyncServiceHelper helper = new AsyncServiceHelper(Version, AppContext, Callback);
|
||||
if (AppContext.bindService(new Intent("org.opencv.engine.BIND"),
|
||||
helper.mServiceConnection, Context.BIND_AUTO_CREATE))
|
||||
Intent intent = new Intent("org.opencv.engine.BIND");
|
||||
intent.setPackage("org.opencv.engine");
|
||||
if (AppContext.bindService(intent, helper.mServiceConnection, Context.BIND_AUTO_CREATE))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ static void paint_voronoi( Mat& img, Subdiv2D& subdiv )
|
||||
|
||||
ifacets[0] = ifacet;
|
||||
polylines(img, ifacets, true, Scalar(), 1, CV_AA, 0);
|
||||
circle(img, centers[i], 3, Scalar(), -1, CV_AA, 0);
|
||||
circle(img, centers[i], 3, Scalar(), CV_FILLED, CV_AA, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,10 +21,10 @@ static void help()
|
||||
"\tleft mouse button - set rectangle\n"
|
||||
"\n"
|
||||
"\tCTRL+left mouse button - set GC_BGD pixels\n"
|
||||
"\tSHIFT+left mouse button - set CG_FGD pixels\n"
|
||||
"\tSHIFT+left mouse button - set GC_FGD pixels\n"
|
||||
"\n"
|
||||
"\tCTRL+right mouse button - set GC_PR_BGD pixels\n"
|
||||
"\tSHIFT+right mouse button - set CG_PR_FGD pixels\n" << endl;
|
||||
"\tSHIFT+right mouse button - set GC_PR_FGD pixels\n" << endl;
|
||||
}
|
||||
|
||||
const Scalar RED = Scalar(0,0,255);
|
||||
|
@ -10,7 +10,7 @@ static void help()
|
||||
{
|
||||
cout << "\nThis program demonstrates circle finding with the Hough transform.\n"
|
||||
"Usage:\n"
|
||||
"./houghcircles <image_name>, Default is pic1.png\n" << endl;
|
||||
"./houghcircles <image_name>, Default is board.jpg\n" << endl;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
|
@ -12,7 +12,7 @@ static inline Point calcPoint(Point2f center, double R, double angle)
|
||||
|
||||
static void help()
|
||||
{
|
||||
printf( "\nExamle of c calls to OpenCV's Kalman filter.\n"
|
||||
printf( "\nExample of c calls to OpenCV's Kalman filter.\n"
|
||||
" Tracking of rotating point.\n"
|
||||
" Rotation speed is constant.\n"
|
||||
" Both state and measurements vectors are 1D (a point angle),\n"
|
||||
|
@ -60,12 +60,11 @@ int main( int argc, char** argv )
|
||||
namedWindow( "LK Demo", 1 );
|
||||
setMouseCallback( "LK Demo", onMouse, 0 );
|
||||
|
||||
Mat gray, prevGray, image;
|
||||
Mat gray, prevGray, image, frame;
|
||||
vector<Point2f> points[2];
|
||||
|
||||
for(;;)
|
||||
{
|
||||
Mat frame;
|
||||
cap >> frame;
|
||||
if( frame.empty() )
|
||||
break;
|
||||
|
@ -12,14 +12,14 @@ static void help()
|
||||
"The user gets some of the supported output images.\n"
|
||||
"\nAll supported output map types:\n"
|
||||
"1.) Data given from depth generator\n"
|
||||
" OPENNI_DEPTH_MAP - depth values in mm (CV_16UC1)\n"
|
||||
" OPENNI_POINT_CLOUD_MAP - XYZ in meters (CV_32FC3)\n"
|
||||
" OPENNI_DISPARITY_MAP - disparity in pixels (CV_8UC1)\n"
|
||||
" OPENNI_DISPARITY_MAP_32F - disparity in pixels (CV_32FC1)\n"
|
||||
" OPENNI_VALID_DEPTH_MASK - mask of valid pixels (not ocluded, not shaded etc.) (CV_8UC1)\n"
|
||||
" CV_CAP_OPENNI_DEPTH_MAP - depth values in mm (CV_16UC1)\n"
|
||||
" CV_CAP_OPENNI_POINT_CLOUD_MAP - XYZ in meters (CV_32FC3)\n"
|
||||
" CV_CAP_OPENNI_DISPARITY_MAP - disparity in pixels (CV_8UC1)\n"
|
||||
" CV_CAP_OPENNI_DISPARITY_MAP_32F - disparity in pixels (CV_32FC1)\n"
|
||||
" CV_CAP_OPENNI_VALID_DEPTH_MASK - mask of valid pixels (not ocluded, not shaded etc.) (CV_8UC1)\n"
|
||||
"2.) Data given from RGB image generator\n"
|
||||
" OPENNI_BGR_IMAGE - color image (CV_8UC3)\n"
|
||||
" OPENNI_GRAY_IMAGE - gray image (CV_8UC1)\n"
|
||||
" CV_CAP_OPENNI_BGR_IMAGE - color image (CV_8UC3)\n"
|
||||
" CV_CAP_OPENNI_GRAY_IMAGE - gray image (CV_8UC1)\n"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
@ -4,31 +4,34 @@
|
||||
* Created on: Nov 23, 2010
|
||||
* Author: Ethan Rublee
|
||||
*
|
||||
* A starter sample for using opencv, get a video stream and display the images
|
||||
* Modified on: April 17, 2013
|
||||
* Author: Kevin Hughes
|
||||
*
|
||||
* A starter sample for using OpenCV VideoCapture with capture devices, video files or image sequences
|
||||
* easy as CV_PI right?
|
||||
*/
|
||||
#include "opencv2/highgui/highgui.hpp"
|
||||
|
||||
#include <opencv2/highgui/highgui.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <stdio.h>
|
||||
|
||||
using namespace cv;
|
||||
using namespace std;
|
||||
|
||||
|
||||
|
||||
//hide the local functions in an anon namespace
|
||||
namespace {
|
||||
void help(char** av) {
|
||||
cout << "\nThis program justs gets you started reading images from video\n"
|
||||
"Usage:\n./" << av[0] << " <video device number>\n"
|
||||
<< "q,Q,esc -- quit\n"
|
||||
<< "space -- save frame\n\n"
|
||||
<< "\tThis is a starter sample, to get you up and going in a copy pasta fashion\n"
|
||||
<< "\tThe program captures frames from a camera connected to your computer.\n"
|
||||
<< "\tTo find the video device number, try ls /dev/video* \n"
|
||||
<< "\tYou may also pass a video file, like my_vide.avi instead of a device number"
|
||||
<< endl;
|
||||
cout << "The program captures frames from a video file, image sequence (01.jpg, 02.jpg ... 10.jpg) or camera connected to your computer." << endl
|
||||
<< "Usage:\n" << av[0] << " <video file, image sequence or device number>" << endl
|
||||
<< "q,Q,esc -- quit" << endl
|
||||
<< "space -- save frame" << endl << endl
|
||||
<< "\tTo capture from a camera pass the device number. To find the device number, try ls /dev/video*" << endl
|
||||
<< "\texample: " << av[0] << " 0" << endl
|
||||
<< "\tYou may also pass a video file instead of a device number" << endl
|
||||
<< "\texample: " << av[0] << " video.avi" << endl
|
||||
<< "\tYou can also pass the path to an image sequence and OpenCV will treat the sequence just like a video." << endl
|
||||
<< "\texample: " << av[0] << " right%%02d.jpg" << endl;
|
||||
}
|
||||
|
||||
int process(VideoCapture& capture) {
|
||||
@ -36,31 +39,33 @@ namespace {
|
||||
char filename[200];
|
||||
string window_name = "video | q or esc to quit";
|
||||
cout << "press space to save a picture. q or esc to quit" << endl;
|
||||
namedWindow(window_name, CV_WINDOW_KEEPRATIO); //resizable window;
|
||||
namedWindow(window_name, WINDOW_NORMAL); //resizable window;
|
||||
Mat frame;
|
||||
|
||||
for (;;) {
|
||||
capture >> frame;
|
||||
if (frame.empty())
|
||||
break;
|
||||
|
||||
imshow(window_name, frame);
|
||||
char key = (char)waitKey(5); //delay N millis, usually long enough to display and capture input
|
||||
char key = (char)waitKey(30); //delay N millis, usually long enough to display and capture input
|
||||
|
||||
switch (key) {
|
||||
case 'q':
|
||||
case 'Q':
|
||||
case 27: //escape key
|
||||
return 0;
|
||||
case ' ': //Save an image
|
||||
sprintf(filename,"filename%.3d.jpg",n++);
|
||||
imwrite(filename,frame);
|
||||
cout << "Saved " << filename << endl;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case 'q':
|
||||
case 'Q':
|
||||
case 27: //escape key
|
||||
return 0;
|
||||
case ' ': //Save an image
|
||||
sprintf(filename,"filename%.3d.jpg",n++);
|
||||
imwrite(filename,frame);
|
||||
cout << "Saved " << filename << endl;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main(int ac, char** av) {
|
||||
@ -70,11 +75,11 @@ int main(int ac, char** av) {
|
||||
return 1;
|
||||
}
|
||||
std::string arg = av[1];
|
||||
VideoCapture capture(arg); //try to open string, this will attempt to open it as a video file
|
||||
VideoCapture capture(arg); //try to open string, this will attempt to open it as a video file or image sequence
|
||||
if (!capture.isOpened()) //if this fails, try to open as a video camera, through the use of an integer param
|
||||
capture.open(atoi(arg.c_str()));
|
||||
if (!capture.isOpened()) {
|
||||
cerr << "Failed to open a video device or video file!\n" << endl;
|
||||
cerr << "Failed to open the video device, video file or image sequence!\n" << endl;
|
||||
help(av);
|
||||
return 1;
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ StereoCalib(const vector<string>& imagelist, Size boardSize, bool useCalibrated=
|
||||
fs.release();
|
||||
}
|
||||
else
|
||||
cout << "Error: can not save the intrinsic parameters\n";
|
||||
cout << "Error: can not save the extrinsic parameters\n";
|
||||
|
||||
// OpenCV can handle left-right
|
||||
// or up-down camera arrangements
|
||||
|
@ -60,7 +60,7 @@ void MatchingMethod( int, void* )
|
||||
int result_cols = img.cols - templ.cols + 1;
|
||||
int result_rows = img.rows - templ.rows + 1;
|
||||
|
||||
result.create( result_cols, result_rows, CV_32FC1 );
|
||||
result.create( result_rows, result_cols, CV_32FC1 );
|
||||
|
||||
/// Do the Matching and Normalize
|
||||
matchTemplate( img, templ, result, match_method );
|
||||
|
@ -26,8 +26,13 @@ void thresh_callback(int, void* );
|
||||
*/
|
||||
int main( int, char** argv )
|
||||
{
|
||||
/// Load source image and convert it to gray
|
||||
src = imread( argv[1], 1 );
|
||||
/// Load source image
|
||||
src = imread(argv[1]);
|
||||
if (src.empty())
|
||||
{
|
||||
cerr << "No image supplied ..." << endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// Convert image to gray and blur it
|
||||
cvtColor( src, src_gray, COLOR_BGR2GRAY );
|
||||
|
Loading…
Reference in New Issue
Block a user