Fix bug in Objective C OpenCV based Sobel edge detector code

hi I have a openCV based Objective C project for video which works correctly by itself, where I am trying to calculate intensity gradient using Sobel operator using the stack overflow example ([login to view URL]) but it is giving me error. I need to calculate average gradient and resulting direction of image from phone. Can you please fix the error.


Mat img = imread("[login to view URL]", IMREAD_GRAYSCALE);

// compute the image derivatives for both the x and y direction

Mat dx, dy;

Sobel(img, dx, CV_32F, 1, 0);

Sobel(img, dy, CV_32F, 0, 1);

Scalar average_dx = mean(dx);

Scalar average_dy = mean(dy);

double average_gradient = atan2(-average_dy[0], average_dx[0]);

cout << "average_gradient = " << average_gradient << endl;

And to display the resulting direction

Point center = Point([login to view URL], [login to view URL]);

Point direction = Point(cos(average_gradient) * 100, -sin(average_gradient) * 100);

Mat img_rgb = imread("[login to view URL]"); // read the image in colour

line(img_rgb, center, center + direction, Scalar(0,0,255));

imshow("image", img_rgb);


Evner: Objective C, OpenCV

Se mere: edge enhancement opencv python, canny edge detection code, opencv object edge detection, canny edge detection, edge detection opencv, 1d edge detection python, object detection using canny edge detector, opencv grid detection python, freelancer fix bug partime, freelancer fix bug, phpbb mass email fix bug, fix bug acsent, fix bug javascript, fix bug game, fix bug xss, fix bug google chrome, freelancer sustaining fix bug, fix bug joomla, fix bug galleria ie7, online fix bug

Om arbejdsgiveren:
( 1 bedømmelse ) SOUTH LYON, United States

Projekt ID: #18711611

3 freelancere byder i gennemsnit $200 på dette job


Dear client, Thanks a lot for taking your precious time to read my message. After browsing your job description, I am very interested in your project and I believe I’m qualified for the task. Regarding OpenCV, Flere

$250 USD in 3 dage
(33 bedømmelser)

How are you? Like you see in my profile and portfolios, I have rich experience in C/C++, C#, and Python programming. Especially, I completed many image processing projects with OpenCV. I would like to discuss with y Flere

$200 USD in 3 dage
(0 bedømmelser)

Hi, there! I am interested in your project. I have extensive experience in image processing and computer vision such as object detection, image recognition, pattern matching, image classification, real time object tr Flere

$150 USD in 3 dage
(0 bedømmelser)