c++ - creating 3D histogram using 2D data (OpenCV?) -
i have data set 1 , 2. have 2d data. example,
data1 : (x1, y1), (x2, y2), (x3, y3) .... (xn, yn)
data2 : (x1', y1'), (x2', y2'), .... (xm', ym')
i'd compare them using histogram , earth mover's distance(emd) if possible.
because have 2d data, data should placed on 2d map, , height of histogram on 2d map has frequency of data, should 3d histogram guess. though success create example draw histogram , compare them using 1d data, failed try change 2d data. how works?
for example,
calchist(&greyimg, 1, channel_numbers, mat(), histogram1, 1, &number_bins, &channel_ranges);
this code makes tha image's grayscale intensity(1d data) histogram. not change 2d data.
my idea : create cv::mat data1mat, data2mat; (mat size set maximum value of x , y) then, push data1's x values mat1's first channel, push y values second channel. (same data2 , data2mat) example, (x1, y1), set
data1mat.at(x1,y1)[0] = x1, data1mat.at(x1, y1)[1] = y1;
like this.then create histogram of them , compare. think correctly?
i think more correct say: histogram of 1d data, of histogram of 2d data.
you need histogram of 2d data.
- 1d histogram computes number of scalar values hit bin intervals.
- 2d histogram divides plane regions , compute number of 2d points hit each region.
here computed h,s 2d histogram image: calculate hsv histogram of coloured image different h-s histogram?
you have near same problem, put x instead of h, , y instead of s.
Comments
Post a Comment