c++ - Get Orientation Histogramm from Pixel Patch OpenCV -
i try orientation histogramm out of result of phase() method cv. try rounded orientation of each pixel , divide 10. example 5x5 pixel patch:
{ 1 36 20 3 14 5 16 11 6 9 7 12 34 22 0 34 5 9 21 4 5 21 28 30 1}
my problem is, dont know how scan each pixel of patch , orientationvalue of calculate value histogram.
my code getting orientation mat looks this:
mat patch = src(rect(px,py,15,15)); mat sx; sobel(patch, sx, cv_32f, 1, 0, 3); mat sy; sobel(patch, sy, cv_32f, 0, 1, 3); mat mag, ori; magnitude(sx, sy, mag); phase(sx, sy, ori, true); int** hist;
in variable hist want add values through method. hope understands i'm thinking of , can me.
i have plan now, how iterate through given orientation image use loop shown in documentation opencv docu
for( = 0; < ori.rows; i++){ for( j = 0; j < ori.cols; j++){ cout << ori.at<uchar>(i,j) << endl; } }
but accessing values wont give me orientation value. clues?
ori
type cv_32f
not cv_8u
, try ori.at<float>(i,j)
ro access orientation values
Comments
Post a Comment