wwfunction varargout = thrline3(varargin)
gui_Singleton = 1;
matlab与python最大的不同是,matlab的下标是从1开始的,python和C语言C++都是下标从0开始的,在matlab中,对图片缩放,有一个imresize函数,Resize the image, specifying scale factor and using default interpolation method and antialiasing.在Python在,有resize函数,但是对图片的缩放效果不同。
matlab中的kmean
[cluster_idx cluster_center] = kmeans(ab,nColors,'distance','sqEuclidean','Replicates',1,'EmptyAction','drop', 'Options',opts);
在Python中:
nColors = 5
cluster_idx = KMeans(n_clusters=nColors, max_iter=38,n_init=40, init='k-means++',n_jobs=-1).fit(ab)
cluster__center = cluster_idx.cluster_centers_
在matlab中有有从rgb转化成lab的图片
if length(size(I)) >2
I=rgb2gray(I);
在python中当图片的维度大于2时,进行转换,并且在转换前,都要将矩阵里面的值转换成int类型。
image_orig = image_orig.astype(np.uint8)
if len(num) > 2:
lab_he = cv2.cvtColor(image_orig,cv2.COLOR_BGR2LAB)
else:
lab_he = image_orig