equa与==的区别

从Object的层次来说,==与equals是相同的,都市比较内存地址,也就是说,都是比较两个引用是否指向同一个对象,是则返回true 否则就返回false

但是很多类overwrite了equals方法,最典型的就是String类了    

可以参考jkd源码包里  Object和String的类中关于equal的具体实现  

所以:==比较内存没有错,但是equal比较内容就片面了  !

转载于:https://www.cnblogs.com/feifeihu/archive/2012/08/19/2646100.html

请仿照下边这段代码写一段代码:(1)直方图均衡化 function Untitled_8_Callback(hObject, eventdata, handles) im=handles.a; sz=length(size(im)); %判断是否为灰度图像 %size:获取数组的行数和列数 %length:数组长度(即行数或列数中的较大值) if sz == 2 equa=histeq(im); %直方图均衡 figure, subplot(121),imhist(im),title('直方图均衡前') subplot(122),imhist(equa),title('直方图均衡后') axes(handles.axes2) imshow(equa,'InitialMagnification','fit'),title('直方图均衡后图') else equa1 = histeq(im(:,:,1)); equa2 = histeq(im(:,:,2)); equa3 = histeq(im(:,:,3)); figure, subplot(231),imhist(im(:,:,1)),title('R分量直方图均衡前'); subplot(232),imhist(im(:,:,2)),title('G分量直方图均衡前'); subplot(233),imhist(im(:,:,3)),title('B分量直方图均衡前'); subplot(234),imhist(equa1),title('R分量直方图均衡前'); subplot(235),imhist(equa2),title('G分量直方图均衡前'); subplot(236),imhist(equa3),title('B分量直方图均衡前'); axes(handles.axes2) imshow(cat(3,equa1,equa2,equa3),'InitialMagnification','fit'),title('直方图均衡后图') end % hObject handle to Untitled_8 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) 程序源代码以及关键部分注释 (2)canny算法 function Untitled_24_Callback(hObject, eventdata, handles) axes(handles.axes1); d = handles.a; B=getimage(handles.axes1); B = rgb2gray(B); img=edge(B,'canny'); axes(handles.axes2); imshow(img);
最新发布
06-01
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值