I have been stumped by this for quite some time. could you please help me to know, what datatype does the minMaxLoc() in Opencv consider, while finding the max, min vlaues of a Mat variable? I got a certain value from the function, but I have no idea wat that value actually represents, and in what data type?
Laplacian(src_gray,dst,ddepth,kernel_size,scale,delta,BORDER_DEFAULT);
minMaxLoc(dst,&min,&estimate,&minLoc,&maxLoc,noArray());
The value of ‘estimate’ is somewhere around 1000’s, while if I try to access the value of ‘dst’ Mat variable, using
dst.at<datatype>(k,l)
Am getting vague values, starting from 124, 125 for uchar, to 2,xxx,xxx,xxx if I use long int. What is the value actually given by the minMaxLoc function? Please help me.
min and estimate should be of type double and I would imagine they are correct. The issue is probably with you accessing
As Abhishek Thakur mentioned, the output depends on your input. If you are ever confused about the type of a matrix you can look at dst.type() which returns an integer corresponding to the list defined in types_c.h starting at line 557. The definitions for single channel types or “depths” are
You can see the formula used to calculate the other type identifiers on line 573
for example
has type
so for a 4 channel uchar image, type() will return 24. From the above you can see that the depth of a type is represented by the last 3 bits of the type integer. If all you want is the depth (you don’t care how many channels it has) you can get that directly with dst.depth()