I was trying to replicate the Dense optical flow as discussed here : https://nanonets.com/blog/optical-flow/ .This is the snippet , I have used to process each frame for optical flow. The intution is that H->Angle of gradient,S->255,V->Norm value of Magnitude of gradient.The gradient is from output of calcOpticalFlowFarenback.
cv::calcOpticalFlowFarneback(prevgray,gray,flow,0.5,3,15,3,5,1.2,0);
cv::split(flow,channels);
cv::cartToPolar(channels[0],channels[1],mag,angle);
std::vector<cv::Mat> channels_m;
cv::Mat c1 (Mask.size(),CV_8UC1);
cv::Mat c0 (Mask.size(),CV_8UC1);
cv::Mat c2 (Mask.size(),CV_8UC1);
c1 = cv::Scalar::all(255);
c0= angle*((180/3.14)/2);
c0.convertTo(c0, CV_8U);
cv::normalize(mag,c2,0,255,cv::NORM_MINMAX); <----- Line of interest
c2.convertTo(c2, CV_8U);
channels_m.push_back(c0);
channels_m.push_back(c1);
channels_m.push_back(c2);
cv::merge(channels_m,Mask);
cv::cvtColor(Mask,cflow,cv::COLOR_HSV2BGR_FULL);
when norm type cv::NORM_L2 is used , my entire V array of HSV is returning nothing but zero . However when changed to cv::NORM_MINMAX, It returns non zero values .I thought the actual function of cv::normalise is to normalise an array within the range alpha and beta . The Norm is just type of normalisation formula used to achieve the ranging objective. So why do we see a difference in output ?
Thanks in Advance !