摘要: 功能:标注二进制图像中已连接的部分。语法:L = bwlabel(BW,n) [L,num] = bwlabel(BW,n) 其中BW为输入图像;N可取值为4或8表示连接四连通或八连通区域;NUM为找到的连通区域数目;L为输出图像矩阵,其元素值为整数,背景被标记为0,第一个连通区域被标记为1,第二个连通区域被标记为2,依此类推.所以你不明白的1,2,3即为第1,2,3个连通区域的标记网上给出的解释大部分是不完整的,官网的解释L = bwlabel(BW, n) returns a matrix L, of the same size as BW, containing labels for t 阅读全文
posted @ 2012-08-20 11:19 小鸡蛋的理想 阅读(6137) 评论(0) 推荐(0) 编辑
摘要: 针对min max用法:[m,n]=min(A), %A表示矩阵,即返回A中每列的最小值存于m中,n即是每个最小值的行号;[m1,n1]=min(m), %m1表示m中最小值,n1表示最小值的列号;这样解析是不是很清楚的呀。。。。。 阅读全文
posted @ 2012-08-20 10:26 小鸡蛋的理想 阅读(393) 评论(0) 推荐(0) 编辑
摘要: 例如有10张图片,分别为1.bmp,2.bmp.....for i = 1:10 name1=num2str(i); filename=strcat(name1,'.bmp); img = imread(filename); filename = strcat(name1,'.jpg'); imwrite(img,filename); end 大家试试呀~~~~~~~~~~ 阅读全文
posted @ 2012-08-15 22:29 小鸡蛋的理想 阅读(793) 评论(0) 推荐(0) 编辑
摘要: 在此用regionprops实现了二值图像划region,找质心clc; clear all; close all;I=imread('1.jpg');I1 = im2bw(I);figure; imshow(I, []);figure; imshow(I1, []);L = bwlabel(I1);stats = regionprops(L, 'all'); hold on;for i = 1 : length(stats) temp = stats(i).Centroid; plot(temp(1), temp(2), 'r.');end f 阅读全文
posted @ 2012-08-15 22:23 小鸡蛋的理想 阅读(807) 评论(0) 推荐(0) 编辑
摘要: f = fullfile(folderName1, folderName2, ..., fileName) builds a full file specification f from the folders and file name specified. Input arguments folderName1, folderName2, etc. and fileName are each strings enclosed in single quotation marks. The output of fullfile is conceptually equivalent to f = 阅读全文
posted @ 2012-08-02 20:16 小鸡蛋的理想 阅读(1554) 评论(0) 推荐(0) 编辑
摘要: functions:Graphical input from mouse or cursorginput提供了一个十字光标使我们能更精确的选择我们所需要的位置,并返回坐标值。函数调用形式为:[x,y] = ginput(n)[x,y] = ginput[x,y,button] = ginput(...)对于[x,y] = ginput(n),能使你从当前的坐标系中读取n个点,并返回这n个点的x,y坐标,均为nX1的向量。可以按回车提前结束读数。[x,y] = ginput 可以无限的读取坐标直到按下回车键。[x,y,button] = ginput(...) 返回x和y的坐标,以及button 阅读全文
posted @ 2012-08-02 10:31 小鸡蛋的理想 阅读(18012) 评论(1) 推荐(1) 编辑
摘要: 1、opencv2、matlab可以明显的看出matlab的边缘更为细腻。首先回顾一下传统的canny算法的主要步骤:1、使用sobel差分算子求出灰度图像的x和y方向导数;2、求出图像各点梯度大小及其方向;3、设置高低两个阈值,梯度大于高阈值为强边像素点,大于低阈值为潜在可能是较弱的边缘点;4、在经过一次筛选剩下的强边缘点中沿着梯度方向进行非极大值抑制;5、顺着二次筛选后的强边点寻找邻近的弱边点得到最终的边缘。opencv和matlab都基本按照以上步骤得到各自的canny 函数,但一般来说处理之前都先对图像进行模糊平滑,这样得到的效果更好。opencv更注重实时性,所以连平滑都作为可选项放 阅读全文
posted @ 2012-07-30 19:50 小鸡蛋的理想 阅读(1135) 评论(0) 推荐(0) 编辑
摘要: 彩色图是没有直方图的,只能在rgb方向分别求直方图在合并一下。简单点 ,用rgb2gray转到灰度图,再在二维上进行直方图绘制;close all;clear all;clc;I=imread('5.jpg');figure,imshow(I)I=rgb2gray(I);figure,imshow(I,[]);imhist(I,64);[COUNT x]=imhist(I);under=0;%小于60的像素所占的比例for i=0:60 under=under+COUNT(i==x);endunder;total=size(I,1)*size(I,2)*size(I,3);pe 阅读全文
posted @ 2012-07-15 16:54 小鸡蛋的理想 阅读(190) 评论(0) 推荐(0) 编辑
摘要: % MAKE_BAYER convert RGB image to a 2x2 [GR;BG] Bayer pattern%% Ibayer = make_bayer(Irgb);%% Assignment 1 - sample code.function Ibay = make_bayer(Irgb)% NOTE: the bayer pattern here is thre 2x2 repeating% pattern [ B G ; G R ] that is:%% BGBGBGBGBGBGBGBGBGBG ...etc...% GRGRGRGRGRGRGRGRGRGR ...etc.. 阅读全文
posted @ 2012-07-11 21:49 小鸡蛋的理想 阅读(673) 评论(0) 推荐(0) 编辑
摘要: 方法:带噪声图像-小波分解-分度去噪-逆小波变换-恢复图像。远离我不多说了,那么多看的心烦,还是上代码比较好说话的clear; X=imread('life.jpg'); X=rgb2gray(X);subplot(221); imshow(X); title('原始图像'); % 生成含噪图像并图示init=2055615866; randn('seed',init); X=double(X);% 添加随机噪声XX=X+8*randn(siz... 阅读全文
posted @ 2012-07-11 20:32 小鸡蛋的理想 阅读(1907) 评论(0) 推荐(1) 编辑