opencv - How to calculate "Arctan" and "Pow" of IplImage? -


I'm trying to calculate the orientation of a garyscale image using the gradient magnitude and OpenCvSharp. The problem is that the "Pow" function does not look right for IplImage. I also want to know how can I calculate the feature image of tan -1 (or Arktan) am I thank you

  (IplImage cvImage = new IplImage ( "grayImage.png", LoadMode .AnyDepth | using using using LoadMode.GrayScale)) (IplImage dstXImage = new IplImage (cvImage.Size, cvImage.Depth, cvImage.NChannels)) (IplImage dstYImage = new IplImage (cvImage.Size, cvImage. Depth, cvImage.NChannels)) {float [] data = {0, -1, -1, 2}; CvMat kernel = new CvMat (2, 2, matrix type. F32C1, data); CV Sobel (CViS, DSTXImage, 1, 0, Aperture Size Size 1); CV Sobel (cvImage, dstYImage, 0, 1, ApertureSize.Size1); Cv.Normalize (dstXImage, dstXImage, 1.0, 0, NormType.L1); Cv.Filter2D (cvImage, dstXImage, kernel, new CvPoint (0, 0)); Cv.Normalize (dstYImage, dstYImage, 1.0, 0, NormType.L1); Cv.Filter2D (cvImage, dstYImage, kernel, new CvPoint (0, 0)); // To calculate the gradient volume, sqrt [(dy) power 2 + (dx) power 2] dstXImage.Mul (dstXImage, dstXImage); DstYImage.Mul (dstYImage, dstYImage); IplImage dstXYImage = New IplImage (cvImage.Size, cvImage.Depth, cvImage.NChannels); DstXImage.Add (dstYImage, dstXYImage); DstXYImage.Pow (dstXYImage, 1/2); // This line is not working, output image black page // slope orientation, arctan (dy / dx) to calculate IplImage thetaImage = new IplImage (cvImage.Size, cvImage.Depth, cvImage.NChannels); DstYImage.Div (dstXImage, thetaImage); // later (using new CvWindow need help to calculate arctan (using new CvWindow ("SrCImage", cvImage)) (New CvWindow ("DstXImage", dstXImage)) (New CvWindow ("DstYImage ", dstYImage)) by using the (" dstXYImage ", using dstXYImage)) (new CvWindow (" thetaImage ", thetaImage)) {Cv.WaitKey (0); }  

You can use the "cartToPolar" function to its purpose. This function calculates the magnitude and angle of 2D vectors.

magnitude (i) = sqrt (x (i) ^ 2 + y (i) ^ 2), angle (i) = an (2), x (i) [* 180 / pi]

For example:

  IplImage dstXYImage; Eyeglass Theta Image; Carttipolar (dstXImage, dstYImage, dstXYImage, thetaImage, true);  

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -