Dear Team,
I would like to ask if there is a code in c++ which loads an 3d obj and find the edges of that specific object.
I have only found the below code but is only for 2d files.
Thanks in advance.
include <opencv2/opencv.hpp>
#include
// using namespaces to nullify use of cv::function(); syntax and std::function();
using namespace std;
using namespace cv;
int main()
{
// Reading image
Mat img = imread(“test.png”);
// Display original image
imshow(“original Image”, img);
waitKey(0);
// Convert to graycsale
Mat img_gray;
cvtColor(img, img_gray, COLOR_BGR2GRAY);
// Blur the image for better edge detection
Mat img_blur;
GaussianBlur(img_gray, img_blur, Size(3, 3), 0);
// Sobel edge detection
Mat sobelx, sobely, sobelxy;
Sobel(img_blur, sobelx, CV_64F, 1, 0, 5);
Sobel(img_blur, sobely, CV_64F, 0, 1, 5);
Sobel(img_blur, sobelxy, CV_64F, 1, 1, 5);
// Display Sobel edge detection images
imshow("Sobel X", sobelx);
waitKey(0);
imshow("Sobel Y", sobely);
waitKey(0);
imshow("Sobel XY using Sobel() function", sobelxy);
waitKey(0);
// Canny edge detection
Mat edges;
Canny(img_blur, edges, 100, 200, 3, false);
// Display canny edge detected image
imshow("Canny edge detection", edges);
imwrite("Golik_Canny_auto.jpg", edges);
waitKey(0);
destroyAllWindows();
return 0;
}