logo       

One of arguments's values is out of range. how to deal it.: msg#00712

lib.opencv

Subject: One of arguments's values is out of range. how to deal it.

When i run a complied program it pops up a system window named:
OpenCV Beta 2: One of arguments' vaules is out of range.

the context is

In function cvPtr2D():[file d:\User\vp\opencv.new\CV\src_cvarray.cpp, line
2039]
Index is out of range
One of arguments`values is out of range
(status:\-211)
ErrMode=CV=ErrorModeLeaf
Terminate the application?

the probem program is bellow:

// store the vaule of Hue , Saturation and Vuale of a image in HSV color
space.


void ImagHisProcessing::HsvHis(IplImage * HsvImage)
{
IplImage * h_plane=cvCreateImage(cvGetSize( HsvImage),8,1);
IplImage * s_plane=cvCreateImage(cvGetSize( HsvImage),8,1);
IplImage * v_plane=cvCreateImage(cvGetSize( HsvImage),8,1);

IplImage * planes[]={h_plane,s_plane,v_plane};
int h_bins=180, s_bins=255, v_bins=255;

int hist_size[]={h_bins,s_bins,v_bins};
float h_ranges[]={0,180};
//hue varies from 0 red to 180
float s_ranges[]={0,255};
//saturation changes from 0 black to 255 white
float v_ranges[]={0,255};
float * ranges[]={h_ranges,s_ranges,v_ranges};

CvHistogram * hist;

int h, s, v ;

cvCvtPixToPlane(HsvImage,h_plane,s_plane,v_plane,0);

//Divides multi-channel array into several
//single-channel arrays or extracts a single channel from the array

hist=cvCreateHist(3,hist_size,CV_HIST_ARRAY,ranges,1);

//creat histogram, number of histogram demision is 2,size is 30,20
//array of ranges for hisgotram bins.

cvCalcHist(planes, hist, 0, 0);
//caculate the histogram of the image. planes is the source image

for (h=0; h<h_bins;h++)// store the hue-saturation 2D information
{
outfile1<<";";
for (s=0;s<s_bins;s++)
{

float hsbin_val=cvQueryHistValue_2D(hist,h,s);
outfile4<<hsbin_val<<" ";
}

}
for (h=0; h<h_bins;h++)//sotre the hue 1D information
{
float hbin_val=cvQueryHistValue_1D(hist,h);
outfile1<<hbin_val<<" ";}

for (s=0; s<s_bins;s++)
{
float sbin_val=cvQueryHistValue_1D(hist,s);//store the saturation information
outfile2<<sbin_val<<" ";}

for (v=0; v<v_bins;v++)
{
float vbin_val=cvQueryHistValue_1D(hist,v);// store the value information
outfile3<<vbin_val<<" ";}

}






---------------------------------
To help you stay safe and secure online, we've developed the all new Yahoo!
Security Centre.

[Non-text portions of this message have been removed]





Change settings: http://www.yahoogroups.com/mygroups, select
Get Emails (get all posts)
Daily Digest (one summary email per day)
Read on the web (read posts on the web only)Or Unsubscribe by mailing
OpenCV-unsubscribe@xxxxxxxxxxxxxxx



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise