Category:Steinberg Media Technologies
Category:Music softwareQ:
Getting a Segmentation Fault when using with or without using IplImage
I am doing a 3D Sobel edge detection program. I am using opencv with IplImage. In this code I am performing edge detection using three steps:
cv::Mat edge_img = cv::imread("D:\*.jpg",1);
//convolve the edge image
cv::filter2D(edge_img, edge_img, cv::Size(3, 3), cv::Point(-1,-1), 1);
//convert the image to gray
cv::cvtColor(edge_img, edge_img, CV_BGR2GRAY);
//return the gray
cv::Mat grayscale = edge_img.clone();
cv::Sobel(grayscale, grayscale, cv::CV_8UC1, 1, 0, 3);
cv::imshow("convoluted", grayscale);
int main()
{
cv::Mat edge_img;
cv::Mat edge_img;
//edge_img= cv::imread("*.jpg",1);
//edge_img.convertTo(edge_img, CV_8UC1, 1.0/255.0);
return 0;
}
When I uncomment the second line of code to uncomment the first line I get a segmentation fault. When I comment the second line of code I get no segmentation fault.
If I use cv::imread() I get no segmentation fault but I am not getting a correct edge detection result.
If I uncomment the code inside main I get no segmentation fault but I am not getting a correct edge detection result either.
If I uncomment the first line of code I get no segmentation fault but I am not getting a correct edge detection result.
I do not get a segmentation fault when I uncomment the second line of code.
I do not get a correct result when I uncomment the first line of code.
This is one of the images that I am getting a wrong edge detection result
This is what I am getting when I uncomment the first be359ba680
Related links:
Comments