Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matlab 在方格纸上将手写数字与背景分开_Matlab_Image Processing_Image Segmentation_Handwriting - Fatal编程技术网

Matlab 在方格纸上将手写数字与背景分开

Matlab 在方格纸上将手写数字与背景分开,matlab,image-processing,image-segmentation,handwriting,Matlab,Image Processing,Image Segmentation,Handwriting,我是matlab新手,我正在尝试编写一个代码,可以将手写数字从一个平方页背景中分离出来。我曾尝试使用kmeans将数字与线条和静噪器区分开来,但它并不适用于所有图像。 你知道我该怎么做吗? 塔恩克斯 我在R中使用EBImage软件包,但我相信您可以在matlab中找到相应的: 从原始图像开始: #读取和提取灰度图像 #使用3个中心运行kmeans km=kmeans(如向量(x),3) c=公里/中心 # 1 0.4936797 # 2 0.2841005 # 3 0.6456494 #将最小

我是matlab新手,我正在尝试编写一个代码,可以将手写数字从一个平方页背景中分离出来。我曾尝试使用kmeans将数字与线条和静噪器区分开来,但它并不适用于所有图像。 你知道我该怎么做吗?
塔恩克斯

我在R中使用EBImage软件包,但我相信您可以在matlab中找到相应的:

从原始图像开始:

#读取和提取灰度图像 #使用3个中心运行kmeans km=kmeans(如向量(x),3) c=公里/中心 # 1 0.4936797 # 2 0.2841005 # 3 0.6456494 #将最小的簇2(您的数字)提取为二进制图像 t=(km$集群==2) r=矩阵(t,nrow(x)) r现在看起来像:

# Apply morphological opening (erode then dilate) with smallest possible structural element kern = makeBrush(3, 'box') #[,1] [,2] [,3] #[1,] 1 1 1 #[2,] 1 1 1 #[3,] 1 1 1 z = openingGreyScale(r, kern)

#使用尽可能小的结构元素应用形态开口(腐蚀然后扩张) kern=makeBrush(3,'box') #[,1] [,2] [,3] #[1,] 1 1 1 #[2,] 1 1 1 #[3,] 1 1 1 z=开放灰度(r,kern) z现在看起来像


您能展示一个示例图像+您尝试的结果(包括使用的代码)吗?当然,这里有一个下载代码的链接:和一个“好”图片的链接:和一个“坏”图片的链接:这里有一个word文档,显示了结果:这里有一个有趣的项目。虽然有许多复杂的计算机视觉和图像处理解决方案可以解决这个问题,但我认为,就简单的实现而言,到目前为止,您的解决方案相当不错。我认为一种技术应该是二维傅立叶变换;背景中的周期性网格线是频率滤波器的主要目标。ur链接不再工作。你能再次发布可行的链接吗?我想抢购一下。谢谢 # Apply morphological opening (erode then dilate) with smallest possible structural element kern = makeBrush(3, 'box') #[,1] [,2] [,3] #[1,] 1 1 1 #[2,] 1 1 1 #[3,] 1 1 1 z = openingGreyScale(r, kern)