通过函数调用使用 pyrdown
using pyrdown through function call
我试图使用 pyrDown()
缩小所需的 image.For 这个我使用了一个函数调用 void downscale(Mat *p,int *scale)
。我将图像的 ref 发送到 function.So,在函数完成图像下采样后,我的原始图像将发生变化,因为我发送 pointer.Image 在函数调用中被缩放。但令我惊讶的是,main [=24 中的图像没有变化=] 不明白我去哪里了 wrong.Can 有人指出我的错误吗?
这是我的代码
#include <opencv2/core/core.hpp>
#include<opencv2/opencv.hpp>
#include<opencv2/imgproc/imgproc.hpp>
#include<stdio.h>
#include<conio.h>
#include<opencv2/highgui/highgui.hpp>
#include<opencv2/objdetect/objdetect.hpp>
#include<opencv2/features2d/features2d.hpp>
#include<opencv2/nonfree/nonfree.hpp>
using namespace std;
using namespace cv;
void downscale(Mat *p,int scale)
{
int s=scale;
Mat ref=*p;
imshow("received",ref);
vector<int> param;
param.push_back(CV_IMWRITE_PNG_COMPRESSION) ;
param.push_back(9);
while(s){
pyrDown(ref,ref,Size(),4);
s--;
}
imshow("sending",ref);
}
int main()
{
Mat ref,in,ref_out,in_out;
int s=2;
ref=imread("C:\Users\vamsidhar muthireddy\Pictures\Camera Roll\WIN_20151003_18_47_55_Pro.jpg");
cvtColor(ref,ref,CV_BGR2GRAY);
imshow("original ref",ref);
downscale(&ref,s);
imshow("scaled ref",ref);
waitKey();
return 0;
}
将缩小比例更改为:
void downscale(Mat &ref,int scale)
{
int s=scale;
imshow("received",ref);
vector<int> param;
param.push_back(CV_IMWRITE_PNG_COMPRESSION) ;
param.push_back(9);
while(s){
pyrDown(ref,ref,Size(),4);
s--;
}
imshow("sending",ref);
并将其命名为:
downscale(ref,s);
我试图使用 pyrDown()
缩小所需的 image.For 这个我使用了一个函数调用 void downscale(Mat *p,int *scale)
。我将图像的 ref 发送到 function.So,在函数完成图像下采样后,我的原始图像将发生变化,因为我发送 pointer.Image 在函数调用中被缩放。但令我惊讶的是,main [=24 中的图像没有变化=] 不明白我去哪里了 wrong.Can 有人指出我的错误吗?
这是我的代码
#include <opencv2/core/core.hpp>
#include<opencv2/opencv.hpp>
#include<opencv2/imgproc/imgproc.hpp>
#include<stdio.h>
#include<conio.h>
#include<opencv2/highgui/highgui.hpp>
#include<opencv2/objdetect/objdetect.hpp>
#include<opencv2/features2d/features2d.hpp>
#include<opencv2/nonfree/nonfree.hpp>
using namespace std;
using namespace cv;
void downscale(Mat *p,int scale)
{
int s=scale;
Mat ref=*p;
imshow("received",ref);
vector<int> param;
param.push_back(CV_IMWRITE_PNG_COMPRESSION) ;
param.push_back(9);
while(s){
pyrDown(ref,ref,Size(),4);
s--;
}
imshow("sending",ref);
}
int main()
{
Mat ref,in,ref_out,in_out;
int s=2;
ref=imread("C:\Users\vamsidhar muthireddy\Pictures\Camera Roll\WIN_20151003_18_47_55_Pro.jpg");
cvtColor(ref,ref,CV_BGR2GRAY);
imshow("original ref",ref);
downscale(&ref,s);
imshow("scaled ref",ref);
waitKey();
return 0;
}
将缩小比例更改为:
void downscale(Mat &ref,int scale)
{
int s=scale;
imshow("received",ref);
vector<int> param;
param.push_back(CV_IMWRITE_PNG_COMPRESSION) ;
param.push_back(9);
while(s){
pyrDown(ref,ref,Size(),4);
s--;
}
imshow("sending",ref);
并将其命名为:
downscale(ref,s);