mirror of
https://github.com/opencv/opencv.git
synced 2026-07-25 21:33:04 +04:00
Merge branch 4.x
This commit is contained in:
@@ -66,20 +66,20 @@ int main( int argc, char** argv )
|
||||
Mat hist_base, hist_half_down, hist_test1, hist_test2;
|
||||
|
||||
calcHist( &hsv_base, 1, channels, Mat(), hist_base, 2, histSize, ranges, true, false );
|
||||
normalize( hist_base, hist_base, 0, 1, NORM_MINMAX, -1, Mat() );
|
||||
normalize( hist_base, hist_base, 1, 0, NORM_L1, -1, Mat() );
|
||||
|
||||
calcHist( &hsv_half_down, 1, channels, Mat(), hist_half_down, 2, histSize, ranges, true, false );
|
||||
normalize( hist_half_down, hist_half_down, 0, 1, NORM_MINMAX, -1, Mat() );
|
||||
normalize( hist_half_down, hist_half_down, 1, 0, NORM_L1, -1, Mat() );
|
||||
|
||||
calcHist( &hsv_test1, 1, channels, Mat(), hist_test1, 2, histSize, ranges, true, false );
|
||||
normalize( hist_test1, hist_test1, 0, 1, NORM_MINMAX, -1, Mat() );
|
||||
normalize( hist_test1, hist_test1, 1, 0, NORM_L1, -1, Mat() );
|
||||
|
||||
calcHist( &hsv_test2, 1, channels, Mat(), hist_test2, 2, histSize, ranges, true, false );
|
||||
normalize( hist_test2, hist_test2, 0, 1, NORM_MINMAX, -1, Mat() );
|
||||
normalize( hist_test2, hist_test2, 1, 0, NORM_L1, -1, Mat() );
|
||||
//! [Calculate the histograms for the HSV images]
|
||||
|
||||
//! [Apply the histogram comparison methods]
|
||||
for( int compare_method = 0; compare_method < 4; compare_method++ )
|
||||
for( int compare_method = 0; compare_method < 6; compare_method++ )
|
||||
{
|
||||
double base_base = compareHist( hist_base, hist_base, compare_method );
|
||||
double base_half = compareHist( hist_base, hist_half_down, compare_method );
|
||||
|
||||
@@ -18,7 +18,7 @@ int erosion_elem = 0;
|
||||
int erosion_size = 0;
|
||||
int dilation_elem = 0;
|
||||
int dilation_size = 0;
|
||||
int const max_elem = 2;
|
||||
int const max_elem = 3;
|
||||
int const max_kernel_size = 21;
|
||||
|
||||
/** Function Headers */
|
||||
@@ -47,7 +47,7 @@ int main( int argc, char** argv )
|
||||
moveWindow( "Dilation Demo", src.cols, 0 );
|
||||
|
||||
/// Create Erosion Trackbar
|
||||
createTrackbar( "Element:\n 0: Rect \n 1: Cross \n 2: Ellipse", "Erosion Demo",
|
||||
createTrackbar( "Element:\n 0: Rect \n 1: Cross \n 2: Ellipse \n 3: Diamond", "Erosion Demo",
|
||||
&erosion_elem, max_elem,
|
||||
Erosion );
|
||||
|
||||
@@ -56,7 +56,7 @@ int main( int argc, char** argv )
|
||||
Erosion );
|
||||
|
||||
/// Create Dilation Trackbar
|
||||
createTrackbar( "Element:\n 0: Rect \n 1: Cross \n 2: Ellipse", "Dilation Demo",
|
||||
createTrackbar( "Element:\n 0: Rect \n 1: Cross \n 2: Ellipse \n 3: Diamond", "Dilation Demo",
|
||||
&dilation_elem, max_elem,
|
||||
Dilation );
|
||||
|
||||
@@ -83,6 +83,7 @@ void Erosion( int, void* )
|
||||
if( erosion_elem == 0 ){ erosion_type = MORPH_RECT; }
|
||||
else if( erosion_elem == 1 ){ erosion_type = MORPH_CROSS; }
|
||||
else if( erosion_elem == 2) { erosion_type = MORPH_ELLIPSE; }
|
||||
else if( erosion_elem == 3) { erosion_type = MORPH_DIAMOND; }
|
||||
|
||||
//![kernel]
|
||||
Mat element = getStructuringElement( erosion_type,
|
||||
@@ -106,6 +107,7 @@ void Dilation( int, void* )
|
||||
if( dilation_elem == 0 ){ dilation_type = MORPH_RECT; }
|
||||
else if( dilation_elem == 1 ){ dilation_type = MORPH_CROSS; }
|
||||
else if( dilation_elem == 2) { dilation_type = MORPH_ELLIPSE; }
|
||||
else if( dilation_elem == 3) { dilation_type = MORPH_DIAMOND; }
|
||||
|
||||
Mat element = getStructuringElement( dilation_type,
|
||||
Size( 2*dilation_size + 1, 2*dilation_size+1 ),
|
||||
|
||||
@@ -18,7 +18,7 @@ int morph_elem = 0;
|
||||
int morph_size = 0;
|
||||
int morph_operator = 0;
|
||||
int const max_operator = 4;
|
||||
int const max_elem = 2;
|
||||
int const max_elem = 3;
|
||||
int const max_kernel_size = 21;
|
||||
|
||||
const char* window_name = "Morphology Transformations Demo";
|
||||
@@ -54,7 +54,7 @@ int main( int argc, char** argv )
|
||||
|
||||
//![create_trackbar2]
|
||||
/// Create Trackbar to select kernel type
|
||||
createTrackbar( "Element:\n 0: Rect - 1: Cross - 2: Ellipse", window_name,
|
||||
createTrackbar( "Element:\n 0: Rect - 1: Cross - 2: Ellipse - 3: Diamond", window_name,
|
||||
&morph_elem, max_elem,
|
||||
Morphology_Operations );
|
||||
//![create_trackbar2]
|
||||
|
||||
@@ -55,7 +55,7 @@ int main(void)
|
||||
thrust::sequence(idxBegin, idxEnd);
|
||||
// Fill the key channel with random numbers between 0 and 10. A counting iterator is used here to give an integer value for each location as an input to prg::operator()
|
||||
thrust::transform(thrust::make_counting_iterator(0), thrust::make_counting_iterator(d_data.cols), keyBegin, prg(0, 10));
|
||||
// Sort the key channel and index channel such that the keys and indecies stay together
|
||||
// Sort the key channel and index channel such that the keys and indices stay together
|
||||
thrust::sort_by_key(keyBegin, keyEnd, idxBegin);
|
||||
|
||||
cv::Mat h_idx(d_data);
|
||||
|
||||
Reference in New Issue
Block a user