Commit ebe97909 authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

Merge pull request #3963 from Dikay900:2_4_diff_to_master

parents 26e3bcb9 6decc259
...@@ -52,6 +52,11 @@ if(POLICY CMP0026) ...@@ -52,6 +52,11 @@ if(POLICY CMP0026)
cmake_policy(SET CMP0026 OLD) cmake_policy(SET CMP0026 OLD)
endif() endif()
if (POLICY CMP0042)
# silence cmake 3.0+ warnings about MACOSX_RPATH
cmake_policy(SET CMP0042 OLD)
endif()
# must go before the project command # must go before the project command
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE) set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE)
if(DEFINED CMAKE_BUILD_TYPE AND CMAKE_VERSION VERSION_GREATER "2.8") if(DEFINED CMAKE_BUILD_TYPE AND CMAKE_VERSION VERSION_GREATER "2.8")
......
...@@ -193,8 +193,8 @@ VideoCapture ...@@ -193,8 +193,8 @@ VideoCapture
------------ ------------
.. ocv:class:: VideoCapture .. ocv:class:: VideoCapture
Class for video capturing from video files or cameras. 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. Here is how the class can be used: :: 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" #include "opencv2/opencv.hpp"
......
...@@ -491,13 +491,18 @@ bool TiffEncoder::writeLibTiff( const Mat& img, const vector<int>& params) ...@@ -491,13 +491,18 @@ bool TiffEncoder::writeLibTiff( const Mat& img, const vector<int>& params)
|| !TIFFSetField(pTiffHandle, TIFFTAG_SAMPLESPERPIXEL, channels) || !TIFFSetField(pTiffHandle, TIFFTAG_SAMPLESPERPIXEL, channels)
|| !TIFFSetField(pTiffHandle, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG) || !TIFFSetField(pTiffHandle, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG)
|| !TIFFSetField(pTiffHandle, TIFFTAG_ROWSPERSTRIP, rowsPerStrip) || !TIFFSetField(pTiffHandle, TIFFTAG_ROWSPERSTRIP, rowsPerStrip)
|| !TIFFSetField(pTiffHandle, TIFFTAG_PREDICTOR, predictor)
) )
{ {
TIFFClose(pTiffHandle); TIFFClose(pTiffHandle);
return false; return false;
} }
if (compression != COMPRESSION_NONE && !TIFFSetField(pTiffHandle, TIFFTAG_PREDICTOR, predictor) )
{
TIFFClose(pTiffHandle);
return false;
}
// row buffer, because TIFFWriteScanline modifies the original data! // row buffer, because TIFFWriteScanline modifies the original data!
size_t scanlineSize = TIFFScanlineSize(pTiffHandle); size_t scanlineSize = TIFFScanlineSize(pTiffHandle);
AutoBuffer<uchar> _buffer(scanlineSize+32); AutoBuffer<uchar> _buffer(scanlineSize+32);
......
...@@ -21,8 +21,9 @@ class AsyncServiceHelper ...@@ -21,8 +21,9 @@ class AsyncServiceHelper
final LoaderCallbackInterface Callback) final LoaderCallbackInterface Callback)
{ {
AsyncServiceHelper helper = new AsyncServiceHelper(Version, AppContext, Callback); AsyncServiceHelper helper = new AsyncServiceHelper(Version, AppContext, Callback);
if (AppContext.bindService(new Intent("org.opencv.engine.BIND"), Intent intent = new Intent("org.opencv.engine.BIND");
helper.mServiceConnection, Context.BIND_AUTO_CREATE)) intent.setPackage("org.opencv.engine");
if (AppContext.bindService(intent, helper.mServiceConnection, Context.BIND_AUTO_CREATE))
{ {
return true; return true;
} }
......
...@@ -98,7 +98,7 @@ static void paint_voronoi( Mat& img, Subdiv2D& subdiv ) ...@@ -98,7 +98,7 @@ static void paint_voronoi( Mat& img, Subdiv2D& subdiv )
ifacets[0] = ifacet; ifacets[0] = ifacet;
polylines(img, ifacets, true, Scalar(), 1, CV_AA, 0); 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() ...@@ -21,10 +21,10 @@ static void help()
"\tleft mouse button - set rectangle\n" "\tleft mouse button - set rectangle\n"
"\n" "\n"
"\tCTRL+left mouse button - set GC_BGD pixels\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" "\n"
"\tCTRL+right mouse button - set GC_PR_BGD pixels\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); const Scalar RED = Scalar(0,0,255);
......
...@@ -10,7 +10,7 @@ static void help() ...@@ -10,7 +10,7 @@ static void help()
{ {
cout << "\nThis program demonstrates circle finding with the Hough transform.\n" cout << "\nThis program demonstrates circle finding with the Hough transform.\n"
"Usage:\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) int main(int argc, char** argv)
......
...@@ -12,7 +12,7 @@ static inline Point calcPoint(Point2f center, double R, double angle) ...@@ -12,7 +12,7 @@ static inline Point calcPoint(Point2f center, double R, double angle)
static void help() 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" " Tracking of rotating point.\n"
" Rotation speed is constant.\n" " Rotation speed is constant.\n"
" Both state and measurements vectors are 1D (a point angle),\n" " Both state and measurements vectors are 1D (a point angle),\n"
......
...@@ -60,12 +60,11 @@ int main( int argc, char** argv ) ...@@ -60,12 +60,11 @@ int main( int argc, char** argv )
namedWindow( "LK Demo", 1 ); namedWindow( "LK Demo", 1 );
setMouseCallback( "LK Demo", onMouse, 0 ); setMouseCallback( "LK Demo", onMouse, 0 );
Mat gray, prevGray, image; Mat gray, prevGray, image, frame;
vector<Point2f> points[2]; vector<Point2f> points[2];
for(;;) for(;;)
{ {
Mat frame;
cap >> frame; cap >> frame;
if( frame.empty() ) if( frame.empty() )
break; break;
......
...@@ -12,14 +12,14 @@ static void help() ...@@ -12,14 +12,14 @@ static void help()
"The user gets some of the supported output images.\n" "The user gets some of the supported output images.\n"
"\nAll supported output map types:\n" "\nAll supported output map types:\n"
"1.) Data given from depth generator\n" "1.) Data given from depth generator\n"
" OPENNI_DEPTH_MAP - depth values in mm (CV_16UC1)\n" " CV_CAP_OPENNI_DEPTH_MAP - depth values in mm (CV_16UC1)\n"
" OPENNI_POINT_CLOUD_MAP - XYZ in meters (CV_32FC3)\n" " CV_CAP_OPENNI_POINT_CLOUD_MAP - XYZ in meters (CV_32FC3)\n"
" OPENNI_DISPARITY_MAP - disparity in pixels (CV_8UC1)\n" " CV_CAP_OPENNI_DISPARITY_MAP - disparity in pixels (CV_8UC1)\n"
" OPENNI_DISPARITY_MAP_32F - disparity in pixels (CV_32FC1)\n" " CV_CAP_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_VALID_DEPTH_MASK - mask of valid pixels (not ocluded, not shaded etc.) (CV_8UC1)\n"
"2.) Data given from RGB image generator\n" "2.) Data given from RGB image generator\n"
" OPENNI_BGR_IMAGE - color image (CV_8UC3)\n" " CV_CAP_OPENNI_BGR_IMAGE - color image (CV_8UC3)\n"
" OPENNI_GRAY_IMAGE - gray image (CV_8UC1)\n" " CV_CAP_OPENNI_GRAY_IMAGE - gray image (CV_8UC1)\n"
<< endl; << endl;
} }
......
...@@ -4,31 +4,34 @@ ...@@ -4,31 +4,34 @@
* Created on: Nov 23, 2010 * Created on: Nov 23, 2010
* Author: Ethan Rublee * 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? * easy as CV_PI right?
*/ */
#include "opencv2/highgui/highgui.hpp"
#include <opencv2/highgui/highgui.hpp>
#include <iostream> #include <iostream>
#include <vector>
#include <stdio.h> #include <stdio.h>
using namespace cv; using namespace cv;
using namespace std; using namespace std;
//hide the local functions in an anon namespace //hide the local functions in an anon namespace
namespace { namespace {
void help(char** av) { void help(char** av) {
cout << "\nThis program justs gets you started reading images from video\n" 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 device number>\n" << "Usage:\n" << av[0] << " <video file, image sequence or device number>" << endl
<< "q,Q,esc -- quit\n" << "q,Q,esc -- quit" << endl
<< "space -- save frame\n\n" << "space -- save frame" << endl << endl
<< "\tThis is a starter sample, to get you up and going in a copy pasta fashion\n" << "\tTo capture from a camera pass the device number. To find the device number, try ls /dev/video*" << endl
<< "\tThe program captures frames from a camera connected to your computer.\n" << "\texample: " << av[0] << " 0" << endl
<< "\tTo find the video device number, try ls /dev/video* \n" << "\tYou may also pass a video file instead of a device number" << endl
<< "\tYou may also pass a video file, like my_vide.avi instead of a device number" << "\texample: " << av[0] << " video.avi" << endl
<< 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) { int process(VideoCapture& capture) {
...@@ -36,14 +39,17 @@ namespace { ...@@ -36,14 +39,17 @@ namespace {
char filename[200]; char filename[200];
string window_name = "video | q or esc to quit"; string window_name = "video | q or esc to quit";
cout << "press space to save a picture. q or esc to quit" << endl; 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; Mat frame;
for (;;) { for (;;) {
capture >> frame; capture >> frame;
if (frame.empty()) if (frame.empty())
break; break;
imshow(window_name, frame); 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) { switch (key) {
case 'q': case 'q':
case 'Q': case 'Q':
...@@ -60,7 +66,6 @@ namespace { ...@@ -60,7 +66,6 @@ namespace {
} }
return 0; return 0;
} }
} }
int main(int ac, char** av) { int main(int ac, char** av) {
...@@ -70,11 +75,11 @@ int main(int ac, char** av) { ...@@ -70,11 +75,11 @@ int main(int ac, char** av) {
return 1; return 1;
} }
std::string arg = av[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 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())); capture.open(atoi(arg.c_str()));
if (!capture.isOpened()) { 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); help(av);
return 1; return 1;
} }
......
...@@ -236,7 +236,7 @@ StereoCalib(const vector<string>& imagelist, Size boardSize, bool useCalibrated= ...@@ -236,7 +236,7 @@ StereoCalib(const vector<string>& imagelist, Size boardSize, bool useCalibrated=
fs.release(); fs.release();
} }
else else
cout << "Error: can not save the intrinsic parameters\n"; cout << "Error: can not save the extrinsic parameters\n";
// OpenCV can handle left-right // OpenCV can handle left-right
// or up-down camera arrangements // or up-down camera arrangements
......
...@@ -60,7 +60,7 @@ void MatchingMethod( int, void* ) ...@@ -60,7 +60,7 @@ void MatchingMethod( int, void* )
int result_cols = img.cols - templ.cols + 1; int result_cols = img.cols - templ.cols + 1;
int result_rows = img.rows - templ.rows + 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 /// Do the Matching and Normalize
matchTemplate( img, templ, result, match_method ); matchTemplate( img, templ, result, match_method );
......
...@@ -26,8 +26,13 @@ void thresh_callback(int, void* ); ...@@ -26,8 +26,13 @@ void thresh_callback(int, void* );
*/ */
int main( int, char** argv ) int main( int, char** argv )
{ {
/// Load source image and convert it to gray /// Load source image
src = imread( argv[1], 1 ); src = imread(argv[1]);
if (src.empty())
{
cerr << "No image supplied ..." << endl;
return -1;
}
/// Convert image to gray and blur it /// Convert image to gray and blur it
cvtColor( src, src_gray, COLOR_BGR2GRAY ); cvtColor( src, src_gray, COLOR_BGR2GRAY );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment