我对openCV比较新,需要一些帮助。
所以我的基本想法是使用opencv创建一个室内设计的小程序。
问题
如何区分图片中的墙壁和地板(即使图片中有一些噪点)。
例如:
现在,我的想法是,如果我能找到墙壁或瓷砖的边缘,然后如果使用任何用于室内装饰的对象(例如任何椅子),那么该对象将完美地放置在地板上(即两个图像混合在一起)。
我的方法
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv/cv.h>
using namespace cv;
using namespace std;
int main(){
Mat image=imread("/home/ayusun/Downloads/IMG_20140104_143443.jpg");
Mat resized_img,dst,contours,detected_edges;
resize(image, resized_img, Size(1024, 768), 0, 0, INTER_CUBIC);
threshold(resized_img, dst, 128, 255, CV_THRESH_BINARY);
//Canny(image,contours,10,350);
namedWindow("resized image");
imshow("resized image",resized_img);
//imshow("threshold",dst);
blur( resized_img, detected_edges, Size(2,2) );
imshow("blurred", detected_edges);
Canny(detected_edges,contours,10,350);
imshow("contour",contours);
waitKey(0);
return 1;
}
我尝试了canny边缘检测算法,但它似乎找到了很多边缘。而且我还不知道如何将房间的地板与椅子的地板结合起来。
谢谢。