close all;
clear; clc;

I1 = zeros(128, 128);
H1 = pmHOG_extractHOG(I1);
assert(isequal(size(H1), [15, 15, 36]), 'Incorrect size of HOG-descriptor (H1)');




tm = [...
    0.7803    0.6491    0.4868    0.6225    0.9049    0.0855    0.6791    0.4942    0.8055    0.5216    0.1734    0.3724    0.6663    0.1564    0.8244;
    0.3897    0.7317    0.4359    0.5870    0.9797    0.2625    0.3955    0.7791    0.5767    0.0967    0.3909    0.1981    0.5391    0.8555    0.9827;
    0.2417    0.6477    0.4468    0.2077    0.4389    0.8010    0.3674    0.7150    0.1829    0.8181    0.8314    0.4897    0.6981    0.6448    0.7302;
    0.4039    0.4509    0.3063    0.3012    0.1111    0.0292    0.9880    0.9037    0.2399    0.8175    0.8034    0.3395    0.6665    0.3763    0.3439;
    0.0965    0.5470    0.5085    0.4709    0.2581    0.9289    0.0377    0.8909    0.8865    0.7224    0.0605    0.9516    0.1781    0.1909    0.5841;
    0.1320    0.2963    0.5108    0.2305    0.4087    0.7303    0.8852    0.3342    0.0287    0.1499    0.3993    0.9203    0.1280    0.4283    0.1078;
    0.9421    0.7447    0.8176    0.8443    0.5949    0.4886    0.9133    0.6987    0.4899    0.6596    0.5269    0.0527    0.9991    0.4820    0.9063;
    0.9561    0.1890    0.7948    0.1948    0.2622    0.5785    0.7962    0.1978    0.1679    0.5186    0.4168    0.7379    0.1711    0.1206    0.8797;
    0.5752    0.6868    0.6443    0.2259    0.6028    0.2373    0.0987    0.0305    0.9787    0.9730    0.6569    0.2691    0.0326    0.5895    0.8178;
    0.0598    0.1835    0.3786    0.1707    0.7112    0.4588    0.2619    0.7441    0.7127    0.6490    0.6280    0.4228    0.5612    0.2262    0.2607;
    0.2348    0.3685    0.8116    0.2277    0.2217    0.9631    0.3354    0.5000    0.5005    0.8003    0.2920    0.5479    0.8819    0.3846    0.5944;
    0.3532    0.6256    0.5328    0.4357    0.1174    0.5468    0.6797    0.4799    0.4711    0.4538    0.4317    0.9427    0.6692    0.5830    0.0225;
    0.8212    0.7802    0.3507    0.3111    0.2967    0.5211    0.1366    0.9047    0.0596    0.4324    0.0155    0.4177    0.1904    0.2518    0.4253;
    0.0154    0.0811    0.9390    0.9234    0.3188    0.2316    0.7212    0.6099    0.6820    0.8253    0.9841    0.9831    0.3689    0.2904    0.3127;
    0.0430    0.9294    0.8759    0.4302    0.4242    0.4889    0.1068    0.6177    0.0424    0.0835    0.1672    0.3015    0.4607    0.6171    0.1615;
    0.1690    0.7757    0.5502    0.1848    0.5079    0.6241    0.6538    0.8594    0.0714    0.1332    0.1062    0.7011    0.9816    0.2653    0.1788];
tmm = [0.4229    0.0942    0.5985    0.4709    0.6959    0.6999    0.6385    0.0336    0.0688    0.3196    0.5309    0.6544    0.4076    0.8200    0.7184    0.9686]';
t = [tm, tmm];

tmp = [0.023945521170239   0.039144027649404   0.037402665408968, ...
    0.018953765663104   0.030004203923097   0.027187720492857, ...
    0.022023158209378   0.012323126603370   0.020992255182478, ...
    0.025952428114686   0.021413902177430   0.005245116310985, ...
    0.035506913024306   0.034548449919646   0.000712013058927, ...
    0.070111412618532   0.042513963501694   0.039388758923531, ...
    0.027805690874620   0.020333825726578   0.029947141625145, ...
    0.027482016270561   0.032203975444070   0.022238008148930, ...
    0.049174858970099   0.032146539634418   0.008653320531798, ...
    0.040543577751607   0.018666772897080   0.011340448083730, ...
    0.039977580220808   0.018965451870944   0.040734601394138, ...
    0.029640835386541   0.026927516022446   0.015848437193857];
   
   
H2 = pmHOG_extractHOG(t);
assert(isequal(size(H2), [1, 1, 36]), 'Incorrect size of HOG-descriptor (H2)');
assert(sum(abs(H2(:)-tmp(:)))<0.001, 'The calculated HOG-descriptor (H2) maybe incorrect');

fprintf('Elementary check of your function pmHOG_extractHOG has passed\n');
