HistogramBins:=256;
Setlength (HistogramRange1, 2);
HistogramRange1 [0] :=0;
HistogramRange1 [1] :=255;
Setlength (HistogramRange, 1);
HistogramRange [0] :=@ HistogramRange1 [0].
If image1. NChannels<> 1 then
The begin
SrcImage:=cvCreateImage (cvSize (image1. Width, image1. Height), image1. The depth, 1);
CvCvtColor (image1, srcImage, CV_BGR2GRAY);
End
The else
SrcImage:=image1;
If image2. NChannels<> 1 then
The begin
TargetImage:=cvCreateImage (cvSize (image2. Width, image2. Height), image2. The depth, 1);
CvCvtColor (image2, targetImage, CV_BGR2GRAY);
End
The else
SrcImage:=image2;
//the following problems
Histogram1:=cvCreateHist (1, @ HistogramBins CV_HIST_ARRAY, HistogramRange);
//the problem here, error e06d7363
CvCreateHist (1, @ HistogramBins CV_HIST_ARRAY, HistogramRange);
//if it does not give Histogram1 assignment is not an error,
CodePudding user response:
WhereIf image1. NChannels<> 1 then
The begin
SrcImage:=cvCreateImage (cvSize (image1. Width, image1. Height), image1. The depth, 1);
CvCvtColor (image1, srcImage, CV_BGR2GRAY);
End
The else
SrcImage:=image1;
If image2. NChannels<> 1 then
The begin
TargetImage:=cvCreateImage (cvSize (image2. Width, image2. Height), image2. The depth, 1);
CvCvtColor (image2, targetImage, CV_BGR2GRAY);
End
The else
SrcImage:=image2;
This code doesn't work, didn't pay attention to when posted
CodePudding user response:
CvCreateHist returns the pointer, you did not give the definition of Histogram1, estimate is not a pointer?CodePudding user response:
Var Histogram1: pCvHistogram; This definition ofCodePudding user response:
The Histogram1:=cvCreateHist (1, @ HistogramBins CV_HIST_ARRAY, HistogramRange)HistogramRange instead of @ HistogramRange [0] a try,
HistogramRange is a dynamic array, is a pointer to the data starting HistogramRange @ HistogramRange [0], not HistogramRange