"Learn OpenCV" considerations--matrix and image processing--cvor,cvors,cvrreduce,cvrepeat,cvscale,cvset and Cvsetzero

Source: Internet
Author: User


Operation of matrices and images


(1) cvor function

Its structure


void Cvor (//two matrix corresponding element do or perform const cvarr* src1,//matrix 1const cvarr* src2,//matrix 2cvarr* dst,//result Matrix Const cvarr* mask = null//Matrix "switch") ;

Instance Code


#include <cv.h> #include 

Output results




(2) Cvors function

Its structure


void Cvor (//matrix with given scalar do or op const cvarr* src1,//matrix 1CvScalar value,//given variable cvarr* dst,//result Matrix Const cvarr* mask = null//Matrix "switch");

Instance Code


#include <cv.h> #include 

Output results




(3) Cvreduce function

Its structure


Cvsize cvreduce (//Finished by op specified reduction const cvarr* src,//target matrix cvarr* dst,//result Matrix int Dim = -1,//Factor Factor,//1 merge rows, 0 merged into columns. -1 into the corresponding disint op = cv_reduce_sum//Specify the law of reduction);

PS: The conversion operation in which the OP represents


The value of OP Results
Cv_reduce_sum Calculates the sum of all vectors
Cv_reduce_avg Calculates the average of all vectors
Cv_reduce_max Calculates the maximum value in all vectors
Cv_reduce_min Calculates the minimum value in all vectors

Instance Code


#include <cv.h> #include 

Output results




(4) Cvrepeat function

Its structure


void Cvrepeat (//Copy Image const cvarr* src,//target matrix cvarr* dst//result matrix);

Instance Code


#include <cv.h> #include 

Output Results




(5) Cvscale function

Its structure


void Cvscale (//Linear transform Conversion const cvarr* src,//input matrix cvarr* dst,//output matrix Double scale,//scale factor double shift = 0.0//scaling);

Instance Code


#include <cv.h> #include 

Output results




(6) Cvset function

Its structure


void Cvset (//for pixels in an image set valuecvarr* arr,//target matrix cvscalar value,//Setting value const,cvarr* mask = null//image switch);

Instance Code


#include <cv.h> #include 

Output results




(7) Cvsetzero function

Its structure


void Cvsetzero (//On the image itself is set to zero, equivalent to Cvset (0.0) cvarr* arr,//target matrix);

Instance Code


#include <cv.h> #include 

Output results




To be Continued

Copyright notice: This article Bo Master original articles, blogs, without consent may not be reproduced.

"Learn OpenCV" considerations--matrix and image processing--cvor,cvors,cvrreduce,cvrepeat,cvscale,cvset and Cvsetzero

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.